зеркало из https://github.com/microsoft/clang-1.git
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68139 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
64ffc1472e
Коммит
c0d12e93ee
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -17,7 +17,8 @@ namespace options {
|
|||
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,
|
||||
#define OPTION(NAME, ID, KIND, GROUP, ALIAS, FLAGS, PARAM, \
|
||||
HELPTEXT, METAVAR) OPT_##ID,
|
||||
#include "clang/Driver/Options.def"
|
||||
LastOption
|
||||
#undef OPTION
|
||||
|
@ -60,6 +61,14 @@ namespace options {
|
|||
/// creating it if necessary.
|
||||
const Option *getOption(options::ID id) const;
|
||||
|
||||
/// getOptionHelpText - Get the help text to use to describe this
|
||||
/// option.
|
||||
const char *getOptionHelpText(options::ID id) const;
|
||||
|
||||
/// getOptionMetaVar - Get the meta-variable name to use when
|
||||
/// describing this options values in the help text.
|
||||
const char *getOptionMetaVar(options::ID id) const;
|
||||
|
||||
/// parseOneArg - Parse a single argument; returning the new
|
||||
/// argument and updating Index.
|
||||
///
|
||||
|
|
|
@ -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
|
||||
{ "<input>", "d", Option::InputClass, OPT_INVALID, OPT_INVALID, 0 },
|
||||
{ "<input>", "d", 0, 0, Option::InputClass, OPT_INVALID, OPT_INVALID, 0 },
|
||||
// The UnknownOption info
|
||||
{ "<unknown>", "", Option::UnknownClass, OPT_INVALID, OPT_INVALID, 0 },
|
||||
{ "<unknown>", "", 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 : "<var>";
|
||||
}
|
||||
|
||||
const Option *OptTable::getOption(options::ID id) const {
|
||||
if (id == OPT_INVALID)
|
||||
return 0;
|
||||
|
|
Загрузка…
Ссылка в новой задаче