[llvm] 669275f - [llvm][tools] Hide more unrelated tool options
Timm Bäder via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 20 04:30:17 PDT 2021
Author: Timm Bäder
Date: 2021-07-20T13:27:33+02:00
New Revision: 669275f8a0fc85d9b352d91bbf4f4ee1886f96b1
URL: https://github.com/llvm/llvm-project/commit/669275f8a0fc85d9b352d91bbf4f4ee1886f96b1
DIFF: https://github.com/llvm/llvm-project/commit/669275f8a0fc85d9b352d91bbf4f4ee1886f96b1.diff
LOG: [llvm][tools] Hide more unrelated tool options
Differential Revision: https://reviews.llvm.org/D106271
Added:
llvm/test/tools/llvm-cxxdump/help.test
llvm/test/tools/llvm-cxxmap/help.test
llvm/test/tools/llvm-diff/help.test
llvm/test/tools/llvm-dis/help.test
llvm/test/tools/llvm-dwp/help.test
llvm/test/tools/llvm-ifs/help.test
Modified:
llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp
llvm/tools/llvm-diff/llvm-diff.cpp
llvm/tools/llvm-dis/llvm-dis.cpp
llvm/tools/llvm-dwp/llvm-dwp.cpp
llvm/tools/llvm-ifs/llvm-ifs.cpp
Removed:
################################################################################
diff --git a/llvm/test/tools/llvm-cxxdump/help.test b/llvm/test/tools/llvm-cxxdump/help.test
new file mode 100644
index 0000000000000..2b8fcecbd835b
--- /dev/null
+++ b/llvm/test/tools/llvm-cxxdump/help.test
@@ -0,0 +1,6 @@
+# RUN: llvm-cxxdump --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:'
+
+# HELP: OVERVIEW: LLVM C++ ABI Data Dumper
+# HELP: USAGE
+# HELP: Color Options
+# HELP: Generic Options
diff --git a/llvm/test/tools/llvm-cxxmap/help.test b/llvm/test/tools/llvm-cxxmap/help.test
new file mode 100644
index 0000000000000..5e8dd83484c67
--- /dev/null
+++ b/llvm/test/tools/llvm-cxxmap/help.test
@@ -0,0 +1,7 @@
+# RUN: llvm-cxxmap --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:'
+
+# HELP: OVERVIEW: LLVM C++ mangled name remapper
+# HELP: USAGE
+# HELP: CXX Map Options
+# HELP: Color Options
+# HELP: Generic Options
diff --git a/llvm/test/tools/llvm-
diff /help.test b/llvm/test/tools/llvm-
diff /help.test
new file mode 100644
index 0000000000000..0440fa8c124eb
--- /dev/null
+++ b/llvm/test/tools/llvm-
diff /help.test
@@ -0,0 +1,5 @@
+# RUN: llvm-
diff --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:'
+
+# HELP: USAGE
+# HELP: Color Options
+# HELP: Generic Options
diff --git a/llvm/test/tools/llvm-dis/help.test b/llvm/test/tools/llvm-dis/help.test
new file mode 100644
index 0000000000000..d5e9aa5783556
--- /dev/null
+++ b/llvm/test/tools/llvm-dis/help.test
@@ -0,0 +1,7 @@
+# RUN: llvm-dis --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:'
+
+# HELP: OVERVIEW
+# HELP: USAGE
+# HELP: Color Options
+# HELP: Disassembler Options
+# HELP: Generic Options
diff --git a/llvm/test/tools/llvm-dwp/help.test b/llvm/test/tools/llvm-dwp/help.test
new file mode 100644
index 0000000000000..f00cf68158d28
--- /dev/null
+++ b/llvm/test/tools/llvm-dwp/help.test
@@ -0,0 +1,7 @@
+# RUN: llvm-dwp --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:'
+
+# HELP: OVERVIEW
+# HELP: USAGE
+# HELP: Color Options
+# HELP: Generic Options
+# HELP: Specific Options
diff --git a/llvm/test/tools/llvm-ifs/help.test b/llvm/test/tools/llvm-ifs/help.test
new file mode 100644
index 0000000000000..1cfdbd25cca43
--- /dev/null
+++ b/llvm/test/tools/llvm-ifs/help.test
@@ -0,0 +1,6 @@
+# RUN: llvm-ifs --help | FileCheck %s --check-prefix HELP --implicit-check-not='{{[Oo]}}ptions:'
+
+# HELP: USAGE
+# HELP: Color Options
+# HELP: Generic Options
+# HELP: Ifs Options
diff --git a/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp b/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
index 03e1bab9417e1..f214288e951bc 100644
--- a/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
+++ b/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
@@ -33,9 +33,10 @@ using namespace llvm::object;
using namespace llvm::support;
namespace opts {
+cl::OptionCategory CXXDumpCategory("CXX Dump Options");
cl::list<std::string> InputFilenames(cl::Positional,
cl::desc("<input object files>"),
- cl::ZeroOrMore);
+ cl::ZeroOrMore, cl::cat(CXXDumpCategory));
} // namespace opts
namespace llvm {
@@ -549,6 +550,7 @@ int main(int argc, const char *argv[]) {
// Register the target printer for --version.
cl::AddExtraVersionPrinter(TargetRegistry::printRegisteredTargetsForVersion);
+ cl::HideUnrelatedOptions({&opts::CXXDumpCategory, &getColorCategory()});
cl::ParseCommandLineOptions(argc, argv, "LLVM C++ ABI Data Dumper\n");
// Default to stdin if no filename is specified.
diff --git a/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp b/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp
index ee3c627772485..1e18e379f23cf 100644
--- a/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp
+++ b/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp
@@ -25,23 +25,33 @@
using namespace llvm;
+cl::OptionCategory CXXMapCategory("CXX Map Options");
+
cl::opt<std::string> OldSymbolFile(cl::Positional, cl::Required,
- cl::desc("<symbol-file>"));
+ cl::desc("<symbol-file>"),
+ cl::cat(CXXMapCategory));
cl::opt<std::string> NewSymbolFile(cl::Positional, cl::Required,
- cl::desc("<symbol-file>"));
+ cl::desc("<symbol-file>"),
+ cl::cat(CXXMapCategory));
cl::opt<std::string> RemappingFile("remapping-file", cl::Required,
- cl::desc("Remapping file"));
-cl::alias RemappingFileA("r", cl::aliasopt(RemappingFile));
+ cl::desc("Remapping file"),
+ cl::cat(CXXMapCategory));
+cl::alias RemappingFileA("r", cl::aliasopt(RemappingFile),
+ cl::cat(CXXMapCategory));
cl::opt<std::string> OutputFilename("output", cl::value_desc("output"),
- cl::init("-"), cl::desc("Output file"));
-cl::alias OutputFilenameA("o", cl::aliasopt(OutputFilename));
+ cl::init("-"), cl::desc("Output file"),
+ cl::cat(CXXMapCategory));
+cl::alias OutputFilenameA("o", cl::aliasopt(OutputFilename),
+ cl::cat(CXXMapCategory));
cl::opt<bool> WarnAmbiguous(
"Wambiguous",
- cl::desc("Warn on equivalent symbols in the output symbol list"));
+ cl::desc("Warn on equivalent symbols in the output symbol list"),
+ cl::cat(CXXMapCategory));
cl::opt<bool> WarnIncomplete(
"Wincomplete",
- cl::desc("Warn on input symbols missing from output symbol list"));
+ cl::desc("Warn on input symbols missing from output symbol list"),
+ cl::cat(CXXMapCategory));
static void warn(Twine Message, Twine Whence = "",
std::string Hint = "") {
@@ -131,6 +141,7 @@ static void remapSymbols(MemoryBuffer &OldSymbolFile,
int main(int argc, const char *argv[]) {
InitLLVM X(argc, argv);
+ cl::HideUnrelatedOptions({&CXXMapCategory, &getColorCategory()});
cl::ParseCommandLineOptions(argc, argv, "LLVM C++ mangled name remapper\n");
auto OldSymbolBufOrError = MemoryBuffer::getFileOrSTDIN(OldSymbolFile);
diff --git a/llvm/tools/llvm-
diff /llvm-
diff .cpp b/llvm/tools/llvm-
diff /llvm-
diff .cpp
index aaf7989e2e3d1..8a11179e741ec 100644
--- a/llvm/tools/llvm-
diff /llvm-
diff .cpp
+++ b/llvm/tools/llvm-
diff /llvm-
diff .cpp
@@ -55,16 +55,20 @@ static void
diff Global(DifferenceEngine &Engine, Module &L, Module &R,
errs() << "No function named @" << Name << " in right module\n";
}
+cl::OptionCategory DiffCategory("Diff Options");
+
static cl::opt<std::string> LeftFilename(cl::Positional,
- cl::desc("<first file>"),
- cl::Required);
+ cl::desc("<first file>"), cl::Required,
+ cl::cat(DiffCategory));
static cl::opt<std::string> RightFilename(cl::Positional,
cl::desc("<second file>"),
- cl::Required);
+ cl::Required, cl::cat(DiffCategory));
static cl::list<std::string> GlobalsToCompare(cl::Positional,
- cl::desc("<globals to compare>"));
+ cl::desc("<globals to compare>"),
+ cl::cat(DiffCategory));
int main(int argc, char **argv) {
+ cl::HideUnrelatedOptions({&DiffCategory, &getColorCategory()});
cl::ParseCommandLineOptions(argc, argv);
LLVMContext Context;
diff --git a/llvm/tools/llvm-dis/llvm-dis.cpp b/llvm/tools/llvm-dis/llvm-dis.cpp
index b0103f75bb69e..62d165fb84135 100644
--- a/llvm/tools/llvm-dis/llvm-dis.cpp
+++ b/llvm/tools/llvm-dis/llvm-dis.cpp
@@ -35,37 +35,44 @@
#include <system_error>
using namespace llvm;
+static cl::OptionCategory DisCategory("Disassembler Options");
+
static cl::list<std::string> InputFilenames(cl::Positional, cl::ZeroOrMore,
- cl::desc("[input bitcode]..."));
+ cl::desc("[input bitcode]..."),
+ cl::cat(DisCategory));
-static cl::opt<std::string>
-OutputFilename("o", cl::desc("Override output filename"),
- cl::value_desc("filename"));
+static cl::opt<std::string> OutputFilename("o",
+ cl::desc("Override output filename"),
+ cl::value_desc("filename"),
+ cl::cat(DisCategory));
-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(DisCategory));
-static cl::opt<bool>
-DontPrint("disable-output", cl::desc("Don't output the .ll file"), cl::Hidden);
+static cl::opt<bool> DontPrint("disable-output",
+ cl::desc("Don't output the .ll file"),
+ cl::Hidden, cl::cat(DisCategory));
static cl::opt<bool>
SetImporting("set-importing",
cl::desc("Set lazy loading to pretend to import a module"),
- cl::Hidden);
+ cl::Hidden, cl::cat(DisCategory));
static cl::opt<bool>
ShowAnnotations("show-annotations",
- cl::desc("Add informational comments to the .ll file"));
+ cl::desc("Add informational comments to the .ll file"),
+ cl::cat(DisCategory));
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(DisCategory));
static cl::opt<bool>
MaterializeMetadata("materialize-metadata",
cl::desc("Load module without materializing metadata, "
- "then materialize only the metadata"));
+ "then materialize only the metadata"),
+ cl::cat(DisCategory));
namespace {
@@ -151,6 +158,7 @@ int main(int argc, char **argv) {
ExitOnErr.setBanner(std::string(argv[0]) + ": error: ");
+ cl::HideUnrelatedOptions({&DisCategory, &getColorCategory()});
cl::ParseCommandLineOptions(argc, argv, "llvm .bc -> .ll disassembler\n");
LLVMContext Context;
diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp
index b0b674a3e077b..c5e54f2587289 100644
--- a/llvm/tools/llvm-dwp/llvm-dwp.cpp
+++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp
@@ -942,6 +942,7 @@ static Expected<Triple> readTargetTriple(StringRef FileName) {
int main(int argc, char **argv) {
InitLLVM X(argc, argv);
+ cl::HideUnrelatedOptions({&DwpCategory, &getColorCategory()});
cl::ParseCommandLineOptions(argc, argv, "merge split dwarf (.dwo) files\n");
llvm::InitializeAllTargetInfos();
diff --git a/llvm/tools/llvm-ifs/llvm-ifs.cpp b/llvm/tools/llvm-ifs/llvm-ifs.cpp
index 324dd3931265f..77269967a2988 100644
--- a/llvm/tools/llvm-ifs/llvm-ifs.cpp
+++ b/llvm/tools/llvm-ifs/llvm-ifs.cpp
@@ -45,58 +45,72 @@ const VersionTuple IfsVersionCurrent(3, 0);
enum class FileFormat { IFS, ELF, TBD };
} // end anonymous namespace
+cl::OptionCategory IfsCategory("Ifs Options");
+
// TODO: Use OptTable for option parsing in the future.
// Command line flags:
cl::list<std::string> InputFilePaths(cl::Positional, cl::desc("input"),
- cl::ZeroOrMore);
+ cl::ZeroOrMore, cl::cat(IfsCategory));
cl::opt<FileFormat> InputFormat(
"input-format", cl::desc("Specify the input file format"),
cl::values(clEnumValN(FileFormat::IFS, "IFS", "Text based ELF stub file"),
- clEnumValN(FileFormat::ELF, "ELF", "ELF object file")));
+ clEnumValN(FileFormat::ELF, "ELF", "ELF object file")),
+ cl::cat(IfsCategory));
cl::opt<FileFormat> OutputFormat(
"output-format", cl::desc("Specify the output file format"),
cl::values(clEnumValN(FileFormat::IFS, "IFS", "Text based ELF stub file"),
clEnumValN(FileFormat::ELF, "ELF", "ELF stub file"),
clEnumValN(FileFormat::TBD, "TBD", "Apple TBD text stub file")),
- cl::Required);
+ cl::Required, cl::cat(IfsCategory));
cl::opt<std::string> OptArch("arch",
- cl::desc("Specify the architecture, e.g. x86_64"));
-cl::opt<IFSBitWidthType> OptBitWidth(
- "bitwidth", cl::desc("Specify the bit width"),
- cl::values(clEnumValN(IFSBitWidthType::IFS32, "32", "32 bits"),
- clEnumValN(IFSBitWidthType::IFS64, "64", "64 bits")));
+ cl::desc("Specify the architecture, e.g. x86_64"),
+ cl::cat(IfsCategory));
+cl::opt<IFSBitWidthType>
+ OptBitWidth("bitwidth", cl::desc("Specify the bit width"),
+ cl::values(clEnumValN(IFSBitWidthType::IFS32, "32", "32 bits"),
+ clEnumValN(IFSBitWidthType::IFS64, "64", "64 bits")),
+ cl::cat(IfsCategory));
cl::opt<IFSEndiannessType> OptEndianness(
"endianness", cl::desc("Specify the endianness"),
cl::values(clEnumValN(IFSEndiannessType::Little, "little", "Little Endian"),
- clEnumValN(IFSEndiannessType::Big, "big", "Big Endian")));
+ clEnumValN(IFSEndiannessType::Big, "big", "Big Endian")),
+ cl::cat(IfsCategory));
cl::opt<std::string> OptTargetTriple(
- "target", cl::desc("Specify the target triple, e.g. x86_64-linux-gnu"));
+ "target", cl::desc("Specify the target triple, e.g. x86_64-linux-gnu"),
+ cl::cat(IfsCategory));
cl::opt<std::string> OptTargetTripleHint(
"hint-ifs-target",
cl::desc("When --output-format is 'IFS', this flag will hint the expected "
- "target triple for IFS output"));
+ "target triple for IFS output"),
+ cl::cat(IfsCategory));
cl::opt<bool> StripIFSArch(
"strip-ifs-arch",
- cl::desc("Strip target architecture information away from IFS output"));
+ cl::desc("Strip target architecture information away from IFS output"),
+ cl::cat(IfsCategory));
cl::opt<bool> StripIFSBitWidth(
"strip-ifs-bitwidth",
- cl::desc("Strip target bit width information away from IFS output"));
+ cl::desc("Strip target bit width information away from IFS output"),
+ cl::cat(IfsCategory));
cl::opt<bool> StripIFSEndiannessWidth(
"strip-ifs-endianness",
- cl::desc("Strip target endianness information away from IFS output"));
+ cl::desc("Strip target endianness information away from IFS output"),
+ cl::cat(IfsCategory));
cl::opt<bool> StripIFSTarget(
"strip-ifs-target",
- cl::desc("Strip all target information away from IFS output"));
+ cl::desc("Strip all target information away from IFS output"),
+ cl::cat(IfsCategory));
cl::opt<std::string>
SoName("soname",
cl::desc("Manually set the DT_SONAME entry of any emitted files"),
- cl::value_desc("name"));
-cl::opt<std::string> OutputFilePath("output", cl::desc("Output file"));
+ cl::value_desc("name"), cl::cat(IfsCategory));
+cl::opt<std::string> OutputFilePath("output", cl::desc("Output file"),
+ cl::cat(IfsCategory));
cl::alias OutputFilePathA("o", cl::desc("Alias for --output"),
- cl::aliasopt(OutputFilePath));
+ cl::aliasopt(OutputFilePath), cl::cat(IfsCategory));
cl::opt<bool> WriteIfChanged(
"write-if-changed",
- cl::desc("Write the output file only if it is new or has changed."));
+ cl::desc("Write the output file only if it is new or has changed."),
+ cl::cat(IfsCategory));
static std::string getTypeName(IFSSymbolType Type) {
switch (Type) {
@@ -259,6 +273,7 @@ static Error writeIFS(StringRef FilePath, IFSStub &Stub) {
int main(int argc, char *argv[]) {
// Parse arguments.
+ cl::HideUnrelatedOptions({&IfsCategory, &getColorCategory()});
cl::ParseCommandLineOptions(argc, argv);
if (InputFilePaths.empty())
More information about the llvm-commits
mailing list