aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index d570150..deba8b4 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -3907,4 +3907,27 @@ mark_used (tree decl)
processing_template_decl = saved_processing_template_decl;
}
+/* Given function PARM_DECL PARM, return its index in the function's list
+ of parameters, beginning with 1. */
+
+int
+parm_index (tree parm)
+{
+ int index;
+ tree arg;
+
+ for (index = 1, arg = DECL_ARGUMENTS (DECL_CONTEXT (parm));
+ arg;
+ ++index, arg = TREE_CHAIN (arg))
+ {
+ if (DECL_NAME (parm) == DECL_NAME (arg))
+ break;
+ if (DECL_ARTIFICIAL (arg))
+ --index;
+ }
+
+ gcc_assert (arg);
+ return index;
+}
+
#include "gt-cp-decl2.h"