[llvm] 924d62c - [llvm][tools] Hide remaining unrelated llvm- tool options

Timm Bäder via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 22 00:51:11 PDT 2021


Author: Timm Bäder
Date: 2021-07-22T09:47:55+02:00
New Revision: 924d62ca4a856f11caf90fd48ebc924733c5c3dc

URL: https://github.com/llvm/llvm-project/commit/924d62ca4a856f11caf90fd48ebc924733c5c3dc
DIFF: https://github.com/llvm/llvm-project/commit/924d62ca4a856f11caf90fd48ebc924733c5c3dc.diff

LOG: [llvm][tools] Hide remaining unrelated llvm- tool options

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

Added: 
    llvm/test/tools/llvm-reduce/help.test
    llvm/test/tools/llvm-rtdyld/help.test
    llvm/test/tools/llvm-split/help.test
    llvm/test/tools/llvm-stress/help.test
    llvm/test/tools/llvm-undname/help.test

Modified: 
    llvm/tools/llvm-reduce/llvm-reduce.cpp
    llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp
    llvm/tools/llvm-split/llvm-split.cpp
    llvm/tools/llvm-stress/llvm-stress.cpp
    llvm/tools/llvm-undname/llvm-undname.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-reduce/help.test b/llvm/test/tools/llvm-reduce/help.test
new file mode 100644
index 0000000000000..3082cab963d65
--- /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 0000000000000..93663e84f9fa5
--- /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 0000000000000..cc250cb0400fc
--- /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 0000000000000..78dbbfb27a341
--- /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 0000000000000..0fb664b84c30f
--- /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 614ca45144c25..43dd15f43d463 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 7b2e363bbbfa5..f02d8981b30ef 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<std::string>
-InputFileList(cl::Positional, cl::ZeroOrMore,
-              cl::desc("<input files>"));
+static cl::OptionCategory RTDyldCategory("RTDyld Options");
+
+static cl::list<std::string> InputFileList(cl::Positional, cl::ZeroOrMore,
+                                           cl::desc("<input files>"),
+                                           cl::cat(RTDyldCategory));
 
 enum ActionType {
   AC_Execute,
@@ -56,94 +58,93 @@ enum ActionType {
   AC_Verify
 };
 
-static cl::opt<ActionType>
-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<ActionType> 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<std::string>
-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<std::string>
-Dylibs("dylib",
-       cl::desc("Add library."),
-       cl::ZeroOrMore);
+static cl::list<std::string> Dylibs("dylib", cl::desc("Add library."),
+                                    cl::ZeroOrMore, cl::cat(RTDyldCategory));
 
 static cl::list<std::string> InputArgv("args", cl::Positional,
                                        cl::desc("<program arguments>..."),
-                                       cl::ZeroOrMore, cl::PositionalEatsArgs);
+                                       cl::ZeroOrMore, cl::PositionalEatsArgs,
+                                       cl::cat(RTDyldCategory));
 
 static cl::opt<std::string>
-TripleName("triple", cl::desc("Target triple for disassembler"));
+    TripleName("triple", cl::desc("Target triple for disassembler"),
+               cl::cat(RTDyldCategory));
 
 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(RTDyldCategory));
 
 static cl::list<std::string>
-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<uint64_t>
     PreallocMemory("preallocate",
                    cl::desc("Allocate memory upfront rather than on-demand"),
-                   cl::init(0));
+                   cl::init(0), cl::cat(RTDyldCategory));
 
 static cl::opt<uint64_t> 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<uint64_t> 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<uint64_t> 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<std::string>
-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<std::string>
-DummySymbolMappings("dummy-extern",
-                    cl::desc("For -verify only: Inject a symbol into the extern "
-                             "symbol table."),
-                    cl::ZeroOrMore,
-                    cl::Hidden);
-
-static cl::opt<bool>
-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<std::string> 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<bool> PrintAllocationRequests(
+    "print-alloc-requests",
+    cl::desc("Print allocation requests made to the memory "
+             "manager by RuntimeDyld"),
+    cl::Hidden, cl::cat(RTDyldCategory));
 
 static cl::opt<bool> 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 cf8ffd247f50b..6de28dc611ecb 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<std::string>
