From f8c33fa11fd89adf205068a161f8dc5fec5dbdb6 Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Mon, 23 Oct 2017 13:04:58 -0400
Subject: [PATCH 04/24] FIXME: rename DECL_USAGE_EXPR to LOCATION_WRAPPER_EXPR

---
 gcc/builtins.c                                                      | 2 +-
 gcc/c-family/c-format.c                                             | 3 +--
 gcc/c-family/c-pretty-print.c                                       | 2 +-
 gcc/cp/constexpr.c                                                  | 6 +++---
 gcc/cp/error.c                                                      | 2 +-
 gcc/cp/expr.c                                                       | 2 +-
 gcc/cp/semantics.c                                                  | 2 +-
 gcc/cp/tree.c                                                       | 2 +-
 gcc/cp/typeck.c                                                     | 2 +-
 gcc/gimplify.c                                                      | 2 +-
 .../gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c    | 2 +-
 gcc/tree.c                                                          | 6 +++---
 gcc/tree.def                                                        | 5 +++--
 gcc/tree.h                                                          | 6 +++---
 14 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/gcc/builtins.c b/gcc/builtins.c
index 5398df4..deba1c3 100644
--- a/gcc/builtins.c
+++ b/gcc/builtins.c
@@ -9567,7 +9567,7 @@ fold_builtin_next_arg (tree exp, bool va_start_p)
 	 parameters.  */
       while (CONVERT_EXPR_P (arg)
 	     || TREE_CODE (arg) == INDIRECT_REF
-	     || TREE_CODE (arg) == DECL_USAGE_EXPR)
+	     || TREE_CODE (arg) == LOCATION_WRAPPER_EXPR)
 	arg = TREE_OPERAND (arg, 0);
       if (arg != last_parm)
 	{
diff --git a/gcc/c-family/c-format.c b/gcc/c-family/c-format.c
index ae07201..a2d0dd2 100644
--- a/gcc/c-family/c-format.c
+++ b/gcc/c-family/c-format.c
@@ -1536,8 +1536,7 @@ check_format_arg (void *ctx, tree format_tree,
 
   location_t fmt_param_loc = EXPR_LOC_OR_LOC (format_tree, input_location);
 
-  if (TREE_CODE (format_tree) == DECL_USAGE_EXPR)
-    format_tree = TREE_OPERAND (format_tree, 0);
+  STRIP_LOCATION_WRAPPER_EXPR (format_tree);
 
   if (VAR_P (format_tree))
     {
diff --git a/gcc/c-family/c-pretty-print.c b/gcc/c-family/c-pretty-print.c
index c4a7d2c..0d49f2f 100644
--- a/gcc/c-family/c-pretty-print.c
+++ b/gcc/c-family/c-pretty-print.c
@@ -2311,7 +2311,7 @@ c_pretty_printer::expression (tree e)
 
     case NON_LVALUE_EXPR:
     case SAVE_EXPR:
-    case DECL_USAGE_EXPR:
+    case LOCATION_WRAPPER_EXPR:
       expression (TREE_OPERAND (e, 0));
       break;
 
diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c
index 7551f17..066d73d 100644
--- a/gcc/cp/constexpr.c
+++ b/gcc/cp/constexpr.c
@@ -4423,7 +4423,7 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t,
 				       non_constant_p, overflow_p);
       break;
 
-    case DECL_USAGE_EXPR:
+    case LOCATION_WRAPPER_EXPR:
     case CONVERT_EXPR:
     case VIEW_CONVERT_EXPR:
     case NOP_EXPR:
@@ -4698,7 +4698,7 @@ cxx_eval_outermost_constant_expr (tree t, bool allow_non_constant,
   r = cxx_eval_constant_expression (&ctx, r,
 				    false, &non_constant_p, &overflow_p);
 
-  STRIP_DECL_USAGE_EXPR (r);
+  STRIP_LOCATION_WRAPPER_EXPR (r);
 
   verify_constant (r, allow_non_constant, &non_constant_p, &overflow_p);
 
@@ -5293,7 +5293,7 @@ potential_constant_expression_1 (tree t, bool want_rval, bool strict, bool now,
         }
       return true;
 
-    case DECL_USAGE_EXPR:
+    case LOCATION_WRAPPER_EXPR:
     case NOP_EXPR:
     case CONVERT_EXPR:
     case VIEW_CONVERT_EXPR:
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index e78f7d9..1cc6b9b 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -2424,7 +2424,7 @@ dump_expr (cxx_pretty_printer *pp, tree t, int flags)
       break;
 
     CASE_CONVERT:
-    case DECL_USAGE_EXPR:
+    case LOCATION_WRAPPER_EXPR:
     case IMPLICIT_CONV_EXPR:
     case VIEW_CONVERT_EXPR:
       {
diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c
index ce900a3..72f7b75 100644
--- a/gcc/cp/expr.c
+++ b/gcc/cp/expr.c
@@ -277,7 +277,7 @@ mark_exp_read (tree exp)
     case MODIFY_EXPR:
     case REALPART_EXPR:
     case IMAGPART_EXPR:
-    case DECL_USAGE_EXPR:
+    case LOCATION_WRAPPER_EXPR:
     CASE_CONVERT:
     case ADDR_EXPR:
     case INDIRECT_REF:
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 2737776..680ad0f 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2326,7 +2326,7 @@ finish_call_expr (tree fn, vec<tree, va_gc> **args, bool disallow_virtual,
 
   /* Strip away any wrapper to ensure we recognize the underlying fn,
      if any.  */
-  STRIP_DECL_USAGE_EXPR (fn);
+  STRIP_LOCATION_WRAPPER_EXPR (fn);
 
   orig_fn = fn;
 
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index c48a5be..fc68902 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -63,7 +63,7 @@ lvalue_kind (const_tree ref)
   if (REFERENCE_REF_P (ref))
     return lvalue_kind (TREE_OPERAND (ref, 0));
 
-  STRIP_DECL_USAGE_EXPR (ref);
+  STRIP_LOCATION_WRAPPER_EXPR (ref);
 
   if (TREE_TYPE (ref)
       && TREE_CODE (TREE_TYPE (ref)) == REFERENCE_TYPE)
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index 473ca18..60fc291 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -3599,7 +3599,7 @@ cp_build_function_call_vec (tree function, vec<tree, va_gc> **params,
       && TREE_TYPE (function) == TREE_TYPE (TREE_OPERAND (function, 0)))
     function = TREE_OPERAND (function, 0);
 
-  STRIP_DECL_USAGE_EXPR (function);
+  STRIP_LOCATION_WRAPPER_EXPR (function);
 
   if (TREE_CODE (function) == FUNCTION_DECL)
     {
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 109c498..e94566e 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -11254,7 +11254,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
       else if (ret != GS_UNHANDLED)
 	break;
 
-      if (TREE_CODE (*expr_p) == DECL_USAGE_EXPR)
+      if (TREE_CODE (*expr_p) == LOCATION_WRAPPER_EXPR)
 	*expr_p = TREE_OPERAND (*expr_p, 0);
 
       /* Make sure that all the cases set 'ret' appropriately.  */
diff --git a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c
index 50c69b8..9cb53d0 100644
--- a/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c
+++ b/gcc/testsuite/gcc.dg/plugin/diagnostic_plugin_test_tree_expression_range.c
@@ -57,7 +57,7 @@ cb_walk_tree_fn (tree * tp, int * walk_subtrees,
   if (TREE_CODE (fn) != ADDR_EXPR)
     return NULL_TREE;
   fn = TREE_OPERAND (fn, 0);
-  if (TREE_CODE (fn) == DECL_USAGE_EXPR)
+  if (TREE_CODE (fn) == LOCATION_WRAPPER_EXPR)
     fn = TREE_OPERAND (fn, 0);
   if (TREE_CODE (fn) != FUNCTION_DECL)
     return NULL_TREE;
diff --git a/gcc/tree.c b/gcc/tree.c
index c52e73f..be044d5 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -13747,7 +13747,7 @@ set_source_range (tree expr, source_range src_range)
   return adhoc;
 }
 
-/* Return EXPR, potentially wrapped with a DECL_USAGE_EXPR node
+/* Return EXPR, potentially wrapped with a LOCATION_WRAPPER_EXPR node
    at LOC, if !CAN_HAVE_LOCATION_P (expr).  */
 
 tree
@@ -13766,10 +13766,10 @@ maybe_wrap_with_location (tree expr, location_t loc)
 	      || EXCEPTIONAL_CLASS_P (expr));
 
 #if 1
-  return build1_loc (loc, DECL_USAGE_EXPR, TREE_TYPE (expr), expr);
+  return build1_loc (loc, LOCATION_WRAPPER_EXPR, TREE_TYPE (expr), expr);
 #else
   /* Simulate the GGC-effect of building the node... */
-  (void)build1_loc (loc, DECL_USAGE_EXPR, TREE_TYPE (expr), expr);
+  (void)build1_loc (loc, LOCATION_WRAPPER_EXPR, TREE_TYPE (expr), expr);
   /* But don't actually do it.  */
   return expr;
 #endif
diff --git a/gcc/tree.def b/gcc/tree.def
index bb44cc6..4835952 100644
--- a/gcc/tree.def
+++ b/gcc/tree.def
@@ -827,8 +827,9 @@ DEFTREECODE (FIXED_CONVERT_EXPR, "fixed_convert_expr", tcc_unary, 1)
 /* Represents a conversion expected to require no code to be generated.  */
 DEFTREECODE (NOP_EXPR, "nop_expr", tcc_unary, 1)
 
-/* Represents the usage of a decl within an expression.  */
-DEFTREECODE (DECL_USAGE_EXPR, "decl_usage_expr", tcc_unary, 1)
+/* A wrapper for decorating a decl, constant or "exceptional" node with
+   a location_t.  */
+DEFTREECODE (LOCATION_WRAPPER_EXPR, "location_wrapper_expr", tcc_unary, 1)
 
 /* Value is same as argument, but guaranteed not an lvalue.  */
 DEFTREECODE (NON_LVALUE_EXPR, "non_lvalue_expr", tcc_unary, 1)
diff --git a/gcc/tree.h b/gcc/tree.h
index 5c24c07..46bd936 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -483,11 +483,11 @@ extern void omp_clause_range_check_failed (const_tree, const char *, int,
 #define STRIP_USELESS_TYPE_CONVERSION(EXP) \
   (EXP) = tree_ssa_strip_useless_type_conversions (EXP)
 
-/* Remove any DECL_USAGE_EXPR.  */
+/* Remove any LOCATION_WRAPPER_EXPR.  */
 
-#define STRIP_DECL_USAGE_EXPR(EXP) \
+#define STRIP_LOCATION_WRAPPER_EXPR(EXP) \
   do { \
-    if (TREE_CODE (EXP) == DECL_USAGE_EXPR)  \
+    if (TREE_CODE (EXP) == LOCATION_WRAPPER_EXPR)  \
       (EXP) = TREE_OPERAND ((EXP), 0);	     \
   } while (0)
 
-- 
1.8.5.3

