OS << "/////////\n";
OS << "// Groups\n\n";
OS << "#ifdef OPTION\n";
+
+ // FIXME: Remove when option parsing clients are updated.
+ OS << "#ifdef SUPPORT_ALIASARGS\n";
+ OS << "#define OPTIONX OPTION\n";
+ OS << "#else\n";
+ OS << "#define OPTIONX(prefix, name, id, kind, group, alias, aliasargs, "
+ << "flags, param, helptext, metavar) "
+ << "OPTION(prefix, name, id, kind, "
+ << "group, alias, flags, param, helptext, metavar)\n";
+ OS << "#endif\n";
+
for (unsigned i = 0, e = Groups.size(); i != e; ++i) {
const Record &R = *Groups[i];
// Start a single option entry.
- OS << "OPTION(";
+ OS << "OPTIONX(";
// The option prefix;
OS << "0";
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"))) {
const Record &R = *Opts[i];
// Start a single option entry.
- OS << "OPTION(";
+ OS << "OPTIONX(";
// The option prefix;
std::vector<std::string> prf = R.getValueAsListOfStrings("Prefixes");
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()) {
OS << ")\n";
}
+ OS << "#undef OPTIONX\n"; // FIXME: Remove when option clients are updated.
OS << "#endif\n";
}
} // end namespace llvm