]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Add function to strip pointer type and get down to the actual pointee type.
authorTejas Belagod <tejas.belagod@arm.com>
Sun, 13 Oct 2024 10:20:23 +0000 (15:50 +0530)
committerTejas Belagod <tejas.belagod@arm.com>
Tue, 8 Apr 2025 06:20:49 +0000 (11:50 +0530)
Add a function to traverse down the pointer layers to the pointee type.

gcc/ChangeLog:
* tree.h (strip_pointer_types): New.

gcc/tree.h

index 55f97f9f99947e6ee698b7ff1a32be44ce2781ac..99f2617762819caba180ea99f0b69120a25a98c6 100644 (file)
@@ -5053,6 +5053,17 @@ strip_array_types (tree type)
   return type;
 }
 
+/* Recursively traverse down pointer type layers to pointee 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 {