]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* cp-names.y (yylex): Fix thinko for character constants.
authorDaniel Jacobowitz <drow@false.org>
Tue, 30 Dec 2003 21:01:20 +0000 (21:01 +0000)
committerDaniel Jacobowitz <drow@false.org>
Tue, 30 Dec 2003 21:01:20 +0000 (21:01 +0000)
* dwarf2read.c: Include "cp-names.h".
(read_structure_scope): Canonicalize class names.

gdb/ChangeLog.cplus
gdb/cp-names.y
gdb/dwarf2read.c

index 99fd1c884190fd0dce472aaf3fdbf0904b1bd62e..a13d44f56cdaa7c545cf6906160dc04349e0b62e 100644 (file)
@@ -1,3 +1,9 @@
+2003-12-30  Daniel Jacobowitz  <drow@mvista.com>
+
+       * cp-names.y (yylex): Fix thinko for character constants.
+       * dwarf2read.c: Include "cp-names.h".
+       (read_structure_scope): Canonicalize class names.
+
 2003-12-24  Daniel Jacobowitz  <drow@mvista.com>
 
        * Makefile.in (cp_names_h): New variable.
index eac833336e456b79a67e80c36314188db21c913c..60df8a8de3c486668dd032051d70c2774fb19b8d 100644 (file)
@@ -1597,13 +1597,18 @@ yylex (void)
                  "character set `%s'.", tok, target_charset ());
         }
 
-      yylval.typed_val_int.val = c;
-      yylval.typed_val_int.type = d_builtin_type ('c' - 'a');
-
       c = *lexptr++;
       if (c != '\'')
        error ("Invalid character constant.");
 
+      /* FIXME: We should refer to a canonical form of the character,
+        presumably the same one that appears in manglings - the decimal
+        representation.  But if that isn't in our input then we have to
+        allocate memory for it somewhere.  */
+      yylval.comp = d_make_comp (di, D_COMP_LITERAL,
+                                d_builtin_type ('c' - 'a'),
+                                d_make_name (di, tokstart, lexptr - tokstart));
+
       return INT;
 
     case '(':
index bf2a57e519758a1fba4cb77a9d1e9d1196f01f33..0616a35d8e546d4bc7734982c0beccf23326311f 100644 (file)
@@ -44,6 +44,7 @@
 #include "dwarf2expr.h"
 #include "dwarf2loc.h"
 #include "cp-support.h"
+#include "cp-names.h"
 
 #include <fcntl.h>
 #include "gdb_string.h"
@@ -2779,9 +2780,15 @@ read_structure_scope (struct die_info *die, struct dwarf2_cu *cu)
   attr = dwarf_attr (die, DW_AT_name);
   if (attr && DW_STRING (attr))
     {
-      TYPE_TAG_NAME (type) = obsavestring (DW_STRING (attr),
-                                          strlen (DW_STRING (attr)),
+      /* FIXME: This should be in a more general location.  */
+      char *name;
+      name = cp_canonicalize_string (DW_STRING (attr));
+      if (name == NULL)
+       name = DW_STRING (attr);
+      TYPE_TAG_NAME (type) = obsavestring (name, strlen (name),
                                           &objfile->type_obstack);
+      if (name != DW_STRING (attr))
+       free (name);
     }
 
   if (die->tag == DW_TAG_structure_type)