aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@yorick.cygnus.com>1998-05-12 21:42:34 +0000
committerJason Merrill <jason@gcc.gnu.org>1998-05-12 17:42:34 -0400
commit6eb3bb273d41fc53006e8c0c042433d41bdcb294 (patch)
tree92a30e7ea61540479bbab87c4470f8b7d7a37d52 /gcc
parentb706d7f20d438d0cda4790a798d98d5cb74290f9 (diff)
downloadgcc-6eb3bb273d41fc53006e8c0c042433d41bdcb294.zip
gcc-6eb3bb273d41fc53006e8c0c042433d41bdcb294.tar.gz
gcc-6eb3bb273d41fc53006e8c0c042433d41bdcb294.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog22
-rw-r--r--gcc/cp/call.c10
-rw-r--r--gcc/cp/class.c3
-rw-r--r--gcc/cp/cp-tree.h4
-rw-r--r--gcc/cp/decl.c19
-rw-r--r--gcc/cp/error.c7
-rw-r--r--gcc/cp/pt.c6
7 files changed, 31 insertions, 40 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index b58f01e..a2742a5 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,15 @@
+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>
* cp-tree.h (CANONICAL_TYPE_VARIANT): New macro.
@@ -11,12 +23,8 @@ Mon May 11 11:38:07 1998 Mark Mitchell <mmitchell@usa.net>
* 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.
-Mon May 11 07:16:30 1998 Mark Mitchell <mmitchell@usa.net>
-
* call.c (add_template_candidate): Adjust for changes to
fn_type_unification.
(add_template_candidate_real): Likewise.
@@ -68,8 +76,6 @@ Mon May 11 07:16:30 1998 Mark Mitchell <mmitchell@usa.net>
* parse.h: 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.
(finish_id_expr): Likewise.
(begin_new_placement): Likewise.
@@ -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>
- * cp-tree.h (DECL_NAMESPACE_SCOPE): New macro.
- (DECL_CLASS_SCOPE): Likewise.
+ * cp-tree.h (DECL_NAMESPACE_SCOPE_P): New macro.
+ (DECL_CLASS_SCOPE_P): Likewise.
Sun May 10 22:48:22 1998 H.J. Lu (hjl@gnu.org)
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 5eafd87..fa02408 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -3294,14 +3294,12 @@ build_over_call (cand, args, flags)
we must be careful to do name lookup in the scope of
S<T>, rather than in the current class. */
- if (DECL_REAL_CONTEXT (fn)
- && TREE_CODE (DECL_REAL_CONTEXT (fn)) != NAMESPACE_DECL)
+ if (DECL_CLASS_SCOPE_P (fn))
pushclass (DECL_REAL_CONTEXT (fn), 2);
arg = tsubst_expr (arg, DECL_TI_ARGS (fn), NULL_TREE);
- if (DECL_REAL_CONTEXT (fn)
- && TREE_CODE (DECL_CONTEXT (fn)) != NAMESPACE_DECL)
+ if (DECL_CLASS_SCOPE_P (fn))
popclass (0);
}
converted_args = expr_tree_cons
@@ -3926,10 +3924,10 @@ compare_ics (ics1, ics2)
return -1;
}
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;
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;
if (! (IS_AGGR_TYPE (to1) && IS_AGGR_TYPE (to2)))
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 17cfe2b..a07563f 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -4191,8 +4191,7 @@ finish_struct_1 (t, warn_anon)
{
/* Be smarter about nested classes here. If a type is nested,
only output it if we would output the enclosing type. */
- if (DECL_CONTEXT (TYPE_MAIN_DECL (t))
- && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (TYPE_MAIN_DECL (t)))) == 't')
+ if (DECL_CLASS_SCOPE_P (TYPE_MAIN_DECL (t)))
DECL_IGNORED_P (TYPE_MAIN_DECL (t)) = TREE_ASM_WRITTEN (TYPE_MAIN_DECL (t));
}
#endif
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index d02c7e7..3461bdb 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -1106,12 +1106,12 @@ struct lang_decl
? DECL_CLASS_CONTEXT (NODE) : DECL_CONTEXT (NODE))
/* 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 \
|| TREE_CODE (DECL_CONTEXT (NODE)) == NAMESPACE_DECL)
/* 1 iff NODE is a class member. */
-#define DECL_CLASS_SCOPE(NODE) \
+#define DECL_CLASS_SCOPE_P(NODE) \
(DECL_CONTEXT (NODE) \
&& TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (NODE))) == 't')
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index d0afbc2..4650bf4 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -3257,8 +3257,7 @@ pushdecl (x)
name = TREE_OPERAND (name, 0);
/* Namespace-scoped variables are not found in the current level. */
- if (TREE_CODE (x) == VAR_DECL
- && TREE_CODE (DECL_CONTEXT (x)) == NAMESPACE_DECL)
+ if (TREE_CODE (x) == VAR_DECL && DECL_NAMESPACE_SCOPE_P (x))
t = namespace_binding (name, DECL_CONTEXT (x));
else
t = lookup_name_current_level (name);
@@ -3367,8 +3366,7 @@ pushdecl (x)
if (t != x || DECL_LANGUAGE (x) == lang_c)
return t;
}
- else if (DECL_FUNCTION_TEMPLATE_P (x) && DECL_CONTEXT (x)
- && TREE_CODE (DECL_CONTEXT (x)) == NAMESPACE_DECL)
+ else if (DECL_FUNCTION_TEMPLATE_P (x) && DECL_NAMESPACE_SCOPE_P (x))
return push_overloaded_decl (x, 0);
/* If declaring a type as a typedef, copy the type (unless we're
@@ -3995,7 +3993,7 @@ redeclaration_error_message (newdecl, olddecl)
/* If both functions come from different namespaces, this is not
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))
return "`%D' conflicts with used function";
@@ -6232,10 +6230,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
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. */
- 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)
+ if ((TREE_CODE (decl) != PARM_DECL && DECL_CONTEXT (decl) != NULL_TREE)
|| (TREE_CODE (decl) == TEMPLATE_DECL && !namespace_bindings_p ())
|| TREE_CODE (type) == LANG_TYPE
/* The declaration of template specializations does not affect
@@ -6841,8 +6836,7 @@ cp_finish_decl (decl, init, asmspec_tree, need_pop, flags)
/* Let debugger know it should output info for this type. */
note_debug_info_needed (ttype);
- if (TREE_STATIC (decl) && DECL_CONTEXT (decl)
- && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (decl))) == 't')
+ if (TREE_STATIC (decl) && DECL_CLASS_SCOPE_P (decl))
note_debug_info_needed (DECL_CONTEXT (decl));
if ((DECL_EXTERNAL (decl) || TREE_STATIC (decl))
@@ -11636,8 +11630,7 @@ start_function (declspecs, declarator, attrs, pre_parsed_p)
if (! DECL_ARGUMENTS (decl1)
&& !DECL_STATIC_FUNCTION_P (decl1)
- && DECL_CONTEXT (decl1)
- && TREE_CODE (DECL_CONTEXT (decl1)) != NAMESPACE_DECL
+ && DECL_CLASS_SCOPE_P (decl1)
&& TYPE_IDENTIFIER (DECL_CONTEXT (decl1))
&& IDENTIFIER_TEMPLATE (TYPE_IDENTIFIER (DECL_CONTEXT (decl1))))
{
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index 1f068da..6173921 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -658,9 +658,7 @@ dump_simple_decl (t, type, v)
OB_PUTC (' ');
dump_readonly_or_volatile (t, after);
}
- /* DECL_CLASS_CONTEXT isn't being set in some cases. Hmm... */
- if (DECL_CONTEXT (t)
- && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (t))) == 't')
+ if (DECL_CLASS_SCOPE_P (t))
{
dump_type (DECL_CONTEXT (t), 0);
OB_PUTC2 (':', ':');
@@ -1748,8 +1746,7 @@ lang_decl_name (decl, v)
OB_INIT ();
- if (v == 1 && DECL_CONTEXT (decl)
- && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (decl))) == 't')
+ if (v == 1 && DECL_CLASS_SCOPE_P (decl))
{
tree cname;
if (TREE_CODE (decl) == FUNCTION_DECL)
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index d6764b0..5b860ab 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -3467,8 +3467,7 @@ tsubst_friend_function (decl, args)
if (TREE_CODE (decl) == TEMPLATE_DECL)
DECL_USE_TEMPLATE (DECL_TEMPLATE_RESULT (new_friend)) = 0;
- if (!DECL_CONTEXT (new_friend)
- || TREE_CODE (DECL_CONTEXT (new_friend)) == NAMESPACE_DECL)
+ if (DECL_NAMESPACE_SCOPE_P (new_friend))
{
if (TREE_CODE (new_friend) == TEMPLATE_DECL)
/* This declaration is a `primary' template. */
@@ -4395,8 +4394,7 @@ tsubst (t, args, in_decl)
tree tmpl = NULL_TREE;
int member;
- if (DECL_CONTEXT (t) != NULL_TREE
- && TREE_CODE_CLASS (TREE_CODE (DECL_CONTEXT (t))) == 't')
+ if (DECL_CLASS_SCOPE_P (t))
{
if (DECL_NAME (t) == constructor_name (DECL_CONTEXT (t)))
member = 2;