* class.c (finish_struct): Use OVL_P.
(get_vfield_name): Measure constructor_name length.
* cp-tree.h (SET_CLASS_TYPE_P): Add RECORD_OR_UNION_CHECK.
(NON_UNION_CLASS_TYPE_P): Check RECORD_TYPE up front.
* cxx-pretty-print.c (is_destructor_name): Delete.
(pp_cxx_unqualified_id): Remove bogus destructor name checking.
* decl.c (grokfndecl): Move cheap checks first when looking for
implicit extern cness.
From-SVN: r249788
2017-06-29 Nathan Sidwell <nathan@acm.org>
+ * class.c (finish_struct): Use OVL_P.
+ (get_vfield_name): Measure constructor_name length.
+ * cp-tree.h (SET_CLASS_TYPE_P): Add RECORD_OR_UNION_CHECK.
+ (NON_UNION_CLASS_TYPE_P): Check RECORD_TYPE up front.
+ * cxx-pretty-print.c (is_destructor_name): Delete.
+ (pp_cxx_unqualified_id): Remove bogus destructor name checking.
+ * decl.c (grokfndecl): Move cheap checks first when looking for
+ implicit extern cness.
+
* parser.c (cp_parser_direct_declarator): Reorder if to avoid
indentation. Remove unnecessary assignment of constructor name.
if (TREE_CODE (x) == USING_DECL)
{
tree fn = strip_using_decl (x);
- if (is_overloaded_fn (fn))
+ if (OVL_P (fn))
for (lkp_iterator iter (fn); iter; ++iter)
add_method (t, *iter, true);
}
get_vfield_name (tree type)
{
tree binfo, base_binfo;
- char *buf;
for (binfo = TYPE_BINFO (type);
BINFO_N_BASE_BINFOS (binfo);
}
type = BINFO_TYPE (binfo);
- buf = (char *) alloca (sizeof (VFIELD_NAME_FORMAT)
- + TYPE_NAME_LENGTH (type) + 2);
- sprintf (buf, VFIELD_NAME_FORMAT,
- IDENTIFIER_POINTER (constructor_name (type)));
+ tree ctor_name = constructor_name (type);
+ char *buf = (char *) alloca (sizeof (VFIELD_NAME_FORMAT)
+ + IDENTIFIER_LENGTH (ctor_name) + 2);
+ sprintf (buf, VFIELD_NAME_FORMAT, IDENTIFIER_POINTER (ctor_name));
return get_identifier (buf);
}
/* Set CLASS_TYPE_P for T to VAL. T must be a class, struct, or
union type. */
#define SET_CLASS_TYPE_P(T, VAL) \
- (TYPE_LANG_FLAG_5 (T) = (VAL))
+ (TYPE_LANG_FLAG_5 (RECORD_OR_UNION_CHECK (T)) = (VAL))
/* Nonzero if T is a class type. Zero for template type parameters,
typename types, and so forth. */
/* Nonzero if T is a class type but not an union. */
#define NON_UNION_CLASS_TYPE_P(T) \
- (CLASS_TYPE_P (T) && TREE_CODE (T) != UNION_TYPE)
+ (TREE_CODE (T) == RECORD_TYPE && TYPE_LANG_FLAG_5 (T))
/* Keep these checks in ascending code order. */
#define RECORD_OR_UNION_CODE_P(T) \
/* Expressions. */
-static inline bool
-is_destructor_name (tree name)
-{
- return name == complete_dtor_identifier
- || name == base_dtor_identifier
- || name == deleting_dtor_identifier;
-}
-
/* conversion-function-id:
operator conversion-type-id
else if (IDENTIFIER_CONV_OP_P (t))
pp_cxx_conversion_function_id (pp, t);
else
- {
- if (is_destructor_name (t))
- {
- pp_complement (pp);
- /* FIXME: Why is this necessary? */
- if (TREE_TYPE (t))
- t = constructor_name (TREE_TYPE (t));
- }
- pp_cxx_tree_identifier (pp, t);
- }
+ pp_cxx_tree_identifier (pp, t);
break;
case TEMPLATE_ID_EXPR:
DECL_CONTEXT (decl) = FROB_CONTEXT (current_decl_namespace ());
/* `main' and builtins have implicit 'C' linkage. */
- if ((MAIN_NAME_P (declarator)
- || (IDENTIFIER_LENGTH (declarator) > 10
- && IDENTIFIER_POINTER (declarator)[0] == '_'
- && IDENTIFIER_POINTER (declarator)[1] == '_'
- && strncmp (IDENTIFIER_POINTER (declarator)+2, "builtin_", 8) == 0)
- || (targetcm.cxx_implicit_extern_c
- && targetcm.cxx_implicit_extern_c(IDENTIFIER_POINTER (declarator))))
+ if (ctype == NULL_TREE
+ && DECL_FILE_SCOPE_P (decl)
&& current_lang_name == lang_name_cplusplus
- && ctype == NULL_TREE
- && DECL_FILE_SCOPE_P (decl))
+ && (MAIN_NAME_P (declarator)
+ || (IDENTIFIER_LENGTH (declarator) > 10
+ && IDENTIFIER_POINTER (declarator)[0] == '_'
+ && IDENTIFIER_POINTER (declarator)[1] == '_'
+ && strncmp (IDENTIFIER_POINTER (declarator)+2,
+ "builtin_", 8) == 0)
+ || (targetcm.cxx_implicit_extern_c
+ && (targetcm.cxx_implicit_extern_c
+ (IDENTIFIER_POINTER (declarator))))))
SET_DECL_LANGUAGE (decl, lang_c);
/* Should probably propagate const out from type to decl I bet (mrs). */