+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.
* 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.
* 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.
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)
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
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)))
{
/* 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
? 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')
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);
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
/* 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";
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
/* 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))
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))))
{
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 (':', ':');
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)
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. */
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;