diff options
Diffstat (limited to 'gcc/cp/rtti.c')
-rw-r--r-- | gcc/cp/rtti.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/cp/rtti.c b/gcc/cp/rtti.c index 17942c30fd6..7540b5c0e72 100644 --- a/gcc/cp/rtti.c +++ b/gcc/cp/rtti.c @@ -328,6 +328,15 @@ get_tinfo_decl (type) type = build_function_type (TREE_TYPE (type), TREE_CHAIN (TYPE_ARG_TYPES (type))); + /* For a class type, the variable is cached in the type node + itself. */ + if (CLASS_TYPE_P (type)) + { + d = CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type)); + if (d) + return d; + } + name = mangle_typeinfo_for_type (type); d = IDENTIFIER_GLOBAL_VALUE (name); @@ -347,6 +356,9 @@ get_tinfo_decl (type) pushdecl_top_level (d); + if (CLASS_TYPE_P (type)) + CLASSTYPE_TYPEINFO_VAR (TYPE_MAIN_VARIANT (type)) = d; + /* Remember the type it is for. */ TREE_TYPE (name) = type; } |