-InputFilename(cl::Positional, cl::desc("<input bitcode file>"),
-    cl::init("-"), cl::value_desc("filename"));
+static cl::OptionCategory SplitCategory("Split Options");
 
-static cl::opt<std::string>
-OutputFilename("o", cl::desc("Override output filename"),
-               cl::value_desc("filename"));
+static cl::opt<std::string> InputFilename(cl::Positional,
+                                          cl::desc("<input bitcode file>"),
+                                          cl::init("-"),
+                                          cl::value_desc("filename"),
+                                          cl::cat(SplitCategory));
+
+static cl::opt<std::string> OutputFilename("o",
+                                           cl::desc("Override output filename"),
+                                           cl::value_desc("filename"),
+                                           cl::cat(SplitCategory));
 
 static cl::opt<unsigned> 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<bool>
     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<Module> M = parseIRFile(InputFilename, Err, Context);

diff  --git a/llvm/tools/llvm-stress/llvm-stress.cpp b/llvm/tools/llvm-stress/llvm-stress.cpp
index b284fbf514a6a..ece3229991079 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<unsigned> SeedCL("seed",
-  cl::desc("Seed used for randomness"), cl::init(0));
+static cl::OptionCategory StressCategory("Stress Options");
 
-static cl::opt<unsigned> SizeCL("size",
-  cl::desc("The estimated size of the generated function (# of instrs)"),
-  cl::init(100));
+static cl::opt<unsigned> SeedCL("seed", cl::desc("Seed used for randomness"),
+                                cl::init(0), cl::cat(StressCategory));
 
-static cl::opt<std::string>
-OutputFilename("o", cl::desc("Override output filename"),
-               cl::value_desc("filename"));
+static cl::opt<unsigned> SizeCL(
+    "size",
+    cl::desc("The estimated size of the generated function (# of instrs)"),
+    cl::init(100), cl::cat(StressCategory));
+
+static cl::opt<std::string> 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<Module>("/tmp/autogen.bc", Context);

diff  --git a/llvm/tools/llvm-undname/llvm-undname.cpp b/llvm/tools/llvm-undname/llvm-undname.cpp
index f9f9e0537e9e0..c6714cf667dd8 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<bool> DumpBackReferences("backrefs", cl::Optional,
                                  cl::desc("dump backreferences"), cl::Hidden,
-                                 cl::init(false));
+                                 cl::init(false), cl::cat(UndNameCategory));
 cl::opt<bool> NoAccessSpecifier("no-access-specifier", cl::Optional,
                                 cl::desc("skip access specifiers"), cl::Hidden,
-                                cl::init(false));
+                                cl::init(false), cl::cat(UndNameCategory));
 cl::opt<bool> 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<bool> NoReturnType("no-return-type", cl::Optional,
                            cl::desc("skip return types"), cl::Hidden,
-                           cl::init(false));
+                           cl::init(false), cl::cat(UndNameCategory));
 cl::opt<bool> NoMemberType("no-member-type", cl::Optional,
                            cl::desc("skip member types"), cl::Hidden,
-                           cl::init(false));
+                           cl::init(false), cl::cat(UndNameCategory));
 cl::opt<std::string> RawFile("raw-file", cl::Optional,
-                             cl::desc("for fuzzer data"), cl::Hidden);
+                             cl::desc("for fuzzer data"), cl::Hidden,
+                             cl::cat(UndNameCategory));
 cl::opt<bool> WarnTrailing("warn-trailing", cl::Optional,
                            cl::desc("warn on trailing characters"), cl::Hidden,
-                           cl::init(false));
+                           cl::init(false), cl::cat(UndNameCategory));
 cl::list<std::string> Symbols(cl::Positional, cl::desc("<input symbols>"),
-                              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()) {


        


More information about the llvm-commits mailing list