if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
- tree f1 = TREE_TYPE (newdecl);
- tree f2 = TREE_TYPE (olddecl);
- tree p1 = TYPE_ARG_TYPES (f1);
- tree p2 = TYPE_ARG_TYPES (f2);
- tree r2;
-
/* Specializations of different templates are different functions
even if they have the same type. */
tree t1 = (DECL_USE_TEMPLATE (newdecl)
&& DECL_EXTERN_C_P (olddecl) && !DECL_EXTERN_C_P (newdecl))
return 0;
+ tree f1 = TREE_TYPE (newdecl);
+ tree f2 = TREE_TYPE (olddecl);
if (TREE_CODE (f1) != TREE_CODE (f2))
return 0;
/* A declaration with deduced return type should use its pre-deduction
type for declaration matching. */
- r2 = fndecl_declared_return_type (olddecl);
+ tree r2 = fndecl_declared_return_type (olddecl);
+ tree r1 = fndecl_declared_return_type (newdecl);
+
+ tree p1 = TYPE_ARG_TYPES (f1);
+ tree p2 = TYPE_ARG_TYPES (f2);
- if (same_type_p (TREE_TYPE (f1), r2))
+ if (same_type_p (r1, r2))
{
if (!prototype_p (f2) && DECL_EXTERN_C_P (olddecl)
&& fndecl_built_in_p (olddecl))
|| (TREE_CODE (olddecl) == TEMPLATE_DECL
&& (TREE_CODE (DECL_TEMPLATE_RESULT (olddecl))
== FUNCTION_DECL))))
- {
- tree fn = olddecl;
-
- if (TREE_CODE (fn) == TEMPLATE_DECL)
- fn = DECL_TEMPLATE_RESULT (olddecl);
-
- new_redefines_gnu_inline = GNU_INLINE_P (fn) && DECL_INITIAL (fn);
- }
+ new_redefines_gnu_inline = GNU_INLINE_P (STRIP_TEMPLATE (olddecl));
if (!new_redefines_gnu_inline)
{
build_typename_type (tree context, tree name, tree fullname,
enum tag_types tag_type)
{
- tree t;
- tree d;
typename_info ti;
- tree *e;
- hashval_t hash;
if (typename_htab == NULL)
typename_htab = hash_table<typename_hasher>::create_ggc (61);
ti.class_p = (tag_type == class_type
|| tag_type == record_type
|| tag_type == union_type);
- hash = (htab_hash_pointer (ti.scope)
- ^ htab_hash_pointer (ti.name));
+ hashval_t hash = (htab_hash_pointer (ti.scope)
+ ^ htab_hash_pointer (ti.name));
/* See if we already have this type. */
- e = typename_htab->find_slot_with_hash (&ti, hash, INSERT);
+ tree *e = typename_htab->find_slot_with_hash (&ti, hash, INSERT);
+ tree t = *e;
if (*e)
t = *e;
else
TYPENAME_IS_CLASS_P (t) = ti.class_p;
/* Build the corresponding TYPE_DECL. */
- d = build_decl (input_location, TYPE_DECL, name, t);
- TYPE_NAME (TREE_TYPE (d)) = d;
- TYPE_STUB_DECL (TREE_TYPE (d)) = d;
- DECL_CONTEXT (d) = FROB_CONTEXT (context);
+ tree d = build_decl (input_location, TYPE_DECL, name, t);
+ TYPE_NAME (t) = d;
+ TYPE_STUB_DECL (t) = d;
+ DECL_CONTEXT (d) = ti.scope;
DECL_ARTIFICIAL (d) = 1;
/* Store it in the hash table. */
make_unbound_class_template (tree context, tree name, tree parm_list,
tsubst_flags_t complain)
{
- tree t;
- tree d;
-
if (TYPE_P (name))
name = TYPE_IDENTIFIER (name);
else if (DECL_P (name))
}
/* Build the UNBOUND_CLASS_TEMPLATE. */
- t = cxx_make_type (UNBOUND_CLASS_TEMPLATE);
+ tree t = cxx_make_type (UNBOUND_CLASS_TEMPLATE);
TYPE_CONTEXT (t) = FROB_CONTEXT (context);
TREE_TYPE (t) = NULL_TREE;
SET_TYPE_STRUCTURAL_EQUALITY (t);
/* Build the corresponding TEMPLATE_DECL. */
- d = build_decl (input_location, TEMPLATE_DECL, name, t);
- TYPE_NAME (TREE_TYPE (d)) = d;
- TYPE_STUB_DECL (TREE_TYPE (d)) = d;
- DECL_CONTEXT (d) = FROB_CONTEXT (context);
+ tree d = build_decl (input_location, TEMPLATE_DECL, name, t);
+ TYPE_NAME (t) = d;
+ TYPE_STUB_DECL (t) = d;
+ DECL_CONTEXT (d) = TYPE_CONTEXT (t);
DECL_ARTIFICIAL (d) = 1;
DECL_TEMPLATE_PARMS (d) = parm_list;
tree
begin_function_body (void)
{
- tree stmt;
-
if (! FUNCTION_NEEDS_BODY_BLOCK (current_function_decl))
return NULL_TREE;
operation of dwarfout.c. */
keep_next_level (true);
- stmt = begin_compound_stmt (BCS_FN_BODY);
+ tree stmt = begin_compound_stmt (BCS_FN_BODY);
if (processing_template_decl)
/* Do nothing now. */;
static void
dump_aggr_type (cxx_pretty_printer *pp, tree t, int flags)
{
- tree name;
const char *variety = class_key_or_enum_as_string (t);
int typdef = 0;
int tmplate = 0;
if (flags & TFF_CLASS_KEY_OR_ENUM)
pp_cxx_ws_string (pp, variety);
- name = TYPE_NAME (t);
+ tree decl = TYPE_NAME (t);
- if (name)
+ if (decl)
{
- typdef = (!DECL_ARTIFICIAL (name)
+ typdef = (!DECL_ARTIFICIAL (decl)
/* An alias specialization is not considered to be a
typedef. */
&& !alias_template_specialization_p (t, nt_opaque));
if ((typdef
&& ((flags & TFF_CHASE_TYPEDEF)
- || (!flag_pretty_templates && DECL_LANG_SPECIFIC (name)
- && DECL_TEMPLATE_INFO (name))))
- || DECL_SELF_REFERENCE_P (name))
+ || (!flag_pretty_templates && DECL_LANG_SPECIFIC (decl)
+ && DECL_TEMPLATE_INFO (decl))))
+ || DECL_SELF_REFERENCE_P (decl))
{
t = TYPE_MAIN_VARIANT (t);
- name = TYPE_NAME (t);
+ decl = TYPE_NAME (t);
typdef = 0;
}
|| PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t)));
if (! (flags & TFF_UNQUALIFIED_NAME))
- dump_scope (pp, CP_DECL_CONTEXT (name), flags | TFF_SCOPE);
+ dump_scope (pp, CP_DECL_CONTEXT (decl), flags | TFF_SCOPE);
flags &= ~TFF_UNQUALIFIED_NAME;
if (tmplate)
{
while (DECL_TEMPLATE_INFO (tpl))
tpl = DECL_TI_TEMPLATE (tpl);
- name = tpl;
+ decl = tpl;
}
- name = DECL_NAME (name);
}
if (LAMBDA_TYPE_P (t))
flags);
pp_greater (pp);
}
- else if (!name || IDENTIFIER_ANON_P (name))
+ else if (!decl || IDENTIFIER_ANON_P (DECL_NAME (decl)))
{
if (flags & TFF_CLASS_KEY_OR_ENUM)
pp_string (pp, M_("<unnamed>"));
pp_printf (pp, M_("<unnamed %s>"), variety);
}
else
- pp_cxx_tree_identifier (pp, name);
+ pp_cxx_tree_identifier (pp, DECL_NAME (decl));
if (tmplate)
dump_template_parms (pp, TYPE_TEMPLATE_INFO (t),