diff options
author | Cristian Cadar <c.cadar@imperial.ac.uk> | 2019-03-11 16:27:39 +0000 |
---|---|---|
committer | MartinNowack <martin.nowack@gmail.com> | 2019-03-13 22:10:53 +0000 |
commit | c1209fba3edd49ece755d29179231de468729a2b (patch) | |
tree | 7df4ca82b8d9e98ca6b7aeb865d6df466fd64877 | |
parent | 891a3842d164ef4392c3f51431b6a8443092fc86 (diff) | |
download | klee-c1209fba3edd49ece755d29179231de468729a2b.tar.gz |
Added function to hide all options in a given category. Removed uneeded (and incorrectly-implemented) function for hiding all options unrelated to a set of categories.
-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 |