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 | b349fccc4a6e416483b0b36b4f74e39787c62344 (patch) | |
tree | 6d060e0040530530ba8e264a8c6d760757e7e1b8 /lib/Driver/OptTable.cpp | |
parent | d639b42fb139b67abd878364df8707a30029e7b3 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66767 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/OptTable.cpp')
-rw-r--r-- | lib/Driver/OptTable.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/Driver/OptTable.cpp b/lib/Driver/OptTable.cpp index db910e1a31..5caaace3ad 100644 --- a/lib/Driver/OptTable.cpp +++ b/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++); } |