retrofit_lang_decl is idempotent. There's no need to check whether
LANG_DECL is already there, and indeed in several places we just call it.
This patch fixes up the cases I found where we unnecessarily checked.
nathan
--
Nathan Sidwell
2017-05-05 Nathan Sidwell <nat...@acm.org>
* class.c (alter_class): Use retrofit_lang_decl directly.
* decl.c (push_local_name, dupliate_decls): Likewise.
* semantics.c (omp_privatize_field): Likewise.
Index: class.c
===================================================================
--- class.c (revision 247636)
+++ class.c (working copy)
@@ -1305,8 +1305,7 @@ alter_access (tree t, tree fdecl, tree a
{
tree elem;
- if (!DECL_LANG_SPECIFIC (fdecl))
- retrofit_lang_decl (fdecl);
+ retrofit_lang_decl (fdecl);
gcc_assert (!DECL_DISCRIMINATOR_P (fdecl));
Index: decl.c
===================================================================
--- decl.c (revision 247638)
+++ decl.c (working copy)
@@ -961,8 +961,7 @@ push_local_name (tree decl)
t = (*local_names)[i];
if (DECL_NAME (t) == name)
{
- if (!DECL_LANG_SPECIFIC (decl))
- retrofit_lang_decl (decl);
+ retrofit_lang_decl (decl);
DECL_LANG_SPECIFIC (decl)->u.base.u2sel = 1;
if (DECL_DISCRIMINATOR_SET_P (t))
DECL_DISCRIMINATOR (decl) = DECL_DISCRIMINATOR (t) + 1;
@@ -1812,8 +1811,7 @@ duplicate_decls (tree newdecl, tree oldd
{
/* There is no explicit linkage-specification, so we use
the linkage from the previous declaration. */
- if (!DECL_LANG_SPECIFIC (newdecl))
- retrofit_lang_decl (newdecl);
+ retrofit_lang_decl (newdecl);
SET_DECL_LANGUAGE (newdecl, DECL_LANGUAGE (olddecl));
}
else
@@ -2124,9 +2122,7 @@ duplicate_decls (tree newdecl, tree oldd
&& CP_DECL_THREADPRIVATE_P (olddecl))
{
/* Allocate a LANG_SPECIFIC structure for NEWDECL, if needed. */
- if (!DECL_LANG_SPECIFIC (newdecl))
- retrofit_lang_decl (newdecl);
-
+ retrofit_lang_decl (newdecl);
CP_DECL_THREADPRIVATE_P (newdecl) = 1;
}
}
Index: semantics.c
===================================================================
--- semantics.c (revision 247636)
+++ semantics.c (working copy)
@@ -4478,8 +4478,7 @@ omp_privatize_field (tree t, bool shared
if (v == NULL_TREE)
{
v = create_temporary_var (TREE_TYPE (m));
- if (!DECL_LANG_SPECIFIC (v))
- retrofit_lang_decl (v);
+ retrofit_lang_decl (v);
DECL_OMP_PRIVATIZED_MEMBER (v) = 1;
SET_DECL_VALUE_EXPR (v, m);
DECL_HAS_VALUE_EXPR_P (v) = 1;