// The third value is the option type, one of Group, Flag, Joined,
// Separate, CommaJoined, JoinedOrSeparate, JoinedAndSeparate.
-// The fourth value is the internal name of the option group, or 0 if
-// the option is not part of a group.
+// The fourth value is the internal name of the option group, or
+// INVALID if the option is not part of a group.
-// The fifth value is the internal name of an aliased option, or 0 if
-// the option is not an alias.
+// The fifth value is the internal name of an aliased option, or
+// INVALID if the option is not an alias.
// The sixth value is a string containing option flags. Valid values:
// l: The option is a linker input.
// U: The option is unsupported, and the driver will reject command
// lines that use it.
-/// The seventh value is an arbitrary integer parameter; currently
-/// this is only used for specifying the number of arguments for
-/// Separate options.
+// The seventh value is an arbitrary integer parameter; currently
+// this is only used for specifying the number of arguments for
+// Separate options.
-OPTION("-arch", ArchOpt, Separate, 0, 0, "", 0)
-OPTION("-pass-exit-codes", PassExitCodesFlag, Flag, 0, 0, "", 0)
-OPTION("-print-file-name=", PrintFileNameOpt, Joined, 0, 0, "", 0)
-OPTION("-Wp,", WpOpt, CommaJoined, 0, 0, "", 0)
+OPTION("-arch", ArchOpt, Separate, INVALID, INVALID, "", 0)
+OPTION("-pass-exit-codes", PassExitCodesFlag, Flag, INVALID, INVALID, "", 0)
+OPTION("-print-file-name=", PrintFileNameOpt, Joined, INVALID, INVALID, "", 0)
+OPTION("-Wp,", WpOpt, CommaJoined, INVALID, INVALID, "", 0)
namespace driver {
namespace options {
enum ID {
- NotOption = 0, // This is not an option ID.
- InputOpt, // Reserved ID for input option.
- UnknownOpt, // Reserved ID for unknown option.
-#define OPTION(NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM) ID,
+ OPT_INVALID = 0, // This is not an option ID.
+ OPT_INPUT, // Reserved ID for input option.
+ OPT_UNKNOWN, // Reserved ID for unknown option.
+#define OPTION(NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM) OPT_##ID,
#include "clang/Driver/Options.def"
LastOption
#undef OPTION
static Info OptionInfos[] = {
// The InputOption info
- { "<input>", "", Option::InputClass, 0, 0, 0 },
+ { "<input>", "", Option::InputClass, OPT_INVALID, OPT_INVALID, 0 },
// The UnknownOption info
- { "<unknown>", "", Option::UnknownClass, 0, 0, 0 },
+ { "<unknown>", "", Option::UnknownClass, OPT_INVALID, OPT_INVALID, 0 },
-#define OPTION(NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM) \
- { NAME, FLAGS, Option::KIND##Class, GROUP, ALIAS, PARAM },
+#define OPTION(NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM) \
+ { NAME, FLAGS, Option::KIND##Class, OPT_##GROUP, OPT_##ALIAS, PARAM },
#include "clang/Driver/Options.def"
};
static const unsigned numOptions = sizeof(OptionInfos) / sizeof(OptionInfos[0]);
}
const Option *OptTable::getOption(options::ID id) const {
- if (id == NotOption)
+ if (id == OPT_INVALID)
return 0;
assert((unsigned) (id - 1) < numOptions && "Invalid ID.");
// Anything that doesn't start with '-' is an input.
if (Str[0] != '-')
- return new PositionalArg(getOption(InputOpt), Index++);
+ return new PositionalArg(getOption(OPT_INPUT), Index++);
- for (unsigned j = UnknownOpt + 1; j < LastOption; ++j) {
+ for (unsigned j = OPT_UNKNOWN + 1; j < LastOption; ++j) {
const char *OptName = getOptionName((options::ID) j);
// Arguments are only accepted by options which prefix them.
return A;
}
- return new PositionalArg(getOption(UnknownOpt), Index++);
+ return new PositionalArg(getOption(OPT_UNKNOWN), Index++);
}
}
InputOption::InputOption()
- : Option(Option::InputClass, options::InputOpt, "<input>", 0, 0) {
+ : Option(Option::InputClass, options::OPT_INPUT, "<input>", 0, 0) {
}
Arg *InputOption::accept(const ArgList &Args, unsigned &Index) const {
}
UnknownOption::UnknownOption()
- : Option(Option::UnknownClass, options::UnknownOpt, "<unknown>", 0, 0) {
+ : Option(Option::UnknownClass, options::OPT_UNKNOWN, "<unknown>", 0, 0) {
}
Arg *UnknownOption::accept(const ArgList &Args, unsigned &Index) const {