aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 2f0e03c..27ab46c 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1905,6 +1905,17 @@ purpose_member (const_tree elem, tree list)
return NULL_TREE;
}
+/* Returns element number IDX (zero-origin) of chain CHAIN, or
+ NULL_TREE. */
+
+tree
+chain_index (int idx, tree chain)
+{
+ for (; chain && idx > 0; --idx)
+ chain = TREE_CHAIN (chain);
+ return chain;
+}
+
/* Return nonzero if ELEM is part of the chain CHAIN. */
int