tree.c (decl_function_context): Handle virtual functions.
authorJason Merrill <jason@casey.cygnus.com>
Wed, 15 Dec 1999 09:37:48 +0000 (09:37 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 15 Dec 1999 09:37:48 +0000 (04:37 -0500)
        * 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.

From-SVN: r30950

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

index 630977997009d13a4783e6e82553d9502b6ba434..b300d613c6d1a98c5afdc70f9dd1f8c2d47ff2a1 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 1df09c60ee1e772c5d80b9268cd393d7720a5d2a..cb9e77ff144fe4adc4ecf3e69bfcb11614b84177 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 3fdd135a2c74a32f36ccc1a18859c5e8986aa551..a6130a14c29f502e46fd2c3ed8eadbf2687022f2 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 37a8654be0a4966184c3969d777dfd3c43a249be..78ea4cf976a7a9d3d5cedafca27adf9ab6a98a46 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);