Skip to content

Commit 7c63726

Browse files
committed
[llvm][tools] Hide unrelated llvm-cfi-verify options
Differential Revision: https://reviews.llvm.org/D106055
1 parent 77f2f0f commit 7c63726

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# RUN: llvm-cfi-verify --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:'
2+
3+
# HELP: OVERVIEW:
4+
# HELP: USAGE:
5+
# HELP: CFI Verify Options:
6+
# HELP: Color Options:
7+
# HELP: Generic Options:

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

+10-6
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,34 @@ using namespace llvm;
3232
using namespace llvm::object;
3333
using namespace llvm::cfi_verify;
3434

35+
static cl::OptionCategory CFIVerifyCategory("CFI Verify Options");
36+
3537
cl::opt<std::string> InputFilename(cl::Positional, cl::desc("<input file>"),
36-
cl::Required);
38+
cl::Required, cl::cat(CFIVerifyCategory));
3739
cl::opt<std::string> BlacklistFilename(cl::Positional,
3840
cl::desc("[blacklist file]"),
39-
cl::init("-"));
41+
cl::init("-"),
42+
cl::cat(CFIVerifyCategory));
4043
cl::opt<bool> PrintGraphs(
4144
"print-graphs",
4245
cl::desc("Print graphs around indirect CF instructions in DOT format."),
43-
cl::init(false));
46+
cl::init(false), cl::cat(CFIVerifyCategory));
4447
cl::opt<unsigned> PrintBlameContext(
4548
"blame-context",
4649
cl::desc("Print the blame context (if possible) for BAD instructions. This "
4750
"specifies the number of lines of context to include, where zero "
4851
"disables this feature."),
49-
cl::init(0));
52+
cl::init(0), cl::cat(CFIVerifyCategory));
5053
cl::opt<unsigned> PrintBlameContextAll(
5154
"blame-context-all",
5255
cl::desc("Prints the blame context (if possible) for ALL instructions. "
5356
"This specifies the number of lines of context for non-BAD "
5457
"instructions (see --blame-context). If --blame-context is "
5558
"unspecified, it prints this number of contextual lines for BAD "
5659
"instructions as well."),
57-
cl::init(0));
60+
cl::init(0), cl::cat(CFIVerifyCategory));
5861
cl::opt<bool> Summarize("summarize", cl::desc("Print the summary only."),
59-
cl::init(false));
62+
cl::init(false), cl::cat(CFIVerifyCategory));
6063

6164
ExitOnError ExitOnErr;
6265

@@ -245,6 +248,7 @@ printIndirectCFInstructions(FileAnalysis &Analysis,
245248
}
246249

247250
int main(int argc, char **argv) {
251+
cl::HideUnrelatedOptions({&CFIVerifyCategory, &ColorCategory});
248252
cl::ParseCommandLineOptions(
249253
argc, argv,
250254
"Identifies whether Control Flow Integrity protects all indirect control "

0 commit comments

Comments
 (0)