aboutsummaryrefslogtreecommitdiffstats
path: root/utils/TableGen/OptParserEmitter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/TableGen/OptParserEmitter.cpp')
-rw-r--r--utils/TableGen/OptParserEmitter.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/utils/TableGen/OptParserEmitter.cpp b/utils/TableGen/OptParserEmitter.cpp
index 0c1f623..86328bf 100644
--- a/utils/TableGen/OptParserEmitter.cpp
+++ b/utils/TableGen/OptParserEmitter.cpp
@@ -178,7 +178,7 @@ void EmitOptParser(RecordKeeper &Records, raw_ostream &OS) {
OS << "INVALID";
// The other option arguments (unused for groups).
- OS << ", INVALID, 0, 0";
+ OS << ", INVALID, 0, 0, 0";
// The option help text.
if (!isa<UnsetInit>(R.getValueInit("HelpText"))) {
@@ -228,6 +228,21 @@ void EmitOptParser(RecordKeeper &Records, raw_ostream &OS) {
else
OS << "INVALID";
+ // The option alias arguments (if any).
+ // Emitted as a \0 separated list in a string, e.g. ["foo", "bar"]
+ // would become "foo\0bar\0". Note that the compiler adds an implicit
+ // terminating \0 at the end.
+ OS << ", ";
+ std::vector<std::string> AliasArgs = R.getValueAsListOfStrings("AliasArgs");
+ if (AliasArgs.size() == 0) {
+ OS << "0";
+ } else {
+ OS << "\"";
+ for (size_t i = 0, e = AliasArgs.size(); i != e; ++i)
+ OS << AliasArgs[i] << "\\0";
+ OS << "\"";
+ }
+
// The option flags.
const ListInit *LI = R.getValueAsListInit("Flags");
if (LI->empty()) {