decl.c (grokvardecl): Don't build external assembler names for TYPENAMEs in other...
authorAndrew MacLeod <amacleod@cygnus.com>
Tue, 16 Jun 1998 12:36:14 +0000 (12:36 +0000)
committerAndrew Macleod <amacleod@gcc.gnu.org>
Tue, 16 Jun 1998 12:36:14 +0000 (12:36 +0000)
1998-06-16  Andrew MacLeod  <amacleod@cygnus.com>
* decl.c (grokvardecl): Don't build external assembler names for
TYPENAMEs in other namespaces as there is no declarator.
* error.c (cp_file_of, cp_line_of): Don't extract file or line number
info from DECL_CONTEXT if it is NULL.

From-SVN: r20524

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/error.c

index 72943d1521290a679de1c044359194a6709a444c..3372b1933775094bab37c24bb8d284e8567bae56 100644 (file)
@@ -1,3 +1,10 @@
+1998-06-16  Andrew MacLeod  <amacleod@cygnus.com>
+
+       * decl.c (grokvardecl): Don't build external assembler names for 
+       TYPENAMEs in other namespaces as there is no declarator.
+       * error.c (cp_file_of, cp_line_of): Don't extract file or line number
+       info from DECL_CONTEXT if it is NULL.
+
 1998-06-16  Jason Merrill  <jason@yorick.cygnus.com>
 
        * call.c (check_dtor_name): Split out.
index 20dfdf7828634c0b7ba5b1c4c532e04d1e8e7b7f..674d668471bf4dbbf15a743234a51c0bcd025d5a 100644 (file)
@@ -7848,7 +7848,7 @@ grokvardecl (type, declarator, specbits_in, initialized, constp, in_namespace)
     {
       tree context = in_namespace ? in_namespace : current_namespace;
       decl = build_decl (VAR_DECL, declarator, complete_type (type));
-      if (context != global_namespace)
+      if (context != global_namespace && declarator)
        DECL_ASSEMBLER_NAME (decl) =  build_static_name (context,
                                                         declarator);
     }
index 4862d64894c02d95e0f7d31b674666abf23124e1..d4dc054c970c8acee55c6393bac223bcd484966a 100644 (file)
@@ -1811,7 +1811,7 @@ char *
 cp_file_of (t)
      tree t;
 {
-  if (TREE_CODE (t) == PARM_DECL)
+  if (TREE_CODE (t) == PARM_DECL && DECL_CONTEXT (t))
     return DECL_SOURCE_FILE (DECL_CONTEXT (t));
   else if (TREE_CODE_CLASS (TREE_CODE (t)) == 't')
     return DECL_SOURCE_FILE (TYPE_MAIN_DECL (t));
@@ -1824,7 +1824,7 @@ cp_line_of (t)
      tree t;
 {
   int line = 0;
-  if (TREE_CODE (t) == PARM_DECL)
+  if (TREE_CODE (t) == PARM_DECL && DECL_CONTEXT (t))
     line = DECL_SOURCE_LINE (DECL_CONTEXT (t));
   if (TREE_CODE (t) == TYPE_DECL && DECL_ARTIFICIAL (t))
     t = TREE_TYPE (t);