We occasionally need to handle the NULL case when stripping trees,
so this patch introduces a variant of STRIP_ANY_LOCATION_WRAPPER to
do so.

gcc/ChangeLog:
        * tree.h (STRIP_ANY_LOCATION_WRAPPER_SAFE): New macro.
---
 gcc/tree.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gcc/tree.h b/gcc/tree.h
index 9a0bd60..98acc8b 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -492,6 +492,14 @@ extern void omp_clause_range_check_failed (const_tree, 
const char *, int,
       (EXP) = TREE_OPERAND ((EXP), 0); \
   } while (0)
 
+/* As STRIP_ANY_LOCATION_WRAPPER, but handle NULL_TREE.  */
+
+#define STRIP_ANY_LOCATION_WRAPPER_SAFE(EXP) \
+  do {                                 \
+    if ((EXP) && location_wrapper_p (EXP))     \
+      (EXP) = TREE_OPERAND ((EXP), 0);         \
+  } while (0)
+
 /* Nonzero if TYPE represents a vector type.  */
 
 #define VECTOR_TYPE_P(TYPE) (TREE_CODE (TYPE) == VECTOR_TYPE)
-- 
1.8.5.3

Reply via email to