Add a function to traverse down the pointer layers to the pointee type.

gcc/ChangeLog:
        * tree.h (strip_pointer_types): New.
---
 gcc/tree.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gcc/tree.h b/gcc/tree.h
index 21f3cd5525c..580997b4e5d 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -5048,6 +5048,15 @@ strip_array_types (tree type)
   return type;
 }
 
+inline const_tree
+strip_pointer_types (const_tree type)
+{
+  while (POINTER_TYPE_P (type))
+    type = TREE_TYPE (type);
+
+  return type;
+}
+
 /* Desription of the reason why the argument of valid_constant_size_p
    is not a valid size.  */
 enum cst_size_error {
-- 
2.25.1

Reply via email to