* tree.c (decl_function_context): Handle virtual functions.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Dec 1999 09:37:48 +0000 (09:37 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 15 Dec 1999 09:37:48 +0000 (09:37 +0000)
        * tlink.c (scan_linker_output): Don't look in demangled name when
        looking for linker output keywords.

        * dwarfout.c (output_type): We can defer namespace-scope classes.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@30950 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/dwarfout.c
gcc/tlink.c
gcc/tree.c

index 6309779..b300d61 100644 (file)
@@ -1,3 +1,12 @@
+1999-12-15  Jason Merrill  <jason@casey.cygnus.com>
+
+       * tree.c (decl_function_context): Handle virtual functions.
+
+       * tlink.c (scan_linker_output): Don't look in demangled name when
+       looking for linker output keywords.
+
+       * dwarfout.c (output_type): We can defer namespace-scope classes.
+
 Wed Dec 15 01:23:29 1999  Jeffrey A Law  (law@cygnus.com)
 
        * regclass.c (record_reg_classes): Update comment for merging
index 1df09c6..cb9e77f 100644 (file)
@@ -4448,9 +4448,8 @@ output_type (type, containing_scope)
 
        if (TYPE_SIZE (type) == 0
            && (TYPE_CONTEXT (type) == NULL
-               || (TREE_CODE_CLASS (TREE_CODE (TYPE_CONTEXT (type))) == 't'
-                   && TREE_CODE (TYPE_CONTEXT (type)) != FUNCTION_TYPE
-                   && TREE_CODE (TYPE_CONTEXT (type)) != METHOD_TYPE))
+               || AGGREGATE_TYPE_P (TYPE_CONTEXT (type))
+               || TREE_CODE (TYPE_CONTEXT (type)) == NAMESPACE_DECL)
            && !finalizing)
          {
            /* We can't do this for function-local types, and we don't need
index 3fdd135..a6130a1 100644 (file)
@@ -638,6 +638,11 @@ scan_linker_output (fname)
          else if (p = index (oldq, '"'), p)
            p++, q = index (p, '"');
 
+         /* Don't let the strstr's below see the demangled name; we
+            might get spurious matches.  */
+         if (p)
+           p[-1] = '\0';
+
          /* We need to check for certain error keywords here, or we would
             mistakenly use GNU ld's "In function `foo':" message.  */
          if (q && (strstr (oldq, "ndefined")
index 37a8654..78ea4cf 100644 (file)
@@ -4802,6 +4802,15 @@ decl_function_context (decl)
 
   if (TREE_CODE (decl) == SAVE_EXPR)
     context = SAVE_EXPR_CONTEXT (decl);
+  /* C++ virtual functions use DECL_CONTEXT for the class of the vtable
+     where we look up the function at runtime.  Such functions always take
+     a first argument of type 'pointer to real context'.
+
+     C++ should really be fixed to use DECL_CONTEXT for the real context,
+     and use something else for the "virtual context".  */
+  else if (TREE_CODE (decl) == FUNCTION_DECL && DECL_VINDEX (decl))
+    context = TYPE_MAIN_VARIANT
+      (TREE_TYPE (TREE_VALUE (TYPE_ARG_TYPES (TREE_TYPE (decl)))));
   else
     context = DECL_CONTEXT (decl);