diff options
-rw-r--r-- | include/klee/SolverCmdLine.h | 7 | ||||
-rw-r--r-- | lib/Basic/CmdLineOptions.cpp | 24 |
2 files changed, 19 insertions, 12 deletions
diff --git a/include/klee/SolverCmdLine.h b/include/klee/SolverCmdLine.h index c6fb6654..255b3848 100644 --- a/include/klee/SolverCmdLine.h +++ b/include/klee/SolverCmdLine.h @@ -82,12 +82,11 @@ extern llvm::cl::opt<klee::MetaSMTBackendType> MetaSMTBackend; class KCommandLine { public: + /// Hide all options in the specified category + static void HideOptions(llvm::cl::OptionCategory &Category); + /// Hide all options except the ones in the specified category static void HideUnrelatedOptions(llvm::cl::OptionCategory &Category); - - /// Hide all options except the ones in the specified categories - static void HideUnrelatedOptions( - llvm::ArrayRef<const llvm::cl::OptionCategory *> Categories); }; } // namespace klee diff --git a/lib/Basic/CmdLineOptions.cpp b/lib/Basic/CmdLineOptions.cpp index 05ee2821..80dc3c9d 100644 --- a/lib/Basic/CmdLineOptions.cpp +++ b/lib/Basic/CmdLineOptions.cpp @@ -112,6 +112,22 @@ cl::opt<bool> UseAssignmentValidatingSolver( cl::desc("Debug the correctness of generated assignments (default=false)"), cl::cat(SolvingCat)); + +void KCommandLine::HideOptions(llvm::cl::OptionCategory &Category) { +#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) + StringMap<cl::Option *> &map = cl::getRegisteredOptions(); +#else + StringMap<cl::Option *> map; + cl::getRegisteredOptions(map); +#endif + + for (auto &elem : map) { + if (elem.second->Category == &Category) { + elem.second->setHiddenFlag(cl::Hidden); + } + } +} + void KCommandLine::HideUnrelatedOptions(cl::OptionCategory &Category) { #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 7) StringMap<cl::Option *> &map = cl::getRegisteredOptions(); @@ -127,14 +143,6 @@ void KCommandLine::HideUnrelatedOptions(cl::OptionCategory &Category) { } } -void KCommandLine::HideUnrelatedOptions( - ArrayRef<const cl::OptionCategory *> Categories) { - for (ArrayRef<const cl::OptionCategory *>::iterator i = Categories.begin(), - e = Categories.end(); - i != e; i++) - HideUnrelatedOptions(*i); -} - #ifdef ENABLE_METASMT #ifdef METASMT_DEFAULT_BACKEND_IS_BTOR |