aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree.cc')
-rw-r--r--gcc/tree.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/tree.cc b/gcc/tree.cc
index 94c6d08..b40f4d3 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -3732,6 +3732,19 @@ array_type_nelts_minus_one (const_tree type)
? max
: fold_build2 (MINUS_EXPR, TREE_TYPE (max), max, min));
}
+
+/* Return, as an INTEGER_CST node, the number of elements for TYPE
+ (which is an ARRAY_TYPE). This counts only elements of the top
+ array. */
+
+tree
+array_type_nelts_top (tree type)
+{
+ return fold_build2_loc (input_location,
+ PLUS_EXPR, sizetype,
+ array_type_nelts_minus_one (type),
+ size_one_node);
+}
/* If arg is static -- a reference to an object in static storage -- then
return the object. This is not the same as the C meaning of `static'.