From 69a56845317b340e01e75d0cff8fb2f90f6fe1d2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timm=20B=C3=A4der?= Date: Fri, 16 Jul 2021 10:17:41 +0200 Subject: [PATCH] [llvm][tools] Hide unrelated llvm-cfi-verify options Differential Revision: https://reviews.llvm.org/D106055 --- llvm/test/tools/llvm-cfi-verify/help.test | 7 +++++++ llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp | 16 ++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 llvm/test/tools/llvm-cfi-verify/help.test 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 0000000..f14c5f2 --- /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 1331442b..3cb0e84 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 InputFilename(cl::Positional, cl::desc(""), - cl::Required); + cl::Required, cl::cat(CFIVerifyCategory)); cl::opt BlacklistFilename(cl::Positional, cl::desc("[blacklist file]"), - cl::init("-")); + cl::init("-"), + cl::cat(CFIVerifyCategory)); cl::opt 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 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 PrintBlameContextAll( "blame-context-all", cl::desc("Prints the blame context (if possible) for ALL instructions. " @@ -54,9 +57,9 @@ cl::opt 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 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, &getColorCategory()}); cl::ParseCommandLineOptions( argc, argv, "Identifies whether Control Flow Integrity protects all indirect control " -- 2.7.4