diff options
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r-- | gcc/cp/decl2.c | 69 |
1 files changed, 33 insertions, 36 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index eb1dd00..b37dc8c 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2509,47 +2509,44 @@ import_export_decl (decl) else comdat_linkage (decl); } - else if (tinfo_decl_p (decl, 0)) - { - /* Here, we only decide whether or not the tinfo node should be - emitted with the vtable. The decl we're considering isn't - actually the one which gets emitted; that one is generated in - create_real_tinfo_var. */ - - tree ctype = TREE_TYPE (DECL_NAME (decl)); - - if (IS_AGGR_TYPE (ctype)) - import_export_class (ctype); - - if (IS_AGGR_TYPE (ctype) && CLASSTYPE_INTERFACE_KNOWN (ctype) - && TYPE_POLYMORPHIC_P (ctype) - /* If -fno-rtti, we're not necessarily emitting this stuff with - the class, so go ahead and emit it now. This can happen - when a class is used in exception handling. */ - && flag_rtti - /* If the type is a cv-qualified variant of a type, then we - must emit the tinfo function in this translation unit - since it will not be emitted when the vtable for the type - is output (which is when the unqualified version is - generated). */ - && same_type_p (ctype, TYPE_MAIN_VARIANT (ctype))) - { - DECL_NOT_REALLY_EXTERN (decl) - = ! CLASSTYPE_INTERFACE_ONLY (ctype); - DECL_COMDAT (decl) = 0; - } - else - { - DECL_NOT_REALLY_EXTERN (decl) = 1; - DECL_COMDAT (decl) = 1; - } - } else comdat_linkage (decl); DECL_INTERFACE_KNOWN (decl) = 1; } +/* Here, we only decide whether or not the tinfo node should be + emitted with the vtable. */ + +void +import_export_tinfo (decl, type) + tree decl; + tree type; +{ + if (DECL_INTERFACE_KNOWN (decl)) + return; + + if (IS_AGGR_TYPE (type)) + import_export_class (type); + + if (IS_AGGR_TYPE (type) && CLASSTYPE_INTERFACE_KNOWN (type) + && TYPE_POLYMORPHIC_P (type) + /* If -fno-rtti, we're not necessarily emitting this stuff with + the class, so go ahead and emit it now. This can happen when + a class is used in exception handling. */ + && flag_rtti) + { + DECL_NOT_REALLY_EXTERN (decl) = !CLASSTYPE_INTERFACE_ONLY (type); + DECL_COMDAT (decl) = 0; + } + else + { + DECL_NOT_REALLY_EXTERN (decl) = 1; + DECL_COMDAT (decl) = 1; + } + DECL_INTERFACE_KNOWN (decl) = 1; +} + tree build_cleanup (decl) tree decl; @@ -3344,7 +3341,7 @@ finish_file () /* Write out needed type info variables. Writing out one variable might cause others to be needed. */ - if (walk_globals (tinfo_decl_p, emit_tinfo_decl, /*data=*/0)) + if (walk_globals (unemitted_tinfo_decl_p, emit_tinfo_decl, /*data=*/0)) reconsider = 1; /* The list of objects with static storage duration is built up |