Index: llvm/trunk/include/llvm/Support/CommandLine.h =================================================================== --- llvm/trunk/include/llvm/Support/CommandLine.h +++ llvm/trunk/include/llvm/Support/CommandLine.h @@ -21,10 +21,12 @@ #define LLVM_SUPPORT_COMMANDLINE_H #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/Twine.h" #include "llvm/Support/Compiler.h" +#include "llvm/Support/ManagedStatic.h" #include #include #include @@ -43,8 +45,9 @@ //===----------------------------------------------------------------------===// // ParseCommandLineOptions - Command line option processing entry point. // -void ParseCommandLineOptions(int argc, const char *const *argv, - const char *Overview = nullptr); +bool ParseCommandLineOptions(int argc, const char *const *argv, + const char *Overview = nullptr, + bool IgnoreErrors = false); //===----------------------------------------------------------------------===// // ParseEnvironmentOptions - Environment variable option processing alternate @@ -171,6 +174,45 @@ extern OptionCategory GeneralCategory; //===----------------------------------------------------------------------===// +// SubCommand class +// +class SubCommand { +private: + const char *const Name = nullptr; + const char *const Description = nullptr; + +protected: + void registerSubCommand(); + void unregisterSubCommand(); + +public: + SubCommand(const char *const Name, const char *const Description = nullptr) + : Name(Name), Description(Description) { + registerSubCommand(); + } + SubCommand() {} + + void reset(); + + operator bool() const; + + const char *getName() const { return Name; } + const char *getDescription() const { return Description; } + + SmallVector