[llvm] d16f154 - [llvm][tools] Hide more unrelated LLVM tool options
Timm Bäder via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 21 00:19:21 PDT 2021
Author: Timm Bäder
Date: 2021-07-21T09:14:04+02:00
New Revision: d16f15424007f730c0b5f5d6b31bb023bec3c919
URL: https://github.com/llvm/llvm-project/commit/d16f15424007f730c0b5f5d6b31bb023bec3c919
DIFF: https://github.com/llvm/llvm-project/commit/d16f15424007f730c0b5f5d6b31bb023bec3c919.diff
LOG: [llvm][tools] Hide more unrelated LLVM tool options
Differential Revision: https://reviews.llvm.org/D106366
Added:
llvm/test/tools/llvm-jitlink/help.test
llvm/test/tools/llvm-link/help.test
llvm/test/tools/llvm-lto/help.test
llvm/test/tools/llvm-mc/help.test
llvm/test/tools/llvm-modextract/help.test
llvm/test/tools/llvm-pdbutil/help.test
llvm/test/tools/llvm-profgen/help.test
Modified:
llvm/tools/llvm-jitlink/llvm-jitlink.cpp
llvm/tools/llvm-link/llvm-link.cpp
llvm/tools/llvm-lto/llvm-lto.cpp
llvm/tools/llvm-mc/llvm-mc.cpp
llvm/tools/llvm-modextract/llvm-modextract.cpp
llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
llvm/tools/llvm-profgen/llvm-profgen.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-jitlink/help.test b/llvm/test/tools/llvm-jitlink/help.test
new file mode 100644
index 0000000000000..9eb889b7ee2f0
--- /dev/null
+++ b/llvm/test/tools/llvm-jitlink/help.test
@@ -0,0 +1,7 @@
+# RUN: llvm-jitlink --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:'
+
+# HELP: OVERVIEW: llvm jitlink tool
+# HELP: USAGE
+# HELP: Color Options
+# HELP: Generic Options
+# HELP: JITLink Options
diff --git a/llvm/test/tools/llvm-link/help.test b/llvm/test/tools/llvm-link/help.test
new file mode 100644
index 0000000000000..356986a45918e
--- /dev/null
+++ b/llvm/test/tools/llvm-link/help.test
@@ -0,0 +1,7 @@
+# RUN: llvm-link --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:'
+
+# HELP: OVERVIEW: llvm linker
+# HELP: USAGE
+# HELP: Color Options
+# HELP: Generic Options
+# HELP: Link Options
diff --git a/llvm/test/tools/llvm-lto/help.test b/llvm/test/tools/llvm-lto/help.test
new file mode 100644
index 0000000000000..08f06c850b17c
--- /dev/null
+++ b/llvm/test/tools/llvm-lto/help.test
@@ -0,0 +1,7 @@
+# RUN: llvm-lto --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:'
+
+# HELP: OVERVIEW: llvm LTO linker
+# HELP: USAGE
+# HELP: Color Options
+# HELP: Generic Options
+# HELP: LTO Options
diff --git a/llvm/test/tools/llvm-mc/help.test b/llvm/test/tools/llvm-mc/help.test
new file mode 100644
index 0000000000000..62cbdea111590
--- /dev/null
+++ b/llvm/test/tools/llvm-mc/help.test
@@ -0,0 +1,7 @@
+# RUN: llvm-mc --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:'
+
+# HELP: OVERVIEW: llvm machine code playground
+# HELP: USAGE
+# HELP: Color Options
+# HELP: Generic Options
+# HELP: MC Options
diff --git a/llvm/test/tools/llvm-modextract/help.test b/llvm/test/tools/llvm-modextract/help.test
new file mode 100644
index 0000000000000..8865944be23cc
--- /dev/null
+++ b/llvm/test/tools/llvm-modextract/help.test
@@ -0,0 +1,7 @@
+# RUN: llvm-modextract --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:'
+
+# HELP: OVERVIEW: Module extractor
+# HELP: USAGE
+# HELP: Color Options
+# HELP: Generic Options
+# HELP: Modextract Options
diff --git a/llvm/test/tools/llvm-pdbutil/help.test b/llvm/test/tools/llvm-pdbutil/help.test
new file mode 100644
index 0000000000000..e175488ee6eba
--- /dev/null
+++ b/llvm/test/tools/llvm-pdbutil/help.test
@@ -0,0 +1,20 @@
+# RUN: llvm-pdbutil --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:'
+
+# HELP: OVERVIEW: LLVM PDB Dumper
+# HELP: USAGE
+# HELP: SUBCOMMANDS
+# HELP: Generic Options
+
+
+# RUN: llvm-pdbutil bytes --help | FileCheck %s --check-prefix BYTES --implicit-check-not='{{[Oo]}}ptions:'
+
+
+# BYTES: OVERVIEW: LLVM PDB Dumper
+# BYTES: SUBCOMMAND 'bytes'
+# BYTES: USAGE
+# BYTES: Dbi Stream Options
+# BYTES: Generic Options
+# BYTES: MSF File Options
+# BYTES: Module Options
+# BYTES: PDB Stream Options
+# BYTES: Symbol Type Options
diff --git a/llvm/test/tools/llvm-profgen/help.test b/llvm/test/tools/llvm-profgen/help.test
new file mode 100644
index 0000000000000..b2ffb58874187
--- /dev/null
+++ b/llvm/test/tools/llvm-profgen/help.test
@@ -0,0 +1,7 @@
+# RUN: llvm-profgen --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:'
+
+# HELP: OVERVIEW: llvm SPGO profile generator
+# HELP: USAGE
+# HELP: Color Options
+# HELP: Generic Options
+# HELP: ProfGen Options
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index 301fecb94acb2..645d5aa574555 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -61,113 +61,121 @@ using namespace llvm;
using namespace llvm::jitlink;
using namespace llvm::orc;
+static cl::OptionCategory JITLinkCategory("JITLink Options");
+
static cl::list<std::string> InputFiles(cl::Positional, cl::OneOrMore,
- cl::desc("input files"));
+ cl::desc("input files"),
+ cl::cat(JITLinkCategory));
static cl::opt<bool> NoExec("noexec", cl::desc("Do not execute loaded code"),
- cl::init(false));
+ cl::init(false), cl::cat(JITLinkCategory));
static cl::list<std::string>
CheckFiles("check", cl::desc("File containing verifier checks"),
- cl::ZeroOrMore);
+ cl::ZeroOrMore, cl::cat(JITLinkCategory));
static cl::opt<std::string>
CheckName("check-name", cl::desc("Name of checks to match against"),
- cl::init("jitlink-check"));
+ cl::init("jitlink-check"), cl::cat(JITLinkCategory));
static cl::opt<std::string>
EntryPointName("entry", cl::desc("Symbol to call as main entry point"),
- cl::init(""));
+ cl::init(""), cl::cat(JITLinkCategory));
static cl::list<std::string> JITLinkDylibs(
- "jld", cl::desc("Specifies the JITDylib to be used for any subsequent "
- "input file arguments"));
+ "jld",
+ cl::desc("Specifies the JITDylib to be used for any subsequent "
+ "input file arguments"),
+ cl::cat(JITLinkCategory));
static cl::list<std::string>
Dylibs("dlopen", cl::desc("Dynamic libraries to load before linking"),
- cl::ZeroOrMore);
+ cl::ZeroOrMore, cl::cat(JITLinkCategory));
static cl::list<std::string> InputArgv("args", cl::Positional,
cl::desc("<program arguments>..."),
- cl::ZeroOrMore, cl::PositionalEatsArgs);
+ cl::ZeroOrMore, cl::PositionalEatsArgs,
+ cl::cat(JITLinkCategory));
static cl::opt<bool>
NoProcessSymbols("no-process-syms",
cl::desc("Do not resolve to llvm-jitlink process symbols"),
- cl::init(false));
+ cl::init(false), cl::cat(JITLinkCategory));
static cl::list<std::string> AbsoluteDefs(
"define-abs",
cl::desc("Inject absolute symbol definitions (syntax: <name>=<addr>)"),
- cl::ZeroOrMore);
+ cl::ZeroOrMore, cl::cat(JITLinkCategory));
static cl::list<std::string> TestHarnesses("harness", cl::Positional,
cl::desc("Test harness files"),
cl::ZeroOrMore,
- cl::PositionalEatsArgs);
+ cl::PositionalEatsArgs,
+ cl::cat(JITLinkCategory));
static cl::opt<bool> ShowInitialExecutionSessionState(
"show-init-es",
cl::desc("Print ExecutionSession state before resolving entry point"),
- cl::init(false));
+ cl::init(false), cl::cat(JITLinkCategory));
static cl::opt<bool> ShowAddrs(
"show-addrs",
cl::desc("Print registered symbol, section, got and stub addresses"),
- cl::init(false));
+ cl::init(false), cl::cat(JITLinkCategory));
static cl::opt<bool> ShowLinkGraph(
"show-graph",
cl::desc("Print the link graph after fixups have been applied"),
- cl::init(false));
+ cl::init(false), cl::cat(JITLinkCategory));
static cl::opt<bool> ShowSizes(
"show-sizes",
cl::desc("Show sizes pre- and post-dead stripping, and allocations"),
- cl::init(false));
+ cl::init(false), cl::cat(JITLinkCategory));
static cl::opt<bool> ShowTimes("show-times",
cl::desc("Show times for llvm-jitlink phases"),
- cl::init(false));
+ cl::init(false), cl::cat(JITLinkCategory));
static cl::opt<std::string> SlabAllocateSizeString(
"slab-allocate",
cl::desc("Allocate from a slab of the given size "
"(allowable suffixes: Kb, Mb, Gb. default = "
"Kb)"),
- cl::init(""));
+ cl::init(""), cl::cat(JITLinkCategory));
static cl::opt<uint64_t> SlabAddress(
"slab-address",
cl::desc("Set slab target address (requires -slab-allocate and -noexec)"),
- cl::init(~0ULL));
+ cl::init(~0ULL), cl::cat(JITLinkCategory));
static cl::opt<bool> ShowRelocatedSectionContents(
"show-relocated-section-contents",
cl::desc("show section contents after fixups have been applied"),
- cl::init(false));
+ cl::init(false), cl::cat(JITLinkCategory));
static cl::opt<bool> PhonyExternals(
"phony-externals",
cl::desc("resolve all otherwise unresolved externals to null"),
- cl::init(false));
+ cl::init(false), cl::cat(JITLinkCategory));
static cl::opt<std::string> OutOfProcessExecutor(
"oop-executor", cl::desc("Launch an out-of-process executor to run code"),
- cl::ValueOptional);
+ cl::ValueOptional, cl::cat(JITLinkCategory));
static cl::opt<std::string> OutOfProcessExecutorConnect(
"oop-executor-connect",
- cl::desc("Connect to an out-of-process executor via TCP"));
+ cl::desc("Connect to an out-of-process executor via TCP"),
+ cl::cat(JITLinkCategory));
// TODO: Default to false if compiler-rt is not built.
static cl::opt<bool> UseOrcRuntime("use-orc-runtime",
cl::desc("Do not required/load ORC runtime"),
- cl::init(true));
+ cl::init(true), cl::cat(JITLinkCategory));
static cl::opt<std::string>
OrcRuntimePath("orc-runtime-path", cl::desc("Add orc runtime to session"),
- cl::init(""));
+ cl::init(""), cl::cat(JITLinkCategory));
ExitOnError ExitOnErr;
@@ -1453,6 +1461,7 @@ int main(int argc, char *argv[]) {
InitializeAllTargetMCs();
InitializeAllDisassemblers();
+ cl::HideUnrelatedOptions({&JITLinkCategory, &getColorCategory()});
cl::ParseCommandLineOptions(argc, argv, "llvm jitlink tool");
ExitOnErr.setBanner(std::string(argv[0]) + ": ");
diff --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp
index 871b7265e32f9..9abe8efaa4e88 100644
--- a/llvm/tools/llvm-link/llvm-link.cpp
+++ b/llvm/tools/llvm-link/llvm-link.cpp
@@ -41,20 +41,25 @@
#include <utility>
using namespace llvm;
+static cl::OptionCategory LinkCategory("Link Options");
+
static cl::list<std::string> InputFilenames(cl::Positional, cl::OneOrMore,
- cl::desc("<input bitcode files>"));
+ cl::desc("<input bitcode files>"),
+ cl::cat(LinkCategory));
static cl::list<std::string> OverridingInputs(
"override", cl::ZeroOrMore, cl::value_desc("filename"),
cl::desc(
- "input bitcode file which can override previously defined symbol(s)"));
+ "input bitcode file which can override previously defined symbol(s)"),
+ cl::cat(LinkCategory));
// Option to simulate function importing for testing. This enables using
// llvm-link to simulate ThinLTO backend processes.
static cl::list<std::string> Imports(
"import", cl::ZeroOrMore, cl::value_desc("function:filename"),
cl::desc("Pair of function name and filename, where function should be "
- "imported from bitcode in filename"));
+ "imported from bitcode in filename"),
+ cl::cat(LinkCategory));
// Option to support testing of function importing. The module summary
// must be specified in the case were we request imports via the -import
@@ -63,53 +68,61 @@ static cl::list<std::string> Imports(
// consistent promotion and renaming of locals.
static cl::opt<std::string>
SummaryIndex("summary-index", cl::desc("Module summary index filename"),
- cl::init(""), cl::value_desc("filename"));
+ cl::init(""), cl::value_desc("filename"),
+ cl::cat(LinkCategory));
-static cl::opt<std::string> OutputFilename("o",
- cl::desc("Override output filename"),
- cl::init("-"),
- cl::value_desc("filename"));
+static cl::opt<std::string>
+ OutputFilename("o", cl::desc("Override output filename"), cl::init("-"),
+ cl::value_desc("filename"), cl::cat(LinkCategory));
static cl::opt<bool> Internalize("internalize",
- cl::desc("Internalize linked symbols"));
+ cl::desc("Internalize linked symbols"),
+ cl::cat(LinkCategory));
static cl::opt<bool>
DisableDITypeMap("disable-debug-info-type-map",
- cl::desc("Don't use a uniquing type map for debug info"));
+ cl::desc("Don't use a uniquing type map for debug info"),
+ cl::cat(LinkCategory));
static cl::opt<bool> OnlyNeeded("only-needed",
- cl::desc("Link only needed symbols"));
+ cl::desc("Link only needed symbols"),
+ cl::cat(LinkCategory));
-static cl::opt<bool> Force("f", cl::desc("Enable binary output on terminals"));
+static cl::opt<bool> Force("f", cl::desc("Enable binary output on terminals"),
+ cl::cat(LinkCategory));
static cl::opt<bool> DisableLazyLoad("disable-lazy-loading",
- cl::desc("Disable lazy module loading"));
+ cl::desc("Disable lazy module loading"),
+ cl::cat(LinkCategory));
-static cl::opt<bool>
- OutputAssembly("S", cl::desc("Write output as LLVM assembly"), cl::Hidden);
+static cl::opt<bool> OutputAssembly("S",
+ cl::desc("Write output as LLVM assembly"),
+ cl::Hidden, cl::cat(LinkCategory));
static cl::opt<bool> Verbose("v",
- cl::desc("Print information about actions taken"));
+ cl::desc("Print information about actions taken"),
+ cl::cat(LinkCategory));
static cl::opt<bool> DumpAsm("d", cl::desc("Print assembly as linked"),
- cl::Hidden);
+ cl::Hidden, cl::cat(LinkCategory));
static cl::opt<bool> SuppressWarnings("suppress-warnings",
cl::desc("Suppress all linking warnings"),
- cl::init(false));
+ cl::init(false), cl::cat(LinkCategory));
static cl::opt<bool> PreserveBitcodeUseListOrder(
"preserve-bc-uselistorder",
cl::desc("Preserve use-list order when writing LLVM bitcode."),
- cl::init(true), cl::Hidden);
+ cl::init(true), cl::Hidden, cl::cat(LinkCategory));
static cl::opt<bool> PreserveAssemblyUseListOrder(
"preserve-ll-uselistorder",
cl::desc("Preserve use-list order when writing LLVM assembly."),
- cl::init(false), cl::Hidden);
+ cl::init(false), cl::Hidden, cl::cat(LinkCategory));
static cl::opt<bool> NoVerify("disable-verify",
- cl::desc("Do not run the verifier"), cl::Hidden);
+ cl::desc("Do not run the verifier"), cl::Hidden,
+ cl::cat(LinkCategory));
static ExitOnError ExitOnErr;
@@ -434,6 +447,7 @@ int main(int argc, char **argv) {
LLVMContext Context;
Context.setDiagnosticHandler(std::make_unique<LLVMLinkDiagnosticHandler>(),
true);
+ cl::HideUnrelatedOptions({&LinkCategory, &getColorCategory()});
cl::ParseCommandLineOptions(argc, argv, "llvm linker\n");
if (!DisableDITypeMap)
diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp
index c58f5c763cc7b..45bfa84fb826d 100644
--- a/llvm/tools/llvm-lto/llvm-lto.cpp
+++ b/llvm/tools/llvm-lto/llvm-lto.cpp
@@ -64,31 +64,38 @@ using namespace llvm;
static codegen::RegisterCodeGenFlags CGF;
+static cl::OptionCategory LTOCategory("LTO Options");
+
static cl::opt<char>
- OptLevel("O", cl::desc("Optimization level. [-O0, -O1, -O2, or -O3] "
- "(default = '-O2')"),
- cl::Prefix, cl::ZeroOrMore, cl::init('2'));
+ OptLevel("O",
+ cl::desc("Optimization level. [-O0, -O1, -O2, or -O3] "
+ "(default = '-O2')"),
+ cl::Prefix, cl::ZeroOrMore, cl::init('2'), cl::cat(LTOCategory));
static cl::opt<bool>
IndexStats("thinlto-index-stats",
cl::desc("Print statistic for the index in every input files"),
- cl::init(false));
+ cl::init(false), cl::cat(LTOCategory));
static cl::opt<bool> DisableVerify(
"disable-verify", cl::init(false),
- cl::desc("Do not run the verifier during the optimization pipeline"));
+ cl::desc("Do not run the verifier during the optimization pipeline"),
+ cl::cat(LTOCategory));
static cl::opt<bool> EnableFreestanding(
"lto-freestanding", cl::init(false),
- cl::desc("Enable Freestanding (disable builtins / TLI) during LTO"));
+ cl::desc("Enable Freestanding (disable builtins / TLI) during LTO"),
+ cl::cat(LTOCategory));
static cl::opt<bool> UseDiagnosticHandler(
"use-diagnostic-handler", cl::init(false),
- cl::desc("Use a diagnostic handler to test the handler interface"));
+ cl::desc("Use a diagnostic handler to test the handler interface"),
+ cl::cat(LTOCategory));
static cl::opt<bool>
ThinLTO("thinlto", cl::init(false),
- cl::desc("Only write combined global index for ThinLTO backends"));
+ cl::desc("Only write combined global index for ThinLTO backends"),
+ cl::cat(LTOCategory));
enum ThinLTOModes {
THINLINK,
@@ -114,122 +121,144 @@ cl::opt<ThinLTOModes> ThinLTOMode(
"Emit imports files for distributed backends."),
clEnumValN(THINPROMOTE, "promote",
"Perform pre-import promotion (requires -thinlto-index)."),
- clEnumValN(THINIMPORT, "import", "Perform both promotion and "
- "cross-module importing (requires "
- "-thinlto-index)."),
+ clEnumValN(THINIMPORT, "import",
+ "Perform both promotion and "
+ "cross-module importing (requires "
+ "-thinlto-index)."),
clEnumValN(THININTERNALIZE, "internalize",
"Perform internalization driven by -exported-symbol "
"(requires -thinlto-index)."),
clEnumValN(THINOPT, "optimize", "Perform ThinLTO optimizations."),
clEnumValN(THINCODEGEN, "codegen", "CodeGen (expected to match llc)"),
- clEnumValN(THINALL, "run", "Perform ThinLTO end-to-end")));
+ clEnumValN(THINALL, "run", "Perform ThinLTO end-to-end")),
+ cl::cat(LTOCategory));
static cl::opt<std::string>
ThinLTOIndex("thinlto-index",
cl::desc("Provide the index produced by a ThinLink, required "
- "to perform the promotion and/or importing."));
+ "to perform the promotion and/or importing."),
+ cl::cat(LTOCategory));
static cl::opt<std::string> ThinLTOPrefixReplace(
"thinlto-prefix-replace",
cl::desc("Control where files for distributed backends are "
"created. Expects 'oldprefix;newprefix' and if path "
"prefix of output file is oldprefix it will be "
- "replaced with newprefix."));
+ "replaced with newprefix."),
+ cl::cat(LTOCategory));
static cl::opt<std::string> ThinLTOModuleId(
"thinlto-module-id",
cl::desc("For the module ID for the file to process, useful to "
- "match what is in the index."));
+ "match what is in the index."),
+ cl::cat(LTOCategory));
-static cl::opt<std::string>
- ThinLTOCacheDir("thinlto-cache-dir", cl::desc("Enable ThinLTO caching."));
+static cl::opt<std::string> ThinLTOCacheDir("thinlto-cache-dir",
+ cl::desc("Enable ThinLTO caching."),
+ cl::cat(LTOCategory));
-static cl::opt<int>
- ThinLTOCachePruningInterval("thinlto-cache-pruning-interval",
- cl::init(1200), cl::desc("Set ThinLTO cache pruning interval."));
+static cl::opt<int> ThinLTOCachePruningInterval(
+ "thinlto-cache-pruning-interval", cl::init(1200),
+ cl::desc("Set ThinLTO cache pruning interval."), cl::cat(LTOCategory));
static cl::opt<uint64_t> ThinLTOCacheMaxSizeBytes(
"thinlto-cache-max-size-bytes",
- cl::desc("Set ThinLTO cache pruning directory maximum size in bytes."));
+ cl::desc("Set ThinLTO cache pruning directory maximum size in bytes."),
+ cl::cat(LTOCategory));
-static cl::opt<int>
- ThinLTOCacheMaxSizeFiles("thinlto-cache-max-size-files", cl::init(1000000),
- cl::desc("Set ThinLTO cache pruning directory maximum number of files."));
+static cl::opt<int> ThinLTOCacheMaxSizeFiles(
+ "thinlto-cache-max-size-files", cl::init(1000000),
+ cl::desc("Set ThinLTO cache pruning directory maximum number of files."),
+ cl::cat(LTOCategory));
-static cl::opt<unsigned>
- ThinLTOCacheEntryExpiration("thinlto-cache-entry-expiration", cl::init(604800) /* 1w */,
- cl::desc("Set ThinLTO cache entry expiration time."));
+static cl::opt<unsigned> ThinLTOCacheEntryExpiration(
+ "thinlto-cache-entry-expiration", cl::init(604800) /* 1w */,
+ cl::desc("Set ThinLTO cache entry expiration time."), cl::cat(LTOCategory));
static cl::opt<std::string> ThinLTOSaveTempsPrefix(
"thinlto-save-temps",
cl::desc("Save ThinLTO temp files using filenames created by adding "
- "suffixes to the given file path prefix."));
+ "suffixes to the given file path prefix."),
+ cl::cat(LTOCategory));
static cl::opt<std::string> ThinLTOGeneratedObjectsDir(
"thinlto-save-objects",
cl::desc("Save ThinLTO generated object files using filenames created in "
- "the given directory."));
+ "the given directory."),
+ cl::cat(LTOCategory));
static cl::opt<bool> SaveLinkedModuleFile(
"save-linked-module", cl::init(false),
- cl::desc("Write linked LTO module to file before optimize"));
+ cl::desc("Write linked LTO module to file before optimize"),
+ cl::cat(LTOCategory));
static cl::opt<bool>
SaveModuleFile("save-merged-module", cl::init(false),
- cl::desc("Write merged LTO module to file before CodeGen"));
+ cl::desc("Write merged LTO module to file before CodeGen"),
+ cl::cat(LTOCategory));
static cl::list<std::string> InputFilenames(cl::Positional, cl::OneOrMore,
- cl::desc("<input bitcode files>"));
+ cl::desc("<input bitcode files>"),
+ cl::cat(LTOCategory));
static cl::opt<std::string> OutputFilename("o", cl::init(""),
cl::desc("Override output filename"),
- cl::value_desc("filename"));
+ cl::value_desc("filename"),
+ cl::cat(LTOCategory));
static cl::list<std::string> ExportedSymbols(
"exported-symbol",
cl::desc("List of symbols to export from the resulting object file"),
- cl::ZeroOrMore);
+ cl::ZeroOrMore, cl::cat(LTOCategory));
static cl::list<std::string>
DSOSymbols("dso-symbol",
cl::desc("Symbol to put in the symtab in the resulting dso"),
- cl::ZeroOrMore);
+ cl::ZeroOrMore, cl::cat(LTOCategory));
static cl::opt<bool> ListSymbolsOnly(
"list-symbols-only", cl::init(false),
- cl::desc("Instead of running LTO, list the symbols in each IR file"));
+ cl::desc("Instead of running LTO, list the symbols in each IR file"),
+ cl::cat(LTOCategory));
static cl::opt<bool> ListDependentLibrariesOnly(
"list-dependent-libraries-only", cl::init(false),
- cl::desc("Instead of running LTO, list the dependent libraries in each IR file"));
+ cl::desc(
+ "Instead of running LTO, list the dependent libraries in each IR file"),
+ cl::cat(LTOCategory));
-static cl::opt<bool> SetMergedModule(
- "set-merged-module", cl::init(false),
- cl::desc("Use the first input module as the merged module"));
+static cl::opt<bool>
+ SetMergedModule("set-merged-module", cl::init(false),
+ cl::desc("Use the first input module as the merged module"),
+ cl::cat(LTOCategory));
static cl::opt<unsigned> Parallelism("j", cl::Prefix, cl::init(1),
- cl::desc("Number of backend threads"));
+ cl::desc("Number of backend threads"),
+ cl::cat(LTOCategory));
static cl::opt<bool> RestoreGlobalsLinkage(
"restore-linkage", cl::init(false),
- cl::desc("Restore original linkage of globals prior to CodeGen"));
+ cl::desc("Restore original linkage of globals prior to CodeGen"),
+ cl::cat(LTOCategory));
static cl::opt<bool> CheckHasObjC(
"check-for-objc", cl::init(false),
- cl::desc("Only check if the module has objective-C defined in it"));
+ cl::desc("Only check if the module has objective-C defined in it"),
+ cl::cat(LTOCategory));
static cl::opt<bool> PrintMachOCPUOnly(
"print-macho-cpu-only", cl::init(false),
- cl::desc("Instead of running LTO, print the mach-o cpu in each IR file"));
+ cl::desc("Instead of running LTO, print the mach-o cpu in each IR file"),
+ cl::cat(LTOCategory));
-static cl::opt<bool>
- UseNewPM("use-new-pm",
- cl::desc("Run LTO passes using the new pass manager"),
- cl::init(LLVM_ENABLE_NEW_PASS_MANAGER), cl::Hidden);
+static cl::opt<bool> UseNewPM(
+ "use-new-pm", cl::desc("Run LTO passes using the new pass manager"),
+ cl::init(LLVM_ENABLE_NEW_PASS_MANAGER), cl::Hidden, cl::cat(LTOCategory));
static cl::opt<bool>
DebugPassManager("debug-pass-manager", cl::init(false), cl::Hidden,
- cl::desc("Print pass management debugging information"));
+ cl::desc("Print pass management debugging information"),
+ cl::cat(LTOCategory));
namespace {
@@ -895,6 +924,7 @@ class ThinLTOProcessing {
int main(int argc, char **argv) {
InitLLVM X(argc, argv);
+ cl::HideUnrelatedOptions({<OCategory, &getColorCategory()});
cl::ParseCommandLineOptions(argc, argv, "llvm LTO linker\n");
if (OptLevel < '0' || OptLevel > '3')
diff --git a/llvm/tools/llvm-mc/llvm-mc.cpp b/llvm/tools/llvm-mc/llvm-mc.cpp
index 71940a7d0ae5a..24c601b7033f8 100644
--- a/llvm/tools/llvm-mc/llvm-mc.cpp
+++ b/llvm/tools/llvm-mc/llvm-mc.cpp
@@ -43,26 +43,33 @@ using namespace llvm;
static mc::RegisterMCTargetOptionsFlags MOF;
-static cl::opt<std::string>
-InputFilename(cl::Positional, cl::desc("<input file>"), cl::init("-"));
+static cl::OptionCategory MCCategory("MC Options");
+
+static cl::opt<std::string> InputFilename(cl::Positional,
+ cl::desc("<input file>"),
+ cl::init("-"), cl::cat(MCCategory));
static cl::list<std::string>
- DisassemblerOptions("M", cl::desc("Disassembler options"));
+ DisassemblerOptions("M", cl::desc("Disassembler options"),
+ cl::cat(MCCategory));
static cl::opt<std::string> OutputFilename("o", cl::desc("Output filename"),
cl::value_desc("filename"),
- cl::init("-"));
+ cl::init("-"), cl::cat(MCCategory));
static cl::opt<std::string> SplitDwarfFile("split-dwarf-file",
cl::desc("DWO output filename"),
- cl::value_desc("filename"));
+ cl::value_desc("filename"),
+ cl::cat(MCCategory));
-static cl::opt<bool>
-ShowEncoding("show-encoding", cl::desc("Show instruction encodings"));
+static cl::opt<bool> ShowEncoding("show-encoding",
+ cl::desc("Show instruction encodings"),
+ cl::cat(MCCategory));
static cl::opt<bool> RelaxELFRel(
"relax-relocations", cl::init(true),
- cl::desc("Emit R_X86_64_GOTPCRELX instead of R_X86_64_GOTPCREL"));
+ cl::desc("Emit R_X86_64_GOTPCRELX instead of R_X86_64_GOTPCREL"),
+ cl::cat(MCCategory));
static cl::opt<DebugCompressionType> CompressDebugSections(
"compress-debug-sections", cl::ValueOptional,
@@ -72,29 +79,37 @@ static cl::opt<DebugCompressionType> CompressDebugSections(
clEnumValN(DebugCompressionType::Z, "zlib",
"Use zlib compression"),
clEnumValN(DebugCompressionType::GNU, "zlib-gnu",
- "Use zlib-gnu compression (deprecated)")));
+ "Use zlib-gnu compression (deprecated)")),
+ cl::cat(MCCategory));
static cl::opt<bool>
-ShowInst("show-inst", cl::desc("Show internal instruction representation"));
+ ShowInst("show-inst", cl::desc("Show internal instruction representation"),
+ cl::cat(MCCategory));
static cl::opt<bool>
-ShowInstOperands("show-inst-operands",
- cl::desc("Show instructions operands as parsed"));
+ ShowInstOperands("show-inst-operands",
+ cl::desc("Show instructions operands as parsed"),
+ cl::cat(MCCategory));
static cl::opt<unsigned>
-OutputAsmVariant("output-asm-variant",
- cl::desc("Syntax variant to use for output printing"));
+ OutputAsmVariant("output-asm-variant",
+ cl::desc("Syntax variant to use for output printing"),
+ cl::cat(MCCategory));
static cl::opt<bool>
-PrintImmHex("print-imm-hex", cl::init(false),
- cl::desc("Prefer hex format for immediate values"));
+ PrintImmHex("print-imm-hex", cl::init(false),
+ cl::desc("Prefer hex format for immediate values"),
+ cl::cat(MCCategory));
static cl::list<std::string>
-DefineSymbol("defsym", cl::desc("Defines a symbol to be an integer constant"));
+ DefineSymbol("defsym",
+ cl::desc("Defines a symbol to be an integer constant"),
+ cl::cat(MCCategory));
static cl::opt<bool>
PreserveComments("preserve-comments",
- cl::desc("Preserve Comments in outputted assembly"));
+ cl::desc("Preserve Comments in outputted assembly"),
+ cl::cat(MCCategory));
enum OutputFileType {
OFT_Null,
@@ -102,86 +117,101 @@ enum OutputFileType {
OFT_ObjectFile
};
static cl::opt<OutputFileType>
-FileType("filetype", cl::init(OFT_AssemblyFile),
- cl::desc("Choose an output file type:"),
- cl::values(
- clEnumValN(OFT_AssemblyFile, "asm",
- "Emit an assembly ('.s') file"),
- clEnumValN(OFT_Null, "null",
- "Don't emit anything (for timing purposes)"),
- clEnumValN(OFT_ObjectFile, "obj",
- "Emit a native object ('.o') file")));
-
-static cl::list<std::string>
-IncludeDirs("I", cl::desc("Directory of include files"),
- cl::value_desc("directory"), cl::Prefix);
+ FileType("filetype", cl::init(OFT_AssemblyFile),
+ cl::desc("Choose an output file type:"),
+ cl::values(clEnumValN(OFT_AssemblyFile, "asm",
+ "Emit an assembly ('.s') file"),
+ clEnumValN(OFT_Null, "null",
+ "Don't emit anything (for timing purposes)"),
+ clEnumValN(OFT_ObjectFile, "obj",
+ "Emit a native object ('.o') file")),
+ cl::cat(MCCategory));
+
+static cl::list<std::string> IncludeDirs("I",
+ cl::desc("Directory of include files"),
+ cl::value_desc("directory"),
+ cl::Prefix, cl::cat(MCCategory));
static cl::opt<std::string>
-ArchName("arch", cl::desc("Target arch to assemble for, "
- "see -version for available targets"));
+ ArchName("arch",
+ cl::desc("Target arch to assemble for, "
+ "see -version for available targets"),
+ cl::cat(MCCategory));
static cl::opt<std::string>
-TripleName("triple", cl::desc("Target triple to assemble for, "
- "see -version for available targets"));
+ TripleName("triple",
+ cl::desc("Target triple to assemble for, "
+ "see -version for available targets"),
+ cl::cat(MCCategory));
static cl::opt<std::string>
-MCPU("mcpu",
- cl::desc("Target a specific cpu type (-mcpu=help for details)"),
- cl::value_desc("cpu-name"),
- cl::init(""));
+ MCPU("mcpu",
+ cl::desc("Target a specific cpu type (-mcpu=help for details)"),
+ cl::value_desc("cpu-name"), cl::init(""), cl::cat(MCCategory));
static cl::list<std::string>
-MAttrs("mattr",
- cl::CommaSeparated,
- cl::desc("Target specific attributes (-mattr=help for details)"),
- cl::value_desc("a1,+a2,-a3,..."));
+ MAttrs("mattr", cl::CommaSeparated,
+ cl::desc("Target specific attributes (-mattr=help for details)"),
+ cl::value_desc("a1,+a2,-a3,..."), cl::cat(MCCategory));
static cl::opt<bool> PIC("position-independent",
- cl::desc("Position independent"), cl::init(false));
+ cl::desc("Position independent"), cl::init(false),
+ cl::cat(MCCategory));
static cl::opt<bool>
LargeCodeModel("large-code-model",
cl::desc("Create cfi directives that assume the code might "
- "be more than 2gb away"));
+ "be more than 2gb away"),
+ cl::cat(MCCategory));
static cl::opt<bool>
-NoInitialTextSection("n", cl::desc("Don't assume assembly file starts "
- "in the text section"));
+ NoInitialTextSection("n",
+ cl::desc("Don't assume assembly file starts "
+ "in the text section"),
+ cl::cat(MCCategory));
static cl::opt<bool>
-GenDwarfForAssembly("g", cl::desc("Generate dwarf debugging info for assembly "
- "source files"));
+ GenDwarfForAssembly("g",
+ cl::desc("Generate dwarf debugging info for assembly "
+ "source files"),
+ cl::cat(MCCategory));
static cl::opt<std::string>
-DebugCompilationDir("fdebug-compilation-dir",
- cl::desc("Specifies the debug info's compilation dir"));
+ DebugCompilationDir("fdebug-compilation-dir",
+ cl::desc("Specifies the debug info's compilation dir"),
+ cl::cat(MCCategory));
-static cl::list<std::string>
-DebugPrefixMap("fdebug-prefix-map",
- cl::desc("Map file source paths in debug info"),
- cl::value_desc("= separated key-value pairs"));
+static cl::list<std::string> DebugPrefixMap(
+ "fdebug-prefix-map", cl::desc("Map file source paths in debug info"),
+ cl::value_desc("= separated key-value pairs"), cl::cat(MCCategory));
-static cl::opt<std::string>
-MainFileName("main-file-name",
- cl::desc("Specifies the name we should consider the input file"));
+static cl::opt<std::string> MainFileName(
+ "main-file-name",
+ cl::desc("Specifies the name we should consider the input file"),
+ cl::cat(MCCategory));
static cl::opt<bool> SaveTempLabels("save-temp-labels",
- cl::desc("Don't discard temporary labels"));
+ cl::desc("Don't discard temporary labels"),
+ cl::cat(MCCategory));
static cl::opt<bool> LexMasmIntegers(
"masm-integers",
- cl::desc("Enable binary and hex masm integers (0b110 and 0ABCh)"));
+ cl::desc("Enable binary and hex masm integers (0b110 and 0ABCh)"),
+ cl::cat(MCCategory));
static cl::opt<bool> LexMasmHexFloats(
"masm-hexfloats",
- cl::desc("Enable MASM-style hex float initializers (3F800000r)"));
+ cl::desc("Enable MASM-style hex float initializers (3F800000r)"),
+ cl::cat(MCCategory));
static cl::opt<bool> LexMotorolaIntegers(
"motorola-integers",
- cl::desc("Enable binary and hex Motorola integers (%110 and $ABC)"));
+ cl::desc("Enable binary and hex Motorola integers (%110 and $ABC)"),
+ cl::cat(MCCategory));
static cl::opt<bool> NoExecStack("no-exec-stack",
- cl::desc("File doesn't need an exec stack"));
+ cl::desc("File doesn't need an exec stack"),
+ cl::cat(MCCategory));
enum ActionType {
AC_AsLex,
@@ -190,17 +220,16 @@ enum ActionType {
AC_MDisassemble,
};
-static cl::opt<ActionType>
-Action(cl::desc("Action to perform:"),
- cl::init(AC_Assemble),
- cl::values(clEnumValN(AC_AsLex, "as-lex",
- "Lex tokens from a .s file"),
- clEnumValN(AC_Assemble, "assemble",
- "Assemble a .s file (default)"),
- clEnumValN(AC_Disassemble, "disassemble",
- "Disassemble strings of hex bytes"),
- clEnumValN(AC_MDisassemble, "mdis",
- "Marked up disassembly of strings of hex bytes")));
+static cl::opt<ActionType> Action(
+ cl::desc("Action to perform:"), cl::init(AC_Assemble),
+ cl::values(clEnumValN(AC_AsLex, "as-lex", "Lex tokens from a .s file"),
+ clEnumValN(AC_Assemble, "assemble",
+ "Assemble a .s file (default)"),
+ clEnumValN(AC_Disassemble, "disassemble",
+ "Disassemble strings of hex bytes"),
+ clEnumValN(AC_MDisassemble, "mdis",
+ "Marked up disassembly of strings of hex bytes")),
+ cl::cat(MCCategory));
static const Target *GetTarget(const char *ProgName) {
// Figure out the target triple.
@@ -331,6 +360,7 @@ int main(int argc, char **argv) {
// Register the target printer for --version.
cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion);
+ cl::HideUnrelatedOptions({&MCCategory, &getColorCategory()});
cl::ParseCommandLineOptions(argc, argv, "llvm machine code playground\n");
const MCTargetOptions MCOptions = mc::InitMCTargetOptionsFromFlags();
setDwarfDebugFlags(argc, argv);
diff --git a/llvm/tools/llvm-modextract/llvm-modextract.cpp b/llvm/tools/llvm-modextract/llvm-modextract.cpp
index 7c40996258420..9a44cbf68d0de 100644
--- a/llvm/tools/llvm-modextract/llvm-modextract.cpp
+++ b/llvm/tools/llvm-modextract/llvm-modextract.cpp
@@ -21,21 +21,29 @@
using namespace llvm;
+static cl::OptionCategory ModextractCategory("Modextract Options");
+
static cl::opt<bool>
- BinaryExtract("b", cl::desc("Whether to perform binary extraction"));
+ BinaryExtract("b", cl::desc("Whether to perform binary extraction"),
+ cl::cat(ModextractCategory));
static cl::opt<std::string> OutputFilename("o", cl::Required,
cl::desc("Output filename"),
- cl::value_desc("filename"));
+ cl::value_desc("filename"),
+ cl::cat(ModextractCategory));
-static cl::opt<std::string>
- InputFilename(cl::Positional, cl::desc("<input bitcode>"), cl::init("-"));
+static cl::opt<std::string> InputFilename(cl::Positional,
+ cl::desc("<input bitcode>"),
+ cl::init("-"),
+ cl::cat(ModextractCategory));
static cl::opt<unsigned> ModuleIndex("n", cl::Required,
cl::desc("Index of module to extract"),
- cl::value_desc("index"));
+ cl::value_desc("index"),
+ cl::cat(ModextractCategory));
int main(int argc, char **argv) {
+ cl::HideUnrelatedOptions({&ModextractCategory, &getColorCategory()});
cl::ParseCommandLineOptions(argc, argv, "Module extractor");
ExitOnError ExitOnErr("llvm-modextract: error: ");
diff --git a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
index c250f3997f1f2..b152ebd6dccb2 100644
--- a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
+++ b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
@@ -1430,6 +1430,8 @@ int main(int Argc, const char **Argv) {
InitLLVM X(Argc, Argv);
ExitOnErr.setBanner("llvm-pdbutil: ");
+ cl::HideUnrelatedOptions(
+ {&opts::TypeCategory, &opts::FilterCategory, &opts::OtherOptions});
cl::ParseCommandLineOptions(Argc, Argv, "LLVM PDB Dumper\n");
if (opts::BytesSubcommand) {
diff --git a/llvm/tools/llvm-profgen/llvm-profgen.cpp b/llvm/tools/llvm-profgen/llvm-profgen.cpp
index 081f1bb4fcf4a..8ea0156aee09e 100644
--- a/llvm/tools/llvm-profgen/llvm-profgen.cpp
+++ b/llvm/tools/llvm-profgen/llvm-profgen.cpp
@@ -18,16 +18,20 @@
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/TargetSelect.h"
+static cl::OptionCategory ProfGenCategory("ProfGen Options");
+
static cl::list<std::string> PerfTraceFilenames(
"perfscript", cl::value_desc("perfscript"), cl::OneOrMore,
llvm::cl::MiscFlags::CommaSeparated,
cl::desc("Path of perf-script trace created by Linux perf tool with "
- "`script` command(the raw perf.data should be profiled with -b)"));
+ "`script` command(the raw perf.data should be profiled with -b)"),
+ cl::cat(ProfGenCategory));
static cl::list<std::string>
BinaryFilenames("binary", cl::value_desc("binary"), cl::OneOrMore,
llvm::cl::MiscFlags::CommaSeparated,
- cl::desc("Path of profiled binary files"));
+ cl::desc("Path of profiled binary files"),
+ cl::cat(ProfGenCategory));
extern cl::opt<bool> ShowDisassemblyOnly;
@@ -42,6 +46,7 @@ int main(int argc, const char *argv[]) {
InitializeAllTargetMCs();
InitializeAllDisassemblers();
+ cl::HideUnrelatedOptions({&ProfGenCategory, &getColorCategory()});
cl::ParseCommandLineOptions(argc, argv, "llvm SPGO profile generator\n");
// Load binaries and parse perf events and samples
More information about the llvm-commits
mailing list