Jason,
this is non-C++ specific part where I needed updating. The i386.c change will
need to be propagated into other backends. I also wonder if I should copy
PUBLIC flag from component type in complex numbers - can we produce complex
number from anonymous type?
Finally type_in_anonymous_namespace_p needs to be extended into two cases where
the type is considered nonanonymous by lack of DECL_NAME.
Bootstrapped/regtested x86_64-linux, seems sane?
Honza
* config/i386/i386.c (ix86_build_builtin_va_list_abi): Make va_list_tag
type name public
* stor-layout.c (finish_builtin_struct): Make builtin types public.
* tree.c (build_complex_type): Complex types are public.
(type_in_anonymous_namespace_p): Handle methods and arrays.
Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c (revision 212098)
+++ config/i386/i386.c (working copy)
@@ -8120,6 +8120,7 @@ ix86_build_builtin_va_list_abi (enum cal
record = lang_hooks.types.make_type (RECORD_TYPE);
type_decl = build_decl (BUILTINS_LOCATION,
TYPE_DECL, get_identifier ("__va_list_tag"), record);
+ TREE_PUBLIC (type_decl) = 1;
f_gpr = build_decl (BUILTINS_LOCATION,
FIELD_DECL, get_identifier ("gp_offset"),
Index: stor-layout.c
===================================================================
--- stor-layout.c (revision 212106)
+++ stor-layout.c (working copy)
@@ -2092,6 +2092,7 @@ finish_builtin_struct (tree type, const
TYPE_NAME (type) = build_decl (BUILTINS_LOCATION,
TYPE_DECL, get_identifier (name), type);
#endif
+ TREE_PUBLIC (TYPE_NAME (type)) = true;
TYPE_STUB_DECL (type) = TYPE_NAME (type);
layout_decl (TYPE_NAME (type), 0);
}
Index: tree.c
===================================================================
--- tree.c (revision 212098)
+++ tree.c (working copy)
@@ -8360,8 +8394,11 @@ build_complex_type (tree component_type)
name = 0;
if (name != 0)
- TYPE_NAME (t) = build_decl (UNKNOWN_LOCATION, TYPE_DECL,
- get_identifier (name), t);
+ {
+ TYPE_NAME (t) = build_decl (UNKNOWN_LOCATION, TYPE_DECL,
+ get_identifier (name), t);
+ TREE_PUBLIC (TYPE_NAME (t)) = true;
+ }
}
return build_qualified_type (t, TYPE_QUALS (component_type));
@@ -12009,8 +11901,16 @@ obj_type_ref_class (tree ref)
/* Return true if T is in anonymous namespace. */
bool
-type_in_anonymous_namespace_p (tree t)
+type_in_anonymous_namespace_p (const_tree t)
{
+ /* Methods do not have their STUB_DECLs, but they are anonymous
+ if type they belong to is. */
+ if (TREE_CODE (t) == METHOD_TYPE)
+ t = TYPE_METHOD_BASETYPE (t);
+ /* Arrays do not need to have STUB_DECLs, so look for the base
+ type. */
+ while (!TYPE_STUB_DECL (t) && TREE_CODE (t) == ARRAY_TYPE)
+ t = TREE_TYPE (t);
return (TYPE_STUB_DECL (t) && !TREE_PUBLIC (TYPE_STUB_DECL (t)));
}