From a207254f94ad58980c6c2eacac7c38f192c3846b Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 31 Mar 2009 20:12:05 +0000 Subject: Driver: Add extra parameters for help text to option definitions. - Currently unused. And yes, now may be about the time I want a TableGen backend. llvm-svn: 68139 --- clang/lib/Driver/OptTable.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'clang/lib/Driver/OptTable.cpp') diff --git a/clang/lib/Driver/OptTable.cpp b/clang/lib/Driver/OptTable.cpp index 2e449995809..4c198fc24f7 100644 --- a/clang/lib/Driver/OptTable.cpp +++ b/clang/lib/Driver/OptTable.cpp @@ -21,6 +21,8 @@ using namespace clang::driver::options; struct Info { const char *Name; const char *Flags; + const char *HelpText; + const char *MetaVar; Option::OptionClass Kind; unsigned GroupID; @@ -72,12 +74,14 @@ static inline bool operator<(const Info &A, const Info &B) { static Info OptionInfos[] = { // The InputOption info - { "", "d", Option::InputClass, OPT_INVALID, OPT_INVALID, 0 }, + { "", "d", 0, 0, Option::InputClass, OPT_INVALID, OPT_INVALID, 0 }, // The UnknownOption info - { "", "", Option::UnknownClass, OPT_INVALID, OPT_INVALID, 0 }, + { "", "", 0, 0, Option::UnknownClass, OPT_INVALID, OPT_INVALID, 0 }, -#define OPTION(NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM) \ - { NAME, FLAGS, Option::KIND##Class, OPT_##GROUP, OPT_##ALIAS, PARAM }, +#define OPTION(NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \ + HELPTEXT, METAVAR) \ + { NAME, FLAGS, HELPTEXT, METAVAR, \ + Option::KIND##Class, OPT_##GROUP, OPT_##ALIAS, PARAM }, #include "clang/Driver/Options.def" }; static const unsigned numOptions = sizeof(OptionInfos) / sizeof(OptionInfos[0]); @@ -133,6 +137,16 @@ const char *OptTable::getOptionName(options::ID id) const { return getInfo(id).Name; } +const char *OptTable::getOptionHelpText(options::ID id) const { + return getInfo(id).HelpText; +} + +const char *OptTable::getOptionMetaVar(options::ID id) const { + const char *Name = getInfo(id).MetaVar; + // FIXME: This will need translation. + return Name ? Name : ""; +} + const Option *OptTable::getOption(options::ID id) const { if (id == OPT_INVALID) return 0; -- cgit v1.2.3