[llvm] 7c63726 - [llvm][tools] Hide unrelated llvm-cfi-verify options

Timm Bäder via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 16 00:26:57 PDT 2021


Author: Timm Bäder
Date: 2021-07-16T09:25:54+02:00
New Revision: 7c63726072005cc331bb21694c9022e6d18a3b93

URL: https://github.com/llvm/llvm-project/commit/7c63726072005cc331bb21694c9022e6d18a3b93
DIFF: https://github.com/llvm/llvm-project/commit/7c63726072005cc331bb21694c9022e6d18a3b93.diff

LOG: [llvm][tools] Hide unrelated llvm-cfi-verify options

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

Added: 
    llvm/test/tools/llvm-cfi-verify/help.test

Modified: 
    llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-cfi-verify/help.test b/llvm/test/tools/llvm-cfi-verify/help.test
new file mode 100644
index 0000000000000..f14c5f224bc6c
--- /dev/null
+++ b/llvm/test/tools/llvm-cfi-verify/help.test
@@ -0,0 +1,7 @@
+# RUN: llvm-cfi-verify --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:'
+
+# HELP: OVERVIEW:
+# HELP: USAGE:
+# HELP: CFI Verify Options:
+# HELP: Color Options:
+# HELP: Generic Options:

diff  --git a/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp b/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
index 1331442bc65c7..820334c025f3e 100644
--- a/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
+++ b/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
@@ -32,21 +32,24 @@ using namespace llvm;
 using namespace llvm::object;
 using namespace llvm::cfi_verify;
 
+static cl::OptionCategory CFIVerifyCategory("CFI Verify Options");
+
 cl::opt<std::string> InputFilename(cl::Positional, cl::desc("<input file>"),
-                                   cl::Required);
+                                   cl::Required, cl::cat(CFIVerifyCategory));
 cl::opt<std::string> BlacklistFilename(cl::Positional,
                                        cl::desc("[blacklist file]"),
-                                       cl::init("-"));
+                                       cl::init("-"),
+                                       cl::cat(CFIVerifyCategory));
 cl::opt<bool> PrintGraphs(
     "print-graphs",
     cl::desc("Print graphs around indirect CF instructions in DOT format."),
-    cl::init(false));
+    cl::init(false), cl::cat(CFIVerifyCategory));
 cl::opt<unsigned> PrintBlameContext(
     "blame-context",
     cl::desc("Print the blame context (if possible) for BAD instructions. This "
              "specifies the number of lines of context to include, where zero "
              "disables this feature."),
-    cl::init(0));
+    cl::init(0), cl::cat(CFIVerifyCategory));
 cl::opt<unsigned> PrintBlameContextAll(
     "blame-context-all",
     cl::desc("Prints the blame context (if possible) for ALL instructions. "
@@ -54,9 +57,9 @@ cl::opt<unsigned> PrintBlameContextAll(
              "instructions (see --blame-context). If --blame-context is "
              "unspecified, it prints this number of contextual lines for BAD "
              "instructions as well."),
-    cl::init(0));
+    cl::init(0), cl::cat(CFIVerifyCategory));
 cl::opt<bool> Summarize("summarize", cl::desc("Print the summary only."),
-                        cl::init(false));
+                        cl::init(false), cl::cat(CFIVerifyCategory));
 
 ExitOnError ExitOnErr;
 
@@ -245,6 +248,7 @@ printIndirectCFInstructions(FileAnalysis &Analysis,
 }
 
 int main(int argc, char **argv) {
+  cl::HideUnrelatedOptions({&CFIVerifyCategory, &ColorCategory});
   cl::ParseCommandLineOptions(
       argc, argv,
       "Identifies whether Control Flow Integrity protects all indirect control "


        


More information about the llvm-commits mailing list