2012-10-01 Jason Merrill <jason@redhat.com>
+ * cp-tree.h (TYPE_FUNCTION_OR_TEMPLATE_DECL_CHECK): New.
+ (DECL_FRIEND_P, DECL_ANTICIPATED): Use it.
+ (TYPE_FUNCTION_OR_TEMPLATE_DECL_P): New.
+ * name-lookup.c (hidden_name_p): Use it.
+
* cp-tree.h (DECL_PRETTY_FUNCTION_P): Just look at the name.
* decl.c (cp_make_fname_decl): Adjust.
#define VAR_OR_FUNCTION_DECL_CHECK(NODE) \
TREE_CHECK2(NODE,VAR_DECL,FUNCTION_DECL)
+#define TYPE_FUNCTION_OR_TEMPLATE_DECL_CHECK(NODE) \
+ TREE_CHECK3(NODE,TYPE_DECL,TEMPLATE_DECL,FUNCTION_DECL)
+
+#define TYPE_FUNCTION_OR_TEMPLATE_DECL_P(NODE) \
+ (TREE_CODE (NODE) == TYPE_DECL || TREE_CODE (NODE) == TEMPLATE_DECL \
+ || TREE_CODE (NODE) == FUNCTION_DECL)
+
#define VAR_FUNCTION_OR_PARM_DECL_CHECK(NODE) \
TREE_CHECK3(NODE,VAR_DECL,FUNCTION_DECL,PARM_DECL)
unsigned initialized_in_class : 1; /* var or fn */
unsigned repo_available_p : 1; /* var or fn */
unsigned threadprivate_or_deleted_p : 1; /* var or fn */
- unsigned anticipated_p : 1; /* fn or type */
- unsigned friend_attr : 1; /* fn or type */
+ unsigned anticipated_p : 1; /* fn, type or template */
+ unsigned friend_attr : 1; /* fn, type or template */
unsigned template_conv_p : 1; /* var or template */
unsigned odr_used : 1; /* var or fn */
unsigned u2sel : 1;
/* Nonzero for DECL means that this decl is just a friend declaration,
and should not be added to the list of members for this class. */
-#define DECL_FRIEND_P(NODE) (DECL_LANG_SPECIFIC (NODE)->u.base.friend_attr)
+#define DECL_FRIEND_P(NODE) \
+ (DECL_LANG_SPECIFIC (TYPE_FUNCTION_OR_TEMPLATE_DECL_CHECK (NODE)) \
+ ->u.base.friend_attr)
/* A TREE_LIST of the types which have befriended this FUNCTION_DECL. */
#define DECL_BEFRIENDING_CLASSES(NODE) \
declared inside a class. In the latter case DECL_HIDDEN_FRIEND_P
will be set. */
#define DECL_ANTICIPATED(NODE) \
- (DECL_LANG_SPECIFIC (DECL_COMMON_CHECK (NODE))->u.base.anticipated_p)
+ (DECL_LANG_SPECIFIC (TYPE_FUNCTION_OR_TEMPLATE_DECL_CHECK (NODE)) \
+ ->u.base.anticipated_p)
/* Nonzero if NODE is a FUNCTION_DECL which was declared as a friend
within a class but has not been declared in the surrounding scope.