* friend.c (do_friend): Pull the identifier out of declarator.
Use cp_error and friends.
* decl2.c (qualified_lookup_using_namespace): Fix call to
purpose_member.
* decl.c (lookup_name_real): Don't call complete_type on a namespace.
(grokvardecl): Use DECL_CLASS_SCOPE_P.
(xref_basetypes): Fix call to GNU_xref_hier.
* cvt.c (convert_pointer_to_real): Check for error_mark_node sooner.
* class.c (warn_hidden): Fix for OVERLOAD.
From grahams@rcp.co.uk:
* cp-tree.h (DEFARG_NODE_CHECK): New macro.
(DEFARG_LENGTH, DEFARG_POINTER): Use it.
From-SVN: r21068
+1998-07-12 Jason Merrill <jason@yorick.cygnus.com>
+
+ * friend.c (do_friend): Pull the identifier out of declarator.
+ Use cp_error and friends.
+ * decl2.c (qualified_lookup_using_namespace): Fix call to
+ purpose_member.
+ * decl.c (lookup_name_real): Don't call complete_type on a namespace.
+ (grokvardecl): Use DECL_CLASS_SCOPE_P.
+ (xref_basetypes): Fix call to GNU_xref_hier.
+ * cvt.c (convert_pointer_to_real): Check for error_mark_node sooner.
+ * class.c (warn_hidden): Fix for OVERLOAD.
+ From grahams@rcp.co.uk:
+ * cp-tree.h (DEFARG_NODE_CHECK): New macro.
+ (DEFARG_LENGTH, DEFARG_POINTER): Use it.
+
Sun Jul 12 01:20:57 1998 Jeffrey A Law (law@cygnus.com)
* g++.1 (-traditional): Remove duplicated documentation.
/* We go through each separately named virtual function. */
for (i = 2; i < n_methods; ++i)
{
- tree fndecl = TREE_VEC_ELT (method_vec, i);
+ tree fns = TREE_VEC_ELT (method_vec, i);
+ tree fndecl;
tree base_fndecls = NULL_TREE;
tree binfos = BINFO_BASETYPES (TYPE_BINFO (t));
int i, n_baseclasses = binfos ? TREE_VEC_LENGTH (binfos) : 0;
+ fndecl = OVL_CURRENT (fns);
if (DECL_VINDEX (fndecl) == NULL_TREE)
continue;
base_fndecls);
}
- if (TREE_CHAIN (fndecl)
- && DECL_NAME (TREE_CHAIN (fndecl)) == DECL_NAME (fndecl))
- fndecl = TREE_CHAIN (fndecl);
- else
- fndecl = NULL_TREE;
+ fns = OVL_NEXT (fns);
+ if (fns)
+ fndecl = OVL_CURRENT (fns);
+ else
+ fndecl = NULL_TREE;
/* ...then mark up all the base functions with overriders, preferring
overriders to hiders. */
{
mark_overriders (fndecl, base_fndecls);
- if (TREE_CHAIN (fndecl)
- && DECL_NAME (TREE_CHAIN (fndecl)) == DECL_NAME (fndecl))
- fndecl = TREE_CHAIN (fndecl);
+ fns = OVL_NEXT (fns);
+ if (fns)
+ fndecl = OVL_CURRENT (fns);
else
fndecl = NULL_TREE;
}
{
tree context;
+ /* FIXME should handle namespaces like classes. */
+ if (TREE_CODE (type) == NAMESPACE_DECL)
+ return;
+
if (type == NULL_TREE || type == error_mark_node || ! IS_AGGR_TYPE (type)
|| TREE_CODE (type) == TEMPLATE_TYPE_PARM
|| TREE_CODE (type) == TEMPLATE_TEMPLATE_PARM)
#define UPT_PARMS(NODE) TREE_VALUE(TYPE_VALUES(NODE))
/* An un-parsed default argument looks like an identifier. */
-#define DEFARG_LENGTH(NODE) IDENTIFIER_LENGTH(NODE)
-#define DEFARG_POINTER(NODE) IDENTIFIER_POINTER(NODE)
+#define DEFARG_NODE_CHECK(t) TREE_CHECK(t, DEFAULT_ARG)
+#define DEFARG_LENGTH(NODE) (DEFARG_NODE_CHECK(NODE)->identifier.length)
+#define DEFARG_POINTER(NODE) (DEFARG_NODE_CHECK(NODE)->identifier.pointer)
#define builtin_function(NAME, TYPE, CODE, LIBNAME) \
define_function (NAME, TYPE, CODE, (void (*) PROTO((tree)))pushdecl, LIBNAME)
tree ptr_type;
tree type, rval;
+ if (intype == error_mark_node)
+ return error_mark_node;
+
if (TREE_CODE (binfo) == TREE_VEC)
type = BINFO_TYPE (binfo);
else if (IS_AGGR_TYPE (binfo))
if (ptr_type == TYPE_MAIN_VARIANT (intype))
return expr;
- if (intype == error_mark_node)
- return error_mark_node;
-
my_friendly_assert (!integer_zerop (expr), 191);
if (TREE_CODE (type) == RECORD_TYPE
if (TREE_CODE (type) == TYPENAME_TYPE && TREE_TYPE (type))
type = TREE_TYPE (type);
- type = complete_type (type);
+ if (TYPE_P (type))
+ type = complete_type (type);
if (TREE_CODE (type) == VOID_TYPE)
type = global_namespace;
/* In class context, static means one per class,
public access, and static storage. */
- if (DECL_FIELD_CONTEXT (decl) != NULL_TREE
- && IS_AGGR_TYPE (DECL_FIELD_CONTEXT (decl)))
+ if (DECL_CLASS_SCOPE_P (decl))
{
TREE_PUBLIC (decl) = 1;
TREE_STATIC (decl) = 1;
SET_CLASSTYPE_MARKED (ref);
BINFO_BASETYPES (TYPE_BINFO (ref)) = binfos = make_tree_vec (len);
+ if (TREE_CODE (name) == TYPE_DECL)
+ name = DECL_NAME (name);
+
for (i = 0; binfo; binfo = TREE_CHAIN (binfo))
{
/* The base of a derived struct is public by default. */
tree basetype = TREE_VALUE (binfo);
tree base_binfo;
- GNU_xref_hier (IDENTIFIER_POINTER (name),
- IDENTIFIER_POINTER (TREE_VALUE (binfo)),
- via_public, via_virtual, 0);
-
if (basetype && TREE_CODE (basetype) == TYPE_DECL)
basetype = TREE_TYPE (basetype);
if (!basetype
TREE_VALUE (binfo));
continue;
}
+
+ GNU_xref_hier (IDENTIFIER_POINTER (name),
+ IDENTIFIER_POINTER (TYPE_IDENTIFIER (basetype)),
+ via_public, via_virtual, 0);
+
#if 1
/* This code replaces similar code in layout_basetypes.
We put the complete_type first for implicit `typename'. */
- else if (TYPE_SIZE (complete_type (basetype)) == NULL_TREE
- && ! (current_template_parms && uses_template_parms (basetype)))
+ if (TYPE_SIZE (complete_type (basetype)) == NULL_TREE
+ && ! (current_template_parms && uses_template_parms (basetype)))
{
cp_error ("base class `%T' has incomplete type", basetype);
continue;
usings = TREE_CHAIN (usings))
/* If this was a real directive, and we have not seen it. */
if (!TREE_INDIRECT_USING (usings)
- && !purpose_member (seen, TREE_PURPOSE (usings)))
+ && !purpose_member (TREE_PURPOSE (usings), seen))
todo = temp_tree_cons (TREE_PURPOSE (usings), NULL_TREE, todo);
if (todo)
{
/* Every decl that gets here is a friend of something. */
DECL_FRIEND_P (decl) = 1;
+ if (TREE_CODE (declarator) == TEMPLATE_ID_EXPR)
+ {
+ declarator = TREE_OPERAND (declarator, 0);
+ if (TREE_CODE (declarator) == LOOKUP_EXPR)
+ declarator = TREE_OPERAND (declarator, 0);
+ if (is_overloaded_fn (declarator))
+ declarator = DECL_NAME (get_first_fn (declarator));
+ }
+
if (TREE_CODE (decl) == FUNCTION_DECL)
is_friend_template = processing_template_decl >
template_class_depth (current_class_type);
if (fields)
add_friends (current_class_type, declarator, ctype);
else
- error ("method `%s' is not a member of class `%s'",
- IDENTIFIER_POINTER (declarator),
- IDENTIFIER_POINTER (cname));
+ cp_error ("method `%D' is not a member of class `%T'",
+ declarator, ctype);
decl = void_type_node;
}
}
tree decl = lookup_name_nonclass (declarator);
if (decl == NULL_TREE)
{
- warning ("implicitly declaring `%s' as struct",
- IDENTIFIER_POINTER (declarator));
+ cp_warning ("implicitly declaring `%T' as struct", declarator);
decl = xref_tag (record_type_node, declarator, NULL_TREE, 1);
decl = TYPE_MAIN_DECL (decl);
}
but not if those functions are really class names. */
if (TREE_CODE (decl) == TREE_LIST && TREE_TYPE (TREE_PURPOSE (decl)))
{
- warning ("`friend %s' archaic, use `friend class %s' instead",
- IDENTIFIER_POINTER (declarator),
- IDENTIFIER_POINTER (declarator));
+ cp_warning ("`friend %T' archaic, use `friend class %T' instead",
+ declarator, declarator);
decl = TREE_TYPE (TREE_PURPOSE (decl));
}