]> granicus.if.org Git - clang/commitdiff
[CommandLineParser] Add DefaultOption flag
authorDon Hinton <hintonda@gmail.com>
Sat, 13 Apr 2019 16:55:28 +0000 (16:55 +0000)
committerDon Hinton <hintonda@gmail.com>
Sat, 13 Apr 2019 16:55:28 +0000 (16:55 +0000)
Summary: Add DefaultOption flag to CommandLineParser which provides a
default option or alias, but allows users to override it for some
other purpose as needed.

Also, add `-h` as a default alias to `-help`, which can be seamlessly
overridden by applications like llvm-objdump and llvm-readobj which
use `-h` as an alias for other options.

Reviewers: alexfh, klimek

Reviewed By: klimek

Subscribers: MaskRay, mehdi_amini, inglorion, dexonsmith, hiraditya, llvm-commits, jhenderson, arphaman, cfe-commits

Tags: #clang, #llvm

Differential Revision: https://reviews.llvm.org/D59746

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@358337 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Tooling/CommonOptionsParser.cpp

index f38542dac6ad7784ce0785598a81a7b8583c9da6..5faa1d7bdb2b6c1e9dd3fb431d0e804d16b67f4f 100644 (file)
@@ -83,8 +83,6 @@ std::vector<CompileCommand> ArgumentsAdjustingCompilations::adjustCommands(
 llvm::Error CommonOptionsParser::init(
     int &argc, const char **argv, cl::OptionCategory &Category,
     llvm::cl::NumOccurrencesFlag OccurrencesFlag, const char *Overview) {
-  static cl::opt<bool> Help("h", cl::desc("Alias for -help"), cl::Hidden,
-                            cl::sub(*cl::AllSubCommands));
 
   static cl::opt<std::string> BuildPath("p", cl::desc("Build path"),
                                         cl::Optional, cl::cat(Category),