diff --git a/clang/lib/Tooling/CommonOptionsParser.cpp b/clang/lib/Tooling/CommonOptionsParser.cpp --- a/clang/lib/Tooling/CommonOptionsParser.cpp +++ b/clang/lib/Tooling/CommonOptionsParser.cpp @@ -83,8 +83,6 @@ llvm::Error CommonOptionsParser::init( int &argc, const char **argv, cl::OptionCategory &Category, llvm::cl::NumOccurrencesFlag OccurrencesFlag, const char *Overview) { - static cl::opt Help("h", cl::desc("Alias for -help"), cl::Hidden, - cl::sub(*cl::AllSubCommands)); static cl::opt BuildPath("p", cl::desc("Build path"), cl::Optional, cl::cat(Category), diff --git a/llvm/docs/CommandLine.rst b/llvm/docs/CommandLine.rst --- a/llvm/docs/CommandLine.rst +++ b/llvm/docs/CommandLine.rst @@ -128,6 +128,7 @@ USAGE: compiler [options] OPTIONS: + -h - Alias for -help -help - display available options (-help-hidden for more) -o - Specify output filename @@ -194,6 +195,7 @@ USAGE: compiler [options] OPTIONS: + -h - Alias for -help -help - display available options (-help-hidden for more) -o - Specify output filename @@ -1251,6 +1253,14 @@ with ``cl::CommaSeparated``, this modifier only makes sense with a `cl::list`_ option. +.. _cl::DefaultOption: + +* The **cl::DefaultOption** modifier is used to specify that the option is a + default that can be overridden by application specific parsers. For example, + the ``-help`` alias, ``-h``, is registered this way, so it can be overridden + by applications that need to use the ``-h`` option for another purpose, + either as a regular option or an alias for another option. + .. _response files: Response files diff --git a/llvm/include/llvm/Support/CommandLine.h b/llvm/include/llvm/Support/CommandLine.h --- a/llvm/include/llvm/Support/CommandLine.h +++ b/llvm/include/llvm/Support/CommandLine.h @@ -175,7 +175,10 @@ // If this is enabled, multiple letter options are allowed to bunch together // with only a single hyphen for the whole group. This allows emulation // of the behavior that ls uses for example: ls -la === ls -l -a - Grouping = 0x08 + Grouping = 0x08, + + // Default option + DefaultOption = 0x10 }; //===----------------------------------------------------------------------===// @@ -231,6 +234,7 @@ SmallVector