as necessary. */
unreverse_member_declarations (t);
- /* Mark all the tags in the class as class-local. */
- for (x = CLASSTYPE_TAGS (t); x; x = TREE_CHAIN (x))
- TREE_NONLOCAL_FLAG (TREE_VALUE (x)) = 0;
-
cplus_decl_attributes (t, attributes, NULL_TREE);
if (processing_template_decl)
unuse_fields (type);
}
- for (tags = CLASSTYPE_TAGS (type); tags; tags = TREE_CHAIN (tags))
- {
- tree tag_type = TREE_VALUE (tags);
-
- TREE_NONLOCAL_FLAG (tag_type) = 1;
- if (! TREE_PURPOSE (tags))
- continue;
- if (! (IS_AGGR_TYPE_CODE (TREE_CODE (tag_type))
- && CLASSTYPE_IS_TEMPLATE (tag_type)))
- pushtag (TREE_PURPOSE (tags), tag_type, 0);
- }
+ storetags (CLASSTYPE_TAGS (type));
}
}
them. This is it! */
for (t = previous_class_values; t; t = TREE_CHAIN (t))
IDENTIFIER_CLASS_VALUE (TREE_PURPOSE (t)) = NULL_TREE;
- while (tags)
- {
- TREE_NONLOCAL_FLAG (TREE_VALUE (tags)) = 0;
- tags = TREE_CHAIN (tags);
- }
previous_class_type = NULL_TREE;
}
void
popclass ()
{
- /* Just remove from this class what didn't make
- it into IDENTIFIER_CLASS_VALUE. */
- tree tags = CLASSTYPE_TAGS (current_class_type);
-
- while (tags)
- {
- TREE_NONLOCAL_FLAG (TREE_VALUE (tags)) = 0;
- tags = TREE_CHAIN (tags);
- }
-
poplevel (1, 0, 0);
/* Since poplevel_class does the popping of class decls nowadays,
this really only frees the obstack used for these decls. */
#define _CP_TREE_H
/* Usage of TREE_LANG_FLAG_?:
- 0: TREE_NONLOCAL_FLAG (in TREE_LIST or _TYPE).
- BINFO_MARKED (BINFO nodes).
+ 0: BINFO_MARKED (BINFO nodes).
COMPOUND_STMT_NO_SCOPE (in COMPOUND_STMT).
NEW_EXPR_USE_GLOBAL (in NEW_EXPR).
DELETE_EXPR_USE_GLOBAL (in DELETE_EXPR).
(TYPE_NEEDS_DESTRUCTOR (NODE) \
|| (TYPE_LANG_SPECIFIC (NODE) && TYPE_VEC_DELETE_TAKES_SIZE (NODE)))
-/* Nonzero for TREE_LIST or _TYPE node means that this node is class-local. */
-#define TREE_NONLOCAL_FLAG(NODE) (TREE_LANG_FLAG_0 (NODE))
-
/* Nonzero means that this _CLASSTYPE node defines ways of converting
itself to other types. */
#define TYPE_HAS_CONVERSION(NODE) (TYPE_LANG_SPECIFIC(NODE)->type_flags.has_type_conversion)
extern tree check_default_argument PROTO((tree, tree));
extern tree push_overloaded_decl PROTO((tree, int));
extern void clear_identifier_class_values PROTO((void));
+extern void storetags PROTO((tree));
/* in decl2.c */
extern int check_java_method PROTO((tree));
static void declare_namespace_level PROTO((void));
static void signal_catch PROTO((int)) ATTRIBUTE_NORETURN;
static void storedecls PROTO((tree));
-static void storetags PROTO((tree));
static void require_complete_types_for_parms PROTO((tree));
static void push_overloaded_decl_1 PROTO((tree));
static int ambi_op_p PROTO((tree));
binding = IDENTIFIER_BINDING (id);
if (BINDING_VALUE (binding) == decl && TREE_CODE (decl) != TREE_LIST)
{
- if (TREE_CODE (decl) == OVERLOAD)
- context = DECL_REAL_CONTEXT (OVL_CURRENT (decl));
+ /* Any implicit typename must be from a base-class. The
+ context for an implicit typename declaration is always
+ the derived class in which the lookup was done, so the checks
+ based on the context of DECL below will not trigger. */
+ if (TREE_CODE (decl) == TYPE_DECL
+ && IMPLICIT_TYPENAME_P (TREE_TYPE (decl)))
+ INHERITED_VALUE_BINDING_P (binding) = 1;
else
{
- my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd',
- 0);
- context = DECL_REAL_CONTEXT (decl);
- }
+ if (TREE_CODE (decl) == OVERLOAD)
+ context = DECL_REAL_CONTEXT (OVL_CURRENT (decl));
+ else
+ {
+ my_friendly_assert (TREE_CODE_CLASS (TREE_CODE (decl)) == 'd',
+ 0);
+ context = DECL_REAL_CONTEXT (decl);
+ }
- if (is_properly_derived_from (current_class_type, context))
- INHERITED_VALUE_BINDING_P (binding) = 1;
- else
- INHERITED_VALUE_BINDING_P (binding) = 0;
+ if (is_properly_derived_from (current_class_type, context))
+ INHERITED_VALUE_BINDING_P (binding) = 1;
+ else
+ INHERITED_VALUE_BINDING_P (binding) = 0;
+ }
}
else if (BINDING_VALUE (binding) == decl)
/* We only encounter a TREE_LIST when push_class_decls detects an
binding level, but is instead the pseudo-global level. */
b->level_chain->tags =
saveable_tree_cons (name, type, b->level_chain->tags);
- TREE_NONLOCAL_FLAG (type) = 1;
if (TYPE_SIZE (current_class_type) == NULL_TREE)
CLASSTYPE_TAGS (current_class_type) = b->level_chain->tags;
}
int globalize;
{
register struct binding_level *b;
- tree context = 0;
- tree c_decl = 0;
b = current_binding_level;
while (b->tag_transparent
if (name)
{
- context = type ? TYPE_CONTEXT (type) : NULL_TREE;
- if (! context)
- {
- tree cs = current_scope ();
-
- if (! globalize)
- context = cs;
- else if (cs != NULL_TREE
- && TREE_CODE_CLASS (TREE_CODE (cs)) == 't')
- /* When declaring a friend class of a local class, we want
- to inject the newly named class into the scope
- containing the local class, not the namespace scope. */
- context = hack_decl_function_context (get_type_decl (cs));
- }
- if (context)
- c_decl = TREE_CODE (context) == FUNCTION_DECL
- ? context : TYPE_MAIN_DECL (context);
-
- if (!context)
- context = current_namespace;
-
/* Do C++ gratuitous typedefing. */
if (IDENTIFIER_TYPE_VALUE (name) != type)
{
register tree d = NULL_TREE;
int newdecl = 0, in_class = 0;
+ tree context;
+ tree c_decl = NULL_TREE;
+
+ context = type ? TYPE_CONTEXT (type) : NULL_TREE;
+ if (! context)
+ {
+ tree cs = current_scope ();
+
+ if (! globalize)
+ context = cs;
+ else if (cs != NULL_TREE
+ && TREE_CODE_CLASS (TREE_CODE (cs)) == 't')
+ /* When declaring a friend class of a local class, we want
+ to inject the newly named class into the scope
+ containing the local class, not the namespace scope. */
+ context = hack_decl_function_context (get_type_decl (cs));
+ }
+ if (context)
+ c_decl = TREE_CODE (context) == FUNCTION_DECL
+ ? context : TYPE_MAIN_DECL (context);
+
+ if (!context)
+ context = current_namespace;
if ((b->pseudo_global && b->level_chain->parm_flag == 2)
|| b->parm_flag == 2)
}
if (b->parm_flag == 2)
{
- TREE_NONLOCAL_FLAG (type) = 1;
if (TYPE_SIZE (current_class_type) == NULL_TREE)
CLASSTYPE_TAGS (current_class_type) = b->tags;
}
/* Similarly, store the list of tags of the current level. */
-static void
+void
storetags (tags)
tree tags;
{