summaryrefslogtreecommitdiff
path: root/gcc/opts-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/opts-common.c')
-rw-r--r--gcc/opts-common.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/opts-common.c b/gcc/opts-common.c
index 089d8199d50..973dd7e97e7 100644
--- a/gcc/opts-common.c
+++ b/gcc/opts-common.c
@@ -212,6 +212,22 @@ enum_arg_to_value (const struct cl_enum_arg *enum_args,
return false;
}
+/* Look up ARG in the enum used by option OPT_INDEX for language
+ LANG_MASK, returning true and storing the value in *VALUE if found,
+ and returning false without modifying *VALUE if not found. */
+
+bool
+opt_enum_arg_to_value (size_t opt_index, const char *arg, int *value,
+ unsigned int lang_mask)
+{
+ const struct cl_option *option = &cl_options[opt_index];
+
+ gcc_assert (option->var_type == CLVC_ENUM);
+
+ return enum_arg_to_value (cl_enums[option->var_enum].values, arg,
+ value, lang_mask);
+}
+
/* Look of VALUE in ENUM_ARGS for language LANG_MASK and store the
corresponding string in *ARGP, returning true if the found string
was marked as canonical, false otherwise. If VALUE is not found