c++: Remove redundant calls to type_dependent_expression_p
authorPatrick Palka <ppalka@redhat.com>
Wed, 25 Mar 2020 03:58:23 +0000 (23:58 -0400)
committerPatrick Palka <ppalka@redhat.com>
Fri, 27 Mar 2020 00:44:49 +0000 (20:44 -0400)
This simplifies conditions that test both value_dependent_expression_p and
type_dependent_expression_p, since the former predicate now subsumes the latter.

gcc/cp/ChangeLog:

* decl.c (compute_array_index_type_loc): Remove redundant
type_dependent_expression_p check that is subsumed by
value_dependent_expression_p.
* decl2.c (is_late_template_attribute): Likewise.
* pt.c (uses_template_parms): Likewise.
(dependent_template_arg_p): Likewise.

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/cp/decl2.c
gcc/cp/pt.c

index 7d1161fd1c115bbe7c99b6334d66218d7fdb6d74..da556a4914eff63376f454c21bb3723bb74d81e2 100644 (file)
@@ -1,3 +1,12 @@
+2020-03-27  Patrick Palka  <ppalka@redhat.com>
+
+       * decl.c (compute_array_index_type_loc): Remove redundant
+       type_dependent_expression_p check that is subsumed by
+       value_dependent_expression_p.
+       * decl2.c (is_late_template_attribute): Likewise.
+       * pt.c (uses_template_parms): Likewise.
+       (dependent_template_arg_p): Likewise.
+
 2020-03-26  Marek Polacek  <polacek@redhat.com>
 
        DR 1710
index 319b7ee5c1c4766984086efc9f449da774b62df6..69a238997b467f9236878be1b0460637740626a0 100644 (file)
@@ -10338,8 +10338,7 @@ compute_array_index_type_loc (location_t name_loc, tree name, tree size,
   /* We can only call value_dependent_expression_p on integral constant
      expressions; treat non-constant expressions as dependent, too.  */
   if (processing_template_decl
-      && (type_dependent_expression_p (size)
-         || !TREE_CONSTANT (size) || value_dependent_expression_p (size)))
+      && (!TREE_CONSTANT (size) || value_dependent_expression_p (size)))
     {
       /* We cannot do any checking for a SIZE that isn't known to be
         constant. Just build the index type and mark that it requires
index 2efb2e54f37179b74b502f854038e273a61f74a9..6cf72b432e2730fb1fc7d1cab46ce6b1d1ad76c7 100644 (file)
@@ -1191,8 +1191,7 @@ is_late_template_attribute (tree attr, tree decl)
          && identifier_p (t))
        continue;
 
-      if (value_dependent_expression_p (t)
-         || type_dependent_expression_p (t))
+      if (value_dependent_expression_p (t))
        return true;
     }
 
index 3c96eeca1912399f32a2cd3d6178c6f69e9a7d6b..7ea8ce4cbc351033fa3cdd29d9922cbccc011fd9 100644 (file)
@@ -10525,8 +10525,7 @@ uses_template_parms (tree t)
   else if (t == error_mark_node)
     dependent_p = false;
   else
-    dependent_p = (type_dependent_expression_p (t)
-                  || value_dependent_expression_p (t));
+    dependent_p = value_dependent_expression_p (t);
 
   processing_template_decl = saved_processing_template_decl;
 
@@ -27016,8 +27015,7 @@ dependent_template_arg_p (tree arg)
   else if (TYPE_P (arg))
     return dependent_type_p (arg);
   else
-    return (type_dependent_expression_p (arg)
-           || value_dependent_expression_p (arg));
+    return value_dependent_expression_p (arg);
 }
 
 /* Returns true if ARGS (a collection of template arguments) contains