c++: Small pt.c cleanups
authorNathan Sidwell <nathan@acm.org>
Tue, 3 Nov 2020 18:05:04 +0000 (10:05 -0800)
committerNathan Sidwell <nathan@acm.org>
Tue, 3 Nov 2020 18:07:21 +0000 (10:07 -0800)
Now I know about VAR_OR_FUNCTION_DECL_P I found a place to use it.
Also positively checking for a function_decl is clearer than
negatively checking for things that are not.

gcc/cp/
* pt.c (primary_template_specialization_p): Use
VAR_OR_FUNCTION_DECL_P.
(tsubst_template_decl): Check for FUNCTION_DECL, not !TYPE && !VAR
for registering a specialization.

gcc/cp/pt.c

index f1c8c09..388423b 100644 (file)
@@ -3634,7 +3634,7 @@ primary_template_specialization_p (const_tree t)
   if (!t)
     return false;
 
-  if (TREE_CODE (t) == FUNCTION_DECL || VAR_P (t))
+  if (VAR_OR_FUNCTION_DECL_P (t))
     return (DECL_LANG_SPECIFIC (t)
            && DECL_USE_TEMPLATE (t)
            && DECL_TEMPLATE_INFO (t)
@@ -14220,8 +14220,7 @@ tsubst_template_decl (tree t, tree args, tsubst_flags_t complain,
   if (PRIMARY_TEMPLATE_P (t))
     DECL_PRIMARY_TEMPLATE (r) = r;
 
-  if (TREE_CODE (decl) != TYPE_DECL && !VAR_P (decl)
-      && !lambda_fntype)
+  if (TREE_CODE (decl) == FUNCTION_DECL && !lambda_fntype)
     /* Record this non-type partial instantiation.  */
     register_specialization (r, t,
                             DECL_TI_ARGS (DECL_TEMPLATE_RESULT (r)),