diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-03-12 03:42:54 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-03-12 03:42:54 +0000 |
commit | c727e9310df06714a6b5ff0c592c171a68360cad (patch) | |
tree | e1117a546d17fc3a872827784884ce850d8b561a /clang/lib/Driver/OptTable.cpp | |
parent | c46949c27804718641f63610f4f440599e4b225a (diff) | |
download | bcm5719-llvm-c727e9310df06714a6b5ff0c592c171a68360cad.tar.gz bcm5719-llvm-c727e9310df06714a6b5ff0c592c171a68360cad.zip |
Driver: Tweak option naming/def:
- Use OPT_ prefix for ids.
- Reference groups and aliases by shortend id (on the theory that
this is more readable).
- Rename the special option ids to more protected names.
llvm-svn: 66767
Diffstat (limited to 'clang/lib/Driver/OptTable.cpp')
-rw-r--r-- | clang/lib/Driver/OptTable.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/clang/lib/Driver/OptTable.cpp b/clang/lib/Driver/OptTable.cpp index db910e1a314..5caaace3ad0 100644 --- a/clang/lib/Driver/OptTable.cpp +++ b/clang/lib/Driver/OptTable.cpp @@ -30,12 +30,12 @@ struct Info { 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]); @@ -63,7 +63,7 @@ const char *OptTable::getOptionName(options::ID id) const { } const Option *OptTable::getOption(options::ID id) const { - if (id == NotOption) + if (id == OPT_INVALID) return 0; assert((unsigned) (id - 1) < numOptions && "Invalid ID."); @@ -125,9 +125,9 @@ Arg *OptTable::ParseOneArg(const ArgList &Args, unsigned &Index, // 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. @@ -136,6 +136,6 @@ Arg *OptTable::ParseOneArg(const ArgList &Args, unsigned &Index, return A; } - return new PositionalArg(getOption(UnknownOpt), Index++); + return new PositionalArg(getOption(OPT_UNKNOWN), Index++); } |