This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

C++ PATCH: Fix construction vtable mangling


We were failing to set DECL_ASSEMBLER_NAME on construction vtables, so
mangle_decl wrapped their names in a class scope modifier.  Fixed by
setting it in build_vtable rather than the caller.

Applied to trunk and branch.

2001-05-18  Jason Merrill  <jason_merrill@redhat.com>

	* class.c (build_vtable): Set DECL_ASSEMBLER_NAME for vtables here.
	(get_vtable_decl, build_vtt): Not here.

*** class.c.~1~	Wed May 16 15:55:30 2001
--- class.c	Fri May 18 19:42:17 2001
*************** build_vtable (class_type, name, vtable_t
*** 726,738 ****
    tree decl;
  
    decl = build_lang_decl (VAR_DECL, name, vtable_type);
    DECL_CONTEXT (decl) = class_type;
    DECL_ARTIFICIAL (decl) = 1;
    TREE_STATIC (decl) = 1;
- #ifndef WRITABLE_VTABLES
-   /* Make them READONLY by default. (mrs) */
    TREE_READONLY (decl) = 1;
- #endif
    DECL_VIRTUAL_P (decl) = 1;
    import_export_vtable (decl, class_type, 0);
  
--- 726,738 ----
    tree decl;
  
    decl = build_lang_decl (VAR_DECL, name, vtable_type);
+   /* vtable names are already mangled; give them their DECL_ASSEMBLER_NAME
+      now to avoid confusion in mangle_decl.  */
+   SET_DECL_ASSEMBLER_NAME (decl, name);
    DECL_CONTEXT (decl) = class_type;
    DECL_ARTIFICIAL (decl) = 1;
    TREE_STATIC (decl) = 1;
    TREE_READONLY (decl) = 1;
    DECL_VIRTUAL_P (decl) = 1;
    import_export_vtable (decl, class_type, 0);
  
*************** get_vtable_decl (type, complete)
*** 761,767 ****
      }
    
    decl = build_vtable (type, name, void_type_node);
-   SET_DECL_ASSEMBLER_NAME (decl, name);
    decl = pushdecl_top_level (decl);
    my_friendly_assert (IDENTIFIER_GLOBAL_VALUE (name) == decl,
  		      20000517);
--- 761,766 ----
*************** build_vtt (t)
*** 7030,7036 ****
  				 
    /* Now, build the VTT object itself.  */
    vtt = build_vtable (t, get_vtt_name (t), type);
-   SET_DECL_ASSEMBLER_NAME (vtt, DECL_NAME (vtt));
    pushdecl_top_level (vtt);
    initialize_array (vtt, inits);
  }
--- 7029,7034 ----

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]