Skip to content

Commit

Permalink
Merge pull request #1429 from cachemeifyoucan/eng/PR-makeOptions-D157…
Browse files Browse the repository at this point in the history
…029-fix

[Options] Fix makeOptions after upstream Option TableGen change
  • Loading branch information
cachemeifyoucan committed Aug 29, 2023
2 parents 45555b1 + 752f526 commit b202171
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Sources/makeOptions/makeOptions.cpp
Expand Up @@ -29,13 +29,15 @@ enum class OptionKind {
JoinedOrSeparate,
};

#define LLVM_MAKE_OPT_ID_WITH_ID_PREFIX(ID_PREFIX, PREFIX, NAME, ID, KIND, \
GROUP, ALIAS, ALIASARGS, FLAGS, PARAM, \
HELPTEXT, METAVAR, VALUES) \
ID_PREFIX##ID

//. The IDs of each option
enum class OptionID {
Opt_INVALID = 0,
#define OPTION(PREFIX, NAME, ID, KIND, GROUP, ALIAS, ALIASARGS, FLAGS, \
PARAM, HELPTEXT, METAVAR, VALUES) \
Opt_##ID,

#define OPTION(...) LLVM_MAKE_OPT_ID_WITH_ID_PREFIX(Opt_, __VA_ARGS__),
#if __has_include("swift/Option/Options.inc")
#include "swift/Option/Options.inc"
#else
Expand Down Expand Up @@ -185,10 +187,13 @@ void forEachSpelling(const char * const *prefixes, const std::string &spelling,
return;
}

bool isAlternateSpelling = false;
fn(spelling, /*isAlternateSpelling=*/false);

std::string defaultPrefix = std::string(*prefixes++);
while (*prefixes) {
fn(*prefixes++ + spelling, isAlternateSpelling);
isAlternateSpelling = true;
std::string altSpelling =
std::string(*prefixes++) + spelling.substr(defaultPrefix.size());
fn(altSpelling, /*isAlternateSpelling=*/true);
}
}

Expand Down

0 comments on commit b202171

Please sign in to comment.