summaryrefslogtreecommitdiffstats
path: root/gcc/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index a4159467a15..d52179c44d1 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -2004,6 +2004,22 @@ list_length (t)
return len;
}
+/* Returns the number of FIELD_DECLs in TYPE. */
+
+int
+fields_length (type)
+ tree type;
+{
+ tree t = TYPE_FIELDS (type);
+ int count = 0;
+
+ for (; t; t = TREE_CHAIN (t))
+ if (TREE_CODE (t) == FIELD_DECL)
+ ++count;
+
+ return count;
+}
+
/* Concatenate two chains of nodes (chained through TREE_CHAIN)
by modifying the last node in chain 1 to point to chain 2.
This is the Lisp primitive `nconc'. */
OpenPOWER on IntegriCloud