Commit 6eb3bb27 by Jason Merrill Committed by Jason Merrill

error.c (dump_simple_decl): Use DECL_CLASS_SCOPE_P and/or DECL_NAMESPACE_SCOPE_P.

	* error.c (dump_simple_decl): Use DECL_CLASS_SCOPE_P and/or
	DECL_NAMESPACE_SCOPE_P.
	(lang_decl_name): Likewise.
	* pt.c (tsubst_friend_function, tsubst): Likewise.
	* decl.c (pushdecl, redeclaration_error_message, start_decl,
	cp_finish_decl, start_function): Likewise.
	* class.c (finish_struct_1): Likewise.
	* call.c (build_over_call): Likewise.
	(compare_ics): Use DERIVED_FROM_P.

From-SVN: r19705
parent b706d7f2
Tue May 12 21:37:49 1998 Jason Merrill <jason@yorick.cygnus.com>
* error.c (dump_simple_decl): Use DECL_CLASS_SCOPE_P and/or
DECL_NAMESPACE_SCOPE_P.
(lang_decl_name): Likewise.
* pt.c (tsubst_friend_function, tsubst): Likewise.
* decl.c (pushdecl, redeclaration_error_message, start_decl,
cp_finish_decl, start_function): Likewise.
* class.c (finish_struct_1): Likewise.
* call.c (build_over_call): Likewise.
(compare_ics): Use DERIVED_FROM_P.
Tue May 12 07:24:18 1998 Mark Mitchell <mmitchell@usa.net> Tue May 12 07:24:18 1998 Mark Mitchell <mmitchell@usa.net>
* cp-tree.h (CANONICAL_TYPE_VARIANT): New macro. * cp-tree.h (CANONICAL_TYPE_VARIANT): New macro.
...@@ -11,12 +23,8 @@ Mon May 11 11:38:07 1998 Mark Mitchell <mmitchell@usa.net> ...@@ -11,12 +23,8 @@ Mon May 11 11:38:07 1998 Mark Mitchell <mmitchell@usa.net>
* ptree.c (lang_print_xnode): Add missing `break'. * ptree.c (lang_print_xnode): Add missing `break'.
Mon May 11 10:09:16 1998 Mark Mitchell <mmitchell@usa.net>
* pt.c (tsubst): Remove duplicate check for IDENTIFIER_NODE. * pt.c (tsubst): Remove duplicate check for IDENTIFIER_NODE.
Mon May 11 07:16:30 1998 Mark Mitchell <mmitchell@usa.net>
* call.c (add_template_candidate): Adjust for changes to * call.c (add_template_candidate): Adjust for changes to
fn_type_unification. fn_type_unification.
(add_template_candidate_real): Likewise. (add_template_candidate_real): Likewise.
...@@ -68,8 +76,6 @@ Mon May 11 07:16:30 1998 Mark Mitchell <mmitchell@usa.net> ...@@ -68,8 +76,6 @@ Mon May 11 07:16:30 1998 Mark Mitchell <mmitchell@usa.net>
* parse.h: Regenerated. * parse.h: Regenerated.
* parse.c: Really regenerated. * parse.c: Really regenerated.
Mon May 11 00:03:34 1998 Mark Mitchell <mmitchell@usa.net>
* cp-tree.h (finish_unary_op_expr): New function. * cp-tree.h (finish_unary_op_expr): New function.
(finish_id_expr): Likewise. (finish_id_expr): Likewise.
(begin_new_placement): Likewise. (begin_new_placement): Likewise.
...@@ -108,8 +114,8 @@ Sun May 10 23:43:13 1998 Mark Mitchell <mmitchell@usa.net> ...@@ -108,8 +114,8 @@ Sun May 10 23:43:13 1998 Mark Mitchell <mmitchell@usa.net>
Sun May 10 22:53:56 1998 Jason Merrill <jason@yorick.cygnus.com> Sun May 10 22:53:56 1998 Jason Merrill <jason@yorick.cygnus.com>
* cp-tree.h (DECL_NAMESPACE_SCOPE): New macro. * cp-tree.h (DECL_NAMESPACE_SCOPE_P): New macro.
(DECL_CLASS_SCOPE): Likewise. (DECL_CLASS_SCOPE_P): Likewise.
Sun May 10 22:48:22 1998 H.J. Lu (hjl@gnu.org) Sun May 10 22:48:22 1998 H.J. Lu (hjl@gnu.org)
......
...@@ -3294,14 +3294,12 @@ build_over_call (cand, args, flags) ...@@ -3294,14 +3294,12 @@ build_over_call (cand, args, flags)
we must be careful to do name lookup in the scope of we must be careful to do name lookup in the scope of
S<T>, rather than in the current class. */ S<T>, rather than in the current class. */
if (DECL_REAL_CONTEXT (fn) if (DECL_CLASS_SCOPE_P (fn))
&& TREE_CODE (DECL_REAL_CONTEXT (fn)) != NAMESPACE_DECL)
pushclass (DECL_REAL_CONTEXT (fn), 2); pushclass (DECL_REAL_CONTEXT (fn), 2);
arg = tsubst_expr (arg, DECL_TI_ARGS (fn), NULL_TREE); arg = tsubst_expr (arg, DECL_TI_ARGS (fn), NULL_TREE);
if (DECL_REAL_CONTEXT (fn) if (DECL_CLASS_SCOPE_P (fn))
&& TREE_CODE (DECL_CONTEXT (fn)) != NAMESPACE_DECL)
popclass (0); popclass (0);
} }
converted_args = expr_tree_cons converted_args = expr_tree_cons
...@@ -3926,10 +3924,10 @@ compare_ics (ics1, ics2) ...@@ -3926,10 +3924,10 @@ compare_ics (ics1, ics2)
return -1; return -1;
} }
else if (TREE_CODE (to2) == VOID_TYPE && IS_AGGR_TYPE (to1) else if (TREE_CODE (to2) == VOID_TYPE && IS_AGGR_TYPE (to1)
&& get_base_distance (to1, from1, 0, 0) != -1) && DERIVED_FROM_P (to1, from1))
return 1; return 1;
else if (TREE_CODE (to1) == VOID_TYPE && IS_AGGR_TYPE (to2) else if (TREE_CODE (to1) == VOID_TYPE && IS_AGGR_TYPE (to2)
&& get_base_distance (to2, from2, 0, 0) != -1) && DERIVED_FROM_P (to2, from2))
return -1; return -1;
if (! (IS_AGGR_TYPE (to1) && IS_AGGR_TYPE (to2))) if (! (IS_AGGR_TYPE (to1) && IS_AGGR_TYPE (to2)))
......
...@@ -4191,8 +4191,7 @@ finish_struct_1 (t, warn_anon) ...@@ -4191,8 +4191,7 @@ finish_struct_1 (t, warn_anon)
{ {
/* Be smarter about nested classes here. If a type is nested, /* Be smarter about nested classes here. If a type is nested,
only output it if we would output the enclosing type. */ only output it if we would output the enclosing type. */
if (DECL_CONTEXT (TYPE_MAIN_DECL (t)) if (DECL_CLASS_SCOPE_P (TYPE_MAIN_DECL (t)))
&& TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (TYPE_MAIN_DECL (t)))) == 't')
DECL_IGNORED_P (TYPE_MAIN_DECL (t)) = TREE_ASM_WRITTEN (TYPE_MAIN_DECL (t)); DECL_IGNORED_P (TYPE_MAIN_DECL (t)) = TREE_ASM_WRITTEN (TYPE_MAIN_DECL (t));
} }
#endif #endif
......
...@@ -1106,12 +1106,12 @@ struct lang_decl ...@@ -1106,12 +1106,12 @@ struct lang_decl
? DECL_CLASS_CONTEXT (NODE) : DECL_CONTEXT (NODE)) ? DECL_CLASS_CONTEXT (NODE) : DECL_CONTEXT (NODE))
/* 1 iff NODE has namespace scope, including the global namespace. */ /* 1 iff NODE has namespace scope, including the global namespace. */
#define DECL_NAMESPACE_SCOPE(NODE) \ #define DECL_NAMESPACE_SCOPE_P(NODE) \
(DECL_CONTEXT (NODE) == NULL_TREE \ (DECL_CONTEXT (NODE) == NULL_TREE \
|| TREE_CODE (DECL_CONTEXT (NODE)) == NAMESPACE_DECL) || TREE_CODE (DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
/* 1 iff NODE is a class member. */ /* 1 iff NODE is a class member. */
#define DECL_CLASS_SCOPE(NODE) \ #define DECL_CLASS_SCOPE_P(NODE) \
(DECL_CONTEXT (NODE) \ (DECL_CONTEXT (NODE) \
&& TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (NODE))) == 't') && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (NODE))) == 't')
......
...@@ -3257,8 +3257,7 @@ pushdecl (x) ...@@ -3257,8 +3257,7 @@ pushdecl (x)
name = TREE_OPERAND (name, 0); name = TREE_OPERAND (name, 0);
/* Namespace-scoped variables are not found in the current level. */ /* Namespace-scoped variables are not found in the current level. */
if (TREE_CODE (x) == VAR_DECL if (TREE_CODE (x) == VAR_DECL && DECL_NAMESPACE_SCOPE_P (x))
&& TREE_CODE (DECL_CONTEXT (x)) == NAMESPACE_DECL)
t = namespace_binding (name, DECL_CONTEXT (x)); t = namespace_binding (name, DECL_CONTEXT (x));
else else
t = lookup_name_current_level (name); t = lookup_name_current_level (name);
...@@ -3367,8 +3366,7 @@ pushdecl (x) ...@@ -3367,8 +3366,7 @@ pushdecl (x)
if (t != x || DECL_LANGUAGE (x) == lang_c) if (t != x || DECL_LANGUAGE (x) == lang_c)
return t; return t;
} }
else if (DECL_FUNCTION_TEMPLATE_P (x) && DECL_CONTEXT (x) else if (DECL_FUNCTION_TEMPLATE_P (x) && DECL_NAMESPACE_SCOPE_P (x))
&& TREE_CODE (DECL_CONTEXT (x)) == NAMESPACE_DECL)
return push_overloaded_decl (x, 0); return push_overloaded_decl (x, 0);
/* If declaring a type as a typedef, copy the type (unless we're /* If declaring a type as a typedef, copy the type (unless we're
...@@ -3995,7 +3993,7 @@ redeclaration_error_message (newdecl, olddecl) ...@@ -3995,7 +3993,7 @@ redeclaration_error_message (newdecl, olddecl)
/* If both functions come from different namespaces, this is not /* If both functions come from different namespaces, this is not
a redeclaration - this is a conflict with a used function. */ a redeclaration - this is a conflict with a used function. */
if (TREE_CODE (DECL_CONTEXT (olddecl)) == NAMESPACE_DECL if (DECL_NAMESPACE_SCOPE_P (olddecl)
&& DECL_CONTEXT (olddecl) != DECL_CONTEXT (newdecl)) && DECL_CONTEXT (olddecl) != DECL_CONTEXT (newdecl))
return "`%D' conflicts with used function"; return "`%D' conflicts with used function";
...@@ -6232,10 +6230,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes) ...@@ -6232,10 +6230,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
comes from another scope, e.g. a static member variable. comes from another scope, e.g. a static member variable.
TEM may equal DECL or it may be a previous decl of the same name. */ TEM may equal DECL or it may be a previous decl of the same name. */
if ((TREE_CODE (decl) != PARM_DECL && DECL_CONTEXT (decl) != NULL_TREE if ((TREE_CODE (decl) != PARM_DECL && DECL_CONTEXT (decl) != NULL_TREE)
/* Definitions of namespace members outside their namespace are
possible. */
&& TREE_CODE (DECL_CONTEXT (decl)) != NAMESPACE_DECL)
|| (TREE_CODE (decl) == TEMPLATE_DECL && !namespace_bindings_p ()) || (TREE_CODE (decl) == TEMPLATE_DECL && !namespace_bindings_p ())
|| TREE_CODE (type) == LANG_TYPE || TREE_CODE (type) == LANG_TYPE
/* The declaration of template specializations does not affect /* The declaration of template specializations does not affect
...@@ -6841,8 +6836,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags) ...@@ -6841,8 +6836,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
/* Let debugger know it should output info for this type. */ /* Let debugger know it should output info for this type. */
note_debug_info_needed (ttype); note_debug_info_needed (ttype);
if (TREE_STATIC (decl) && DECL_CONTEXT (decl) if (TREE_STATIC (decl) && DECL_CLASS_SCOPE_P (decl))
&& TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (decl))) == 't')
note_debug_info_needed (DECL_CONTEXT (decl)); note_debug_info_needed (DECL_CONTEXT (decl));
if ((DECL_EXTERNAL (decl) || TREE_STATIC (decl)) if ((DECL_EXTERNAL (decl) || TREE_STATIC (decl))
...@@ -11636,8 +11630,7 @@ start_function (declspecs, declarator, attrs, pre_parsed_p) ...@@ -11636,8 +11630,7 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
if (! DECL_ARGUMENTS (decl1) if (! DECL_ARGUMENTS (decl1)
&& !DECL_STATIC_FUNCTION_P (decl1) && !DECL_STATIC_FUNCTION_P (decl1)
&& DECL_CONTEXT (decl1) && DECL_CLASS_SCOPE_P (decl1)
&& TREE_CODE (DECL_CONTEXT (decl1)) != NAMESPACE_DECL
&& TYPE_IDENTIFIER (DECL_CONTEXT (decl1)) && TYPE_IDENTIFIER (DECL_CONTEXT (decl1))
&& IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (DECL_CONTEXT (decl1)))) && IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (DECL_CONTEXT (decl1))))
{ {
......
...@@ -658,9 +658,7 @@ dump_simple_decl (t, type, v) ...@@ -658,9 +658,7 @@ dump_simple_decl (t, type, v)
OB_PUTC (' '); OB_PUTC (' ');
dump_readonly_or_volatile (t, after); dump_readonly_or_volatile (t, after);
} }
/* DECL_CLASS_CONTEXT isn't being set in some cases. Hmm... */ if (DECL_CLASS_SCOPE_P (t))
if (DECL_CONTEXT (t)
&& TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (t))) == 't')
{ {
dump_type (DECL_CONTEXT (t), 0); dump_type (DECL_CONTEXT (t), 0);
OB_PUTC2 (':', ':'); OB_PUTC2 (':', ':');
...@@ -1748,8 +1746,7 @@ lang_decl_name (decl, v) ...@@ -1748,8 +1746,7 @@ lang_decl_name (decl, v)
OB_INIT (); OB_INIT ();
if (v == 1 && DECL_CONTEXT (decl) if (v == 1 && DECL_CLASS_SCOPE_P (decl))
&& TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (decl))) == 't')
{ {
tree cname; tree cname;
if (TREE_CODE (decl) == FUNCTION_DECL) if (TREE_CODE (decl) == FUNCTION_DECL)
......
...@@ -3467,8 +3467,7 @@ tsubst_friend_function (decl, args) ...@@ -3467,8 +3467,7 @@ tsubst_friend_function (decl, args)
if (TREE_CODE (decl) == TEMPLATE_DECL) if (TREE_CODE (decl) == TEMPLATE_DECL)
DECL_USE_TEMPLATE (DECL_TEMPLATE_RESULT (new_friend)) = 0; DECL_USE_TEMPLATE (DECL_TEMPLATE_RESULT (new_friend)) = 0;
if (!DECL_CONTEXT (new_friend) if (DECL_NAMESPACE_SCOPE_P (new_friend))
|| TREE_CODE (DECL_CONTEXT (new_friend)) == NAMESPACE_DECL)
{ {
if (TREE_CODE (new_friend) == TEMPLATE_DECL) if (TREE_CODE (new_friend) == TEMPLATE_DECL)
/* This declaration is a `primary' template. */ /* This declaration is a `primary' template. */
...@@ -4395,8 +4394,7 @@ tsubst (t, args, in_decl) ...@@ -4395,8 +4394,7 @@ tsubst (t, args, in_decl)
tree tmpl = NULL_TREE; tree tmpl = NULL_TREE;
int member; int member;
if (DECL_CONTEXT (t) != NULL_TREE if (DECL_CLASS_SCOPE_P (t))
&& TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (t))) == 't')
{ {
if (DECL_NAME (t) == constructor_name (DECL_CONTEXT (t))) if (DECL_NAME (t) == constructor_name (DECL_CONTEXT (t)))
member = 2; member = 2;
......
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