@@ -29,13 +29,15 @@ enum class OptionKind {
29
29
JoinedOrSeparate,
30
30
};
31
31
32
+ #define LLVM_MAKE_OPT_ID_WITH_ID_PREFIX (ID_PREFIX, PREFIX, NAME, ID, KIND, \
33
+ GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
34
+ HELPTEXT, METAVAR, VALUES) \
35
+ ID_PREFIX##ID
36
+
32
37
// . The IDs of each option
33
38
enum class OptionID {
34
39
Opt_INVALID = 0 ,
35
- #define OPTION (PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, \
36
- PARAM, HELPTEXT, METAVAR, VALUES) \
37
- Opt_##ID,
38
-
40
+ #define OPTION (...) LLVM_MAKE_OPT_ID_WITH_ID_PREFIX(Opt_, __VA_ARGS__),
39
41
#if __has_include("swift/Option/Options.inc")
40
42
#include " swift/Option/Options.inc"
41
43
#else
@@ -185,10 +187,13 @@ void forEachSpelling(const char * const *prefixes, const std::string &spelling,
185
187
return ;
186
188
}
187
189
188
- bool isAlternateSpelling = false ;
190
+ fn (spelling, /* isAlternateSpelling=*/ false );
191
+
192
+ unsigned defaultPrefixSize = strlen (*prefixes++);
189
193
while (*prefixes) {
190
- fn (*prefixes++ + spelling, isAlternateSpelling);
191
- isAlternateSpelling = true ;
194
+ std::string altSpelling =
195
+ std::string (*prefixes++) + spelling.substr (defaultPrefixSize);
196
+ fn (altSpelling, /* isAlternateSpelling=*/ true );
192
197
}
193
198
}
194
199
0 commit comments