diff --git a/llvm/test/tools/llvm-reduce/help.test b/llvm/test/tools/llvm-reduce/help.test new file mode 100644 index 00000000000000..3082cab963d655 --- /dev/null +++ b/llvm/test/tools/llvm-reduce/help.test @@ -0,0 +1,7 @@ +# RUN: llvm-reduce --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:' + +# HELP: OVERVIEW: LLVM automatic testcase reducer. +# HELP: USAGE +# HELP: Color Options +# HELP: Generic Options +# HELP: llvm-reduce options diff --git a/llvm/test/tools/llvm-rtdyld/help.test b/llvm/test/tools/llvm-rtdyld/help.test new file mode 100644 index 00000000000000..93663e84f9fa59 --- /dev/null +++ b/llvm/test/tools/llvm-rtdyld/help.test @@ -0,0 +1,7 @@ +# RUN: llvm-rtdyld --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:' + +# HELP: OVERVIEW: +# HELP: USAGE +# HELP: Color Options +# HELP: Generic Options +# HELP: RTDyld Options diff --git a/llvm/test/tools/llvm-split/help.test b/llvm/test/tools/llvm-split/help.test new file mode 100644 index 00000000000000..cc250cb0400fc3 --- /dev/null +++ b/llvm/test/tools/llvm-split/help.test @@ -0,0 +1,7 @@ +# RUN: llvm-split --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:' + +# HELP: OVERVIEW: LLVM module splitter +# HELP: USAGE +# HELP: Color Options +# HELP: Generic Options +# HELP: Split Options diff --git a/llvm/test/tools/llvm-stress/help.test b/llvm/test/tools/llvm-stress/help.test new file mode 100644 index 00000000000000..78dbbfb27a3417 --- /dev/null +++ b/llvm/test/tools/llvm-stress/help.test @@ -0,0 +1,7 @@ +# RUN: llvm-stress --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:' + +# HELP: OVERVIEW: llvm codegen stress-tester +# HELP: USAGE +# HELP: Color Options +# HELP: Generic Options +# HELP: Stress Options diff --git a/llvm/test/tools/llvm-undname/help.test b/llvm/test/tools/llvm-undname/help.test new file mode 100644 index 00000000000000..0fb664b84c30f9 --- /dev/null +++ b/llvm/test/tools/llvm-undname/help.test @@ -0,0 +1,6 @@ +# RUN: llvm-undname --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:' + +# HELP: OVERVIEW: llvm-undname +# HELP: USAGE +# HELP: Color Options +# HELP: Generic Options diff --git a/llvm/tools/llvm-reduce/llvm-reduce.cpp b/llvm/tools/llvm-reduce/llvm-reduce.cpp index 614ca45144c252..43dd15f43d463b 100644 --- a/llvm/tools/llvm-reduce/llvm-reduce.cpp +++ b/llvm/tools/llvm-reduce/llvm-reduce.cpp @@ -105,6 +105,7 @@ void writeOutput(Module *M, StringRef Message) { int main(int Argc, char **Argv) { InitLLVM X(Argc, Argv); + cl::HideUnrelatedOptions({&Options, &getColorCategory()}); cl::ParseCommandLineOptions(Argc, Argv, "LLVM automatic testcase reducer.\n"); if (PrintDeltaPasses) { diff --git a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp index 7b2e363bbbfa5b..f02d8981b30eff 100644 --- a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp +++ b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp @@ -44,9 +44,11 @@ using namespace llvm; using namespace llvm::object; -static cl::list -InputFileList(cl::Positional, cl::ZeroOrMore, - cl::desc("")); +static cl::OptionCategory RTDyldCategory("RTDyld Options"); + +static cl::list InputFileList(cl::Positional, cl::ZeroOrMore, + cl::desc(""), + cl::cat(RTDyldCategory)); enum ActionType { AC_Execute, @@ -56,94 +58,93 @@ enum ActionType { AC_Verify }; -static cl::opt -Action(cl::desc("Action to perform:"), - cl::init(AC_Execute), - cl::values(clEnumValN(AC_Execute, "execute", - "Load, link, and execute the inputs."), - clEnumValN(AC_PrintLineInfo, "printline", - "Load, link, and print line information for each function."), - clEnumValN(AC_PrintDebugLineInfo, "printdebugline", - "Load, link, and print line information for each function using the debug object"), - clEnumValN(AC_PrintObjectLineInfo, "printobjline", - "Like -printlineinfo but does not load the object first"), - clEnumValN(AC_Verify, "verify", - "Load, link and verify the resulting memory image."))); +static cl::opt Action( + cl::desc("Action to perform:"), cl::init(AC_Execute), + cl::values( + clEnumValN(AC_Execute, "execute", + "Load, link, and execute the inputs."), + clEnumValN(AC_PrintLineInfo, "printline", + "Load, link, and print line information for each function."), + clEnumValN(AC_PrintDebugLineInfo, "printdebugline", + "Load, link, and print line information for each function " + "using the debug object"), + clEnumValN(AC_PrintObjectLineInfo, "printobjline", + "Like -printlineinfo but does not load the object first"), + clEnumValN(AC_Verify, "verify", + "Load, link and verify the resulting memory image.")), + cl::cat(RTDyldCategory)); static cl::opt -EntryPoint("entry", - cl::desc("Function to call as entry point."), - cl::init("_main")); + EntryPoint("entry", cl::desc("Function to call as entry point."), + cl::init("_main"), cl::cat(RTDyldCategory)); -static cl::list -Dylibs("dylib", - cl::desc("Add library."), - cl::ZeroOrMore); +static cl::list Dylibs("dylib", cl::desc("Add library."), + cl::ZeroOrMore, cl::cat(RTDyldCategory)); static cl::list InputArgv("args", cl::Positional, cl::desc("..."), - cl::ZeroOrMore, cl::PositionalEatsArgs); + cl::ZeroOrMore, cl::PositionalEatsArgs, + cl::cat(RTDyldCategory)); static cl::opt -TripleName("triple", cl::desc("Target triple for disassembler")); + TripleName("triple", cl::desc("Target triple for disassembler"), + cl::cat(RTDyldCategory)); static cl::opt -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(RTDyldCategory)); static cl::list -CheckFiles("check", - cl::desc("File containing RuntimeDyld verifier checks."), - cl::ZeroOrMore); + CheckFiles("check", + cl::desc("File containing RuntimeDyld verifier checks."), + cl::ZeroOrMore, cl::cat(RTDyldCategory)); static cl::opt PreallocMemory("preallocate", cl::desc("Allocate memory upfront rather than on-demand"), - cl::init(0)); + cl::init(0), cl::cat(RTDyldCategory)); static cl::opt TargetAddrStart( "target-addr-start", cl::desc("For -verify only: start of phony target address " "range."), cl::init(4096), // Start at "page 1" - no allocating at "null". - cl::Hidden); + cl::Hidden, cl::cat(RTDyldCategory)); static cl::opt TargetAddrEnd( "target-addr-end", cl::desc("For -verify only: end of phony target address range."), - cl::init(~0ULL), cl::Hidden); + cl::init(~0ULL), cl::Hidden, cl::cat(RTDyldCategory)); static cl::opt TargetSectionSep( "target-section-sep", cl::desc("For -verify only: Separation between sections in " "phony target address space."), - cl::init(0), cl::Hidden); - -static cl::list -SpecificSectionMappings("map-section", - cl::desc("For -verify only: Map a section to a " - "specific address."), - cl::ZeroOrMore, - cl::Hidden); + cl::init(0), cl::Hidden, cl::cat(RTDyldCategory)); static cl::list -DummySymbolMappings("dummy-extern", - cl::desc("For -verify only: Inject a symbol into the extern " - "symbol table."), - cl::ZeroOrMore, - cl::Hidden); - -static cl::opt -PrintAllocationRequests("print-alloc-requests", - cl::desc("Print allocation requests made to the memory " - "manager by RuntimeDyld"), - cl::Hidden); + SpecificSectionMappings("map-section", + cl::desc("For -verify only: Map a section to a " + "specific address."), + cl::ZeroOrMore, cl::Hidden, + cl::cat(RTDyldCategory)); + +static cl::list DummySymbolMappings( + "dummy-extern", + cl::desc("For -verify only: Inject a symbol into the extern " + "symbol table."), + cl::ZeroOrMore, cl::Hidden, cl::cat(RTDyldCategory)); + +static cl::opt PrintAllocationRequests( + "print-alloc-requests", + cl::desc("Print allocation requests made to the memory " + "manager by RuntimeDyld"), + cl::Hidden, cl::cat(RTDyldCategory)); static cl::opt ShowTimes("show-times", cl::desc("Show times for llvm-rtdyld phases"), - cl::init(false)); + cl::init(false), cl::cat(RTDyldCategory)); ExitOnError ExitOnErr; @@ -966,6 +967,7 @@ int main(int argc, char **argv) { llvm::InitializeAllTargetMCs(); llvm::InitializeAllDisassemblers(); + cl::HideUnrelatedOptions({&RTDyldCategory, &getColorCategory()}); cl::ParseCommandLineOptions(argc, argv, "llvm MC-JIT tool\n"); ExitOnErr.setBanner(std::string(argv[0]) + ": "); diff --git a/llvm/tools/llvm-split/llvm-split.cpp b/llvm/tools/llvm-split/llvm-split.cpp index cf8ffd247f50bd..6de28dc611ecba 100644 --- a/llvm/tools/llvm-split/llvm-split.cpp +++ b/llvm/tools/llvm-split/llvm-split.cpp @@ -24,24 +24,32 @@ using namespace llvm; -static cl::opt -InputFilename(cl::Positional, cl::desc(""), - cl::init("-"), cl::value_desc("filename")); +static cl::OptionCategory SplitCategory("Split Options"); -static cl::opt -OutputFilename("o", cl::desc("Override output filename"), - cl::value_desc("filename")); +static cl::opt InputFilename(cl::Positional, + cl::desc(""), + cl::init("-"), + cl::value_desc("filename"), + cl::cat(SplitCategory)); + +static cl::opt OutputFilename("o", + cl::desc("Override output filename"), + cl::value_desc("filename"), + cl::cat(SplitCategory)); static cl::opt NumOutputs("j", cl::Prefix, cl::init(2), - cl::desc("Number of output files")); + cl::desc("Number of output files"), + cl::cat(SplitCategory)); static cl::opt PreserveLocals("preserve-locals", cl::Prefix, cl::init(false), - cl::desc("Split without externalizing locals")); + cl::desc("Split without externalizing locals"), + cl::cat(SplitCategory)); int main(int argc, char **argv) { LLVMContext Context; SMDiagnostic Err; + cl::HideUnrelatedOptions({&SplitCategory, &getColorCategory()}); cl::ParseCommandLineOptions(argc, argv, "LLVM module splitter\n"); std::unique_ptr M = parseIRFile(InputFilename, Err, Context); diff --git a/llvm/tools/llvm-stress/llvm-stress.cpp b/llvm/tools/llvm-stress/llvm-stress.cpp index b284fbf514a6af..ece32299910793 100644 --- a/llvm/tools/llvm-stress/llvm-stress.cpp +++ b/llvm/tools/llvm-stress/llvm-stress.cpp @@ -52,16 +52,20 @@ namespace llvm { -static cl::opt SeedCL("seed", - cl::desc("Seed used for randomness"), cl::init(0)); +static cl::OptionCategory StressCategory("Stress Options"); -static cl::opt SizeCL("size", - cl::desc("The estimated size of the generated function (# of instrs)"), - cl::init(100)); +static cl::opt SeedCL("seed", cl::desc("Seed used for randomness"), + cl::init(0), cl::cat(StressCategory)); -static cl::opt -OutputFilename("o", cl::desc("Override output filename"), - cl::value_desc("filename")); +static cl::opt SizeCL( + "size", + cl::desc("The estimated size of the generated function (# of instrs)"), + cl::init(100), cl::cat(StressCategory)); + +static cl::opt OutputFilename("o", + cl::desc("Override output filename"), + cl::value_desc("filename"), + cl::cat(StressCategory)); static LLVMContext Context; @@ -738,6 +742,7 @@ int main(int argc, char **argv) { using namespace llvm; InitLLVM X(argc, argv); + cl::HideUnrelatedOptions({&StressCategory, &getColorCategory()}); cl::ParseCommandLineOptions(argc, argv, "llvm codegen stress-tester\n"); auto M = std::make_unique("/tmp/autogen.bc", Context); diff --git a/llvm/tools/llvm-undname/llvm-undname.cpp b/llvm/tools/llvm-undname/llvm-undname.cpp index f9f9e0537e9e06..c6714cf667dd81 100644 --- a/llvm/tools/llvm-undname/llvm-undname.cpp +++ b/llvm/tools/llvm-undname/llvm-undname.cpp @@ -28,28 +28,32 @@ using namespace llvm; +cl::OptionCategory UndNameCategory("UndName Options"); + cl::opt DumpBackReferences("backrefs", cl::Optional, cl::desc("dump backreferences"), cl::Hidden, - cl::init(false)); + cl::init(false), cl::cat(UndNameCategory)); cl::opt NoAccessSpecifier("no-access-specifier", cl::Optional, cl::desc("skip access specifiers"), cl::Hidden, - cl::init(false)); + cl::init(false), cl::cat(UndNameCategory)); cl::opt NoCallingConvention("no-calling-convention", cl::Optional, cl::desc("skip calling convention"), - cl::Hidden, cl::init(false)); + cl::Hidden, cl::init(false), + cl::cat(UndNameCategory)); cl::opt NoReturnType("no-return-type", cl::Optional, cl::desc("skip return types"), cl::Hidden, - cl::init(false)); + cl::init(false), cl::cat(UndNameCategory)); cl::opt NoMemberType("no-member-type", cl::Optional, cl::desc("skip member types"), cl::Hidden, - cl::init(false)); + cl::init(false), cl::cat(UndNameCategory)); cl::opt RawFile("raw-file", cl::Optional, - cl::desc("for fuzzer data"), cl::Hidden); + cl::desc("for fuzzer data"), cl::Hidden, + cl::cat(UndNameCategory)); cl::opt WarnTrailing("warn-trailing", cl::Optional, cl::desc("warn on trailing characters"), cl::Hidden, - cl::init(false)); + cl::init(false), cl::cat(UndNameCategory)); cl::list Symbols(cl::Positional, cl::desc(""), - cl::ZeroOrMore); + cl::ZeroOrMore, cl::cat(UndNameCategory)); static bool msDemangle(const std::string &S) { int Status; @@ -84,6 +88,7 @@ static bool msDemangle(const std::string &S) { int main(int argc, char **argv) { InitLLVM X(argc, argv); + cl::HideUnrelatedOptions({&UndNameCategory, &getColorCategory()}); cl::ParseCommandLineOptions(argc, argv, "llvm-undname\n"); if (!RawFile.empty()) {