Commit 848cf1e0 by Mark Mitchell Committed by Mark Mitchell

decl.c (lookup_nested_type): Remove.

	* decl.c (lookup_nested_type): Remove.
	(pushtag): Don't call it.

From-SVN: r28166
parent bdfdb749
1999-07-18 Mark Mitchell <mark@codesourcery.com>
* decl.c (lookup_nested_type): Remove.
(pushtag): Don't call it.
Sat Jul 17 23:51:30 1999 Jeffrey A Law (law@cygnus.com) Sat Jul 17 23:51:30 1999 Jeffrey A Law (law@cygnus.com)
* Makefile.in (INTERFACE): Bump to 2. * Makefile.in (INTERFACE): Bump to 2.
......
...@@ -132,7 +132,6 @@ static struct stack_level *decl_stack; ...@@ -132,7 +132,6 @@ static struct stack_level *decl_stack;
#endif #endif
static tree grokparms PROTO((tree, int)); static tree grokparms PROTO((tree, int));
static tree lookup_nested_type PROTO((tree, tree));
static const char *redeclaration_error_message PROTO((tree, tree)); static const char *redeclaration_error_message PROTO((tree, tree));
static struct stack_level *push_decl_level PROTO((struct stack_level *, static struct stack_level *push_decl_level PROTO((struct stack_level *,
...@@ -2867,9 +2866,8 @@ pushtag (name, type, globalize) ...@@ -2867,9 +2866,8 @@ pushtag (name, type, globalize)
if (IDENTIFIER_TYPE_VALUE (name) != type) if (IDENTIFIER_TYPE_VALUE (name) != type)
{ {
register tree d = NULL_TREE; register tree d = NULL_TREE;
int newdecl = 0, in_class = 0; int in_class = 0;
tree context; tree context;
tree c_decl = NULL_TREE;
context = type ? TYPE_CONTEXT (type) : NULL_TREE; context = type ? TYPE_CONTEXT (type) : NULL_TREE;
if (! context) if (! context)
...@@ -2885,31 +2883,19 @@ pushtag (name, type, globalize) ...@@ -2885,31 +2883,19 @@ pushtag (name, type, globalize)
containing the local class, not the namespace scope. */ containing the local class, not the namespace scope. */
context = hack_decl_function_context (get_type_decl (cs)); 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) if (!context)
context = current_namespace; context = current_namespace;
if ((b->pseudo_global && b->level_chain->parm_flag == 2) if ((b->pseudo_global && b->level_chain->parm_flag == 2)
|| b->parm_flag == 2) || b->parm_flag == 2)
in_class = 1; in_class = 1;
else
d = lookup_nested_type (type, c_decl);
if (d == NULL_TREE)
{
newdecl = 1;
d = build_decl (TYPE_DECL, name, type); d = build_decl (TYPE_DECL, name, type);
if (current_lang_name == lang_name_java) if (current_lang_name == lang_name_java)
TYPE_FOR_JAVA (type) = 1; TYPE_FOR_JAVA (type) = 1;
SET_DECL_ARTIFICIAL (d); SET_DECL_ARTIFICIAL (d);
if (! in_class) if (! in_class)
set_identifier_type_value_with_scope (name, type, b); set_identifier_type_value_with_scope (name, type, b);
}
else
d = TYPE_MAIN_DECL (d);
TYPE_NAME (type) = d; TYPE_NAME (type) = d;
DECL_CONTEXT (d) = FROB_CONTEXT (context); DECL_CONTEXT (d) = FROB_CONTEXT (context);
...@@ -2919,7 +2905,7 @@ pushtag (name, type, globalize) ...@@ -2919,7 +2905,7 @@ pushtag (name, type, globalize)
if (b->parm_flag == 2) if (b->parm_flag == 2)
{ {
if (newdecl && !PROCESSING_REAL_TEMPLATE_DECL_P ()) if (!PROCESSING_REAL_TEMPLATE_DECL_P ())
/* Put this TYPE_DECL on the TYPE_FIELDS list for the /* Put this TYPE_DECL on the TYPE_FIELDS list for the
class. But if it's a member template class, we class. But if it's a member template class, we
want the TEMPLATE_DECL, not the TYPE_DECL, so this want the TEMPLATE_DECL, not the TYPE_DECL, so this
...@@ -2931,8 +2917,6 @@ pushtag (name, type, globalize) ...@@ -2931,8 +2917,6 @@ pushtag (name, type, globalize)
else else
d = pushdecl_with_scope (d, b); d = pushdecl_with_scope (d, b);
if (newdecl)
{
if (ANON_AGGRNAME_P (name)) if (ANON_AGGRNAME_P (name))
DECL_IGNORED_P (d) = 1; DECL_IGNORED_P (d) = 1;
...@@ -2942,7 +2926,6 @@ pushtag (name, type, globalize) ...@@ -2942,7 +2926,6 @@ pushtag (name, type, globalize)
DECL_ASSEMBLER_NAME (d) DECL_ASSEMBLER_NAME (d)
= get_identifier (build_overload_name (type, 1, 1)); = get_identifier (build_overload_name (type, 1, 1));
} }
}
if (b->parm_flag == 2) if (b->parm_flag == 2)
{ {
if (TYPE_SIZE (current_class_type) == NULL_TREE) if (TYPE_SIZE (current_class_type) == NULL_TREE)
...@@ -5301,48 +5284,6 @@ lookup_tag_reverse (type, name) ...@@ -5301,48 +5284,6 @@ lookup_tag_reverse (type, name)
return NULL_TREE; return NULL_TREE;
} }
/* Lookup TYPE in CONTEXT (a chain of nested types or a FUNCTION_DECL).
Return the type value, or NULL_TREE if not found. */
static tree
lookup_nested_type (type, context)
tree type;
tree context;
{
if (context == NULL_TREE)
return NULL_TREE;
while (context)
{
switch (TREE_CODE (context))
{
case TYPE_DECL:
{
tree ctype = TREE_TYPE (context);
tree match = value_member (type, CLASSTYPE_TAGS (ctype));
if (match)
return TREE_VALUE (match);
context = DECL_CONTEXT (context);
/* When we have a nested class whose member functions have
local types (e.g., a set of enums), we'll arrive here
with the DECL_CONTEXT as the actual RECORD_TYPE node for
the enclosing class. Instead, we want to make sure we
come back in here with the TYPE_DECL, not the RECORD_TYPE. */
if (context && TREE_CODE (context) == RECORD_TYPE)
context = TREE_CHAIN (context);
}
break;
case FUNCTION_DECL:
if (TYPE_NAME (type) && TYPE_IDENTIFIER (type))
return lookup_name (TYPE_IDENTIFIER (type), 1);
return NULL_TREE;
default:
my_friendly_abort (12);
}
}
return NULL_TREE;
}
/* Look up NAME in the NAMESPACE. */ /* Look up NAME in the NAMESPACE. */
tree tree
......
// Build don't link:
// Origin: Geoffrey Furnish <furnish@actel.com>
namespace N {
template<class T> class C
{
template<class U> friend class C;
};
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment