about summary refs log tree commit diff homepage
path: root/lib
diff options
context:
space:
mode:
authorCristian Cadar <c.cadar@imperial.ac.uk>2017-08-11 20:13:17 +0100
committerCristian Cadar <c.cadar@imperial.ac.uk>2017-08-11 20:13:17 +0100
commit49f2e54339e186fd68cf6cb3ab775d0e3f643eb8 (patch)
treefec89ff62c9f1cad66d55cc6ec9d25716f2296ac /lib
parentd19500eb93083c8cc6bb72bcb54414015830cacb (diff)
downloadklee-49f2e54339e186fd68cf6cb3ab775d0e3f643eb8.tar.gz
Added support for hiding command-line options
Diffstat (limited to 'lib')
-rw-r--r--lib/Basic/CmdLineOptions.cpp29
1 files changed, 25 insertions, 4 deletions
diff --git a/lib/Basic/CmdLineOptions.cpp b/lib/Basic/CmdLineOptions.cpp
index 324f349e..da333884 100644
--- a/lib/Basic/CmdLineOptions.cpp
+++ b/lib/Basic/CmdLineOptions.cpp
@@ -15,6 +15,12 @@
 #include "klee/CommandLine.h"
 #include "klee/Config/Version.h"
 
+#include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/StringMap.h"
+#include "llvm/Support/CommandLine.h"
+
+using namespace llvm;
+
 namespace klee {
 
 llvm::cl::opt<bool>
@@ -81,6 +87,25 @@ llvm::cl::opt<bool>
     UseAssignmentValidatingSolver("debug-assignment-validating-solver",
                                   llvm::cl::init(false));
 
+void KCommandLine::HideUnrelatedOptions(cl::OptionCategory &Category) {
+  StringMap<cl::Option *> map;
+  cl::getRegisteredOptions(map);
+  for (StringMap<cl::Option *>::iterator i = map.begin(), e = map.end(); i != e;
+       i++) {
+    if (i->second->Category != &Category) {
+      i->second->setHiddenFlag(cl::Hidden);
+    }
+  }
+}
+
+void KCommandLine::HideUnrelatedOptions(
+    llvm::ArrayRef<const llvm::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
@@ -156,7 +181,3 @@ llvm::cl::opt<CoreSolverType> DebugCrossCheckCoreSolverWith(
 #undef METASMT_IS_DEFAULT_STR
 #undef Z3_IS_DEFAULT_STR
 #undef DEFAULT_CORE_SOLVER
-
-
-
-