From d0d1c416cb1eb60c8a9cff8d487c8fea92fe21f2 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 4 Jun 2022 23:51:12 -0700 Subject: [PATCH] Remove unneeded cl::ZeroOrMore for cl::list options --- .../clang-linker-wrapper/ClangLinkerWrapper.cpp | 4 ++-- .../clang-offload-bundler/ClangOffloadBundler.cpp | 6 +++--- .../clang-offload-packager/ClangOffloadPackager.cpp | 2 +- llvm/docs/CommandLine.rst | 2 +- .../LLJITWithRemoteDebugging.cpp | 2 +- llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp | 2 +- llvm/tools/bugpoint/ExecutionDriver.cpp | 2 +- llvm/tools/bugpoint/bugpoint.cpp | 2 +- llvm/tools/llvm-cat/llvm-cat.cpp | 2 +- llvm/tools/llvm-cov/CodeCoverage.cpp | 4 ++-- llvm/tools/llvm-dis/llvm-dis.cpp | 2 +- llvm/tools/llvm-dwp/llvm-dwp.cpp | 5 ++--- llvm/tools/llvm-link/llvm-link.cpp | 2 +- .../llvm-mc-assemble-fuzzer.cpp | 2 +- .../llvm-mc-disassemble-fuzzer.cpp | 2 +- llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp | 12 ++++++------ llvm/tools/llvm-reduce/llvm-reduce.cpp | 2 +- llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp | 2 +- llvm/unittests/Support/CommandLineTest.cpp | 2 +- polly/lib/Transform/ScheduleOptimizer.cpp | 8 +++----- 20 files changed, 32 insertions(+), 35 deletions(-) diff --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp index 5ddda57454b2..e7eec16e5115 100644 --- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp +++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp @@ -78,7 +78,7 @@ static cl::opt OptLevel("opt-level", cl::cat(ClangLinkerWrapperCategory)); static cl::list - BitcodeLibraries("target-library", cl::ZeroOrMore, + BitcodeLibraries("target-library", cl::desc("Path for the target bitcode library"), cl::cat(ClangLinkerWrapperCategory)); @@ -104,7 +104,7 @@ static cl::opt cl::cat(ClangLinkerWrapperCategory)); static cl::list - PtxasArgs("ptxas-args", cl::ZeroOrMore, + PtxasArgs("ptxas-args", cl::desc("Argument to pass to the ptxas invocation"), cl::cat(ClangLinkerWrapperCategory)); diff --git a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp index 1792923dd015..080d7c9093dd 100644 --- a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp +++ b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp @@ -63,13 +63,13 @@ static cl::opt Help("h", cl::desc("Alias for -help"), cl::Hidden); static cl::OptionCategory ClangOffloadBundlerCategory("clang-offload-bundler options"); static cl::list - InputFileNames("input", cl::ZeroOrMore, + InputFileNames("input", cl::desc("Input file." " Can be specified multiple times " "for multiple input files."), cl::cat(ClangOffloadBundlerCategory)); static cl::list - InputFileNamesDeprecatedOpt("inputs", cl::CommaSeparated, cl::ZeroOrMore, + InputFileNamesDeprecatedOpt("inputs", cl::CommaSeparated, cl::desc("[,...] (deprecated)"), cl::cat(ClangOffloadBundlerCategory)); static cl::list @@ -79,7 +79,7 @@ static cl::list "for multiple output files."), cl::cat(ClangOffloadBundlerCategory)); static cl::list - OutputFileNamesDeprecatedOpt("outputs", cl::CommaSeparated, cl::ZeroOrMore, + OutputFileNamesDeprecatedOpt("outputs", cl::CommaSeparated, cl::desc("[,...] (deprecated)"), cl::cat(ClangOffloadBundlerCategory)); static cl::list diff --git a/clang/tools/clang-offload-packager/ClangOffloadPackager.cpp b/clang/tools/clang-offload-packager/ClangOffloadPackager.cpp index f05697539675..eb348d05e3bb 100644 --- a/clang/tools/clang-offload-packager/ClangOffloadPackager.cpp +++ b/clang/tools/clang-offload-packager/ClangOffloadPackager.cpp @@ -38,7 +38,7 @@ static cl::opt OutputFile("o", cl::Required, cl::cat(ClangOffloadPackagerCategory)); static cl::list - DeviceImages("image", cl::ZeroOrMore, + DeviceImages("image", cl::desc("List of key and value arguments. Required keywords " "are 'file' and 'triple'."), cl::value_desc("=,..."), diff --git a/llvm/docs/CommandLine.rst b/llvm/docs/CommandLine.rst index fef7e39ad86d..3784db29ed87 100644 --- a/llvm/docs/CommandLine.rst +++ b/llvm/docs/CommandLine.rst @@ -767,7 +767,7 @@ The idiom for usage is like this: .. code-block:: c++ static cl::list Files(cl::Positional, cl::OneOrMore); - static cl::list Libraries("l", cl::ZeroOrMore); + static cl::list Libraries("l"); int main(int argc, char**argv) { // ... diff --git a/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/LLJITWithRemoteDebugging.cpp b/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/LLJITWithRemoteDebugging.cpp index 3c1f5f86dcba..795c167c5271 100644 --- a/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/LLJITWithRemoteDebugging.cpp +++ b/llvm/examples/OrcV2Examples/LLJITWithRemoteDebugging/LLJITWithRemoteDebugging.cpp @@ -110,7 +110,7 @@ static cl::list InputArgv("args", cl::Positional, // Given paths must exist on the remote target. static cl::list Dylibs("dlopen", cl::desc("Dynamic libraries to load before linking"), - cl::value_desc("filename"), cl::ZeroOrMore); + cl::value_desc("filename")); // File path of the executable to launch for execution in a child process. // Inter-process communication will go through stdin/stdout pipes. diff --git a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp index 839696832f10..2b48d8d54e5a 100644 --- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp +++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp @@ -171,7 +171,7 @@ static cl::opt DisableWholeProgramVisibility( static cl::list SkipFunctionNames("wholeprogramdevirt-skip", cl::desc("Prevent function(s) from being devirtualized"), - cl::Hidden, cl::ZeroOrMore, cl::CommaSeparated); + cl::Hidden, cl::CommaSeparated); /// Mechanism to add runtime checking of devirtualization decisions, optionally /// trapping or falling back to indirect call on any that are not correct. diff --git a/llvm/tools/bugpoint/ExecutionDriver.cpp b/llvm/tools/bugpoint/ExecutionDriver.cpp index f06f378962d9..98b10fbf9cbe 100644 --- a/llvm/tools/bugpoint/ExecutionDriver.cpp +++ b/llvm/tools/bugpoint/ExecutionDriver.cpp @@ -114,7 +114,7 @@ cl::opt namespace { cl::list ToolArgv("tool-args", cl::Positional, - cl::desc("..."), cl::ZeroOrMore, + cl::desc("..."), cl::PositionalEatsArgs); cl::list SafeToolArgv("safe-tool-args", cl::Positional, diff --git a/llvm/tools/bugpoint/bugpoint.cpp b/llvm/tools/bugpoint/bugpoint.cpp index 7c4325541fa2..6e3f237d0a39 100644 --- a/llvm/tools/bugpoint/bugpoint.cpp +++ b/llvm/tools/bugpoint/bugpoint.cpp @@ -65,7 +65,7 @@ static cl::opt // PassNameParser. // static cl::list - PassList(cl::desc("Passes available:"), cl::ZeroOrMore); + PassList(cl::desc("Passes available:")); static cl::opt OptLevelO1("O1", cl::desc("Optimization level 1. Identical to 'opt -O1'")); diff --git a/llvm/tools/llvm-cat/llvm-cat.cpp b/llvm/tools/llvm-cat/llvm-cat.cpp index 39848e5d3364..039f63ad9465 100644 --- a/llvm/tools/llvm-cat/llvm-cat.cpp +++ b/llvm/tools/llvm-cat/llvm-cat.cpp @@ -43,7 +43,7 @@ static cl::opt OutputFilename("o", cl::Required, cl::value_desc("filename"), cl::cat(CatCategory)); -static cl::list InputFilenames(cl::Positional, cl::ZeroOrMore, +static cl::list InputFilenames(cl::Positional, cl::desc(""), cl::cat(CatCategory)); diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp index c78fca91eadd..79668e250e90 100644 --- a/llvm/tools/llvm-cov/CodeCoverage.cpp +++ b/llvm/tools/llvm-cov/CodeCoverage.cpp @@ -627,8 +627,8 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) { "dump-collected-objects", cl::Optional, cl::Hidden, cl::desc("Show the collected coverage object files")); - cl::list InputSourceFiles( - cl::Positional, cl::desc(""), cl::ZeroOrMore); + cl::list InputSourceFiles(cl::Positional, + cl::desc("")); cl::opt DebugDumpCollectedPaths( "dump-collected-paths", cl::Optional, cl::Hidden, diff --git a/llvm/tools/llvm-dis/llvm-dis.cpp b/llvm/tools/llvm-dis/llvm-dis.cpp index f0e1655b19be..4996fc12ae32 100644 --- a/llvm/tools/llvm-dis/llvm-dis.cpp +++ b/llvm/tools/llvm-dis/llvm-dis.cpp @@ -38,7 +38,7 @@ using namespace llvm; static cl::OptionCategory DisCategory("Disassembler Options"); -static cl::list InputFilenames(cl::Positional, cl::ZeroOrMore, +static cl::list InputFilenames(cl::Positional, cl::desc("[input bitcode]..."), cl::cat(DisCategory)); diff --git a/llvm/tools/llvm-dwp/llvm-dwp.cpp b/llvm/tools/llvm-dwp/llvm-dwp.cpp index 9aa6949d1002..c48236e34cc0 100644 --- a/llvm/tools/llvm-dwp/llvm-dwp.cpp +++ b/llvm/tools/llvm-dwp/llvm-dwp.cpp @@ -36,9 +36,8 @@ using namespace llvm::object; static mc::RegisterMCTargetOptionsFlags MCTargetOptionsFlags; cl::OptionCategory DwpCategory("Specific Options"); -static cl::list InputFiles(cl::Positional, cl::ZeroOrMore, - cl::desc(""), - cl::cat(DwpCategory)); +static cl::list + InputFiles(cl::Positional, cl::desc(""), cl::cat(DwpCategory)); static cl::list ExecFilenames( "e", cl::ZeroOrMore, diff --git a/llvm/tools/llvm-link/llvm-link.cpp b/llvm/tools/llvm-link/llvm-link.cpp index 1c09eb581f2b..cd133484e0af 100644 --- a/llvm/tools/llvm-link/llvm-link.cpp +++ b/llvm/tools/llvm-link/llvm-link.cpp @@ -56,7 +56,7 @@ static cl::list OverridingInputs( // Option to simulate function importing for testing. This enables using // llvm-link to simulate ThinLTO backend processes. static cl::list Imports( - "import", cl::ZeroOrMore, cl::value_desc("function:filename"), + "import", cl::value_desc("function:filename"), cl::desc("Pair of function name and filename, where function should be " "imported from bitcode in filename"), cl::cat(LinkCategory)); diff --git a/llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp b/llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp index bfa188bea61e..f0a6838bf72f 100644 --- a/llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp +++ b/llvm/tools/llvm-mc-assemble-fuzzer/llvm-mc-assemble-fuzzer.cpp @@ -63,7 +63,7 @@ std::string FeaturesStr; static cl::list FuzzerArgs("fuzzer-args", cl::Positional, - cl::desc("Options to pass to the fuzzer"), cl::ZeroOrMore, + cl::desc("Options to pass to the fuzzer"), cl::PositionalEatsArgs); static std::vector ModifiedArgv; diff --git a/llvm/tools/llvm-mc-disassemble-fuzzer/llvm-mc-disassemble-fuzzer.cpp b/llvm/tools/llvm-mc-disassemble-fuzzer/llvm-mc-disassemble-fuzzer.cpp index 77708cb860d8..b2354f36d846 100644 --- a/llvm/tools/llvm-mc-disassemble-fuzzer/llvm-mc-disassemble-fuzzer.cpp +++ b/llvm/tools/llvm-mc-disassemble-fuzzer/llvm-mc-disassemble-fuzzer.cpp @@ -43,7 +43,7 @@ std::string FeaturesStr; static cl::list FuzzerArgs("fuzzer-args", cl::Positional, - cl::desc("Options to pass to the fuzzer"), cl::ZeroOrMore, + cl::desc("Options to pass to the fuzzer"), cl::PositionalEatsArgs); static std::vector ModifiedArgv; diff --git a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp index 474cb1977df0..18d0112d6147 100644 --- a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp +++ b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp @@ -216,7 +216,7 @@ cl::opt ShowInjectedSourceContent( cl::list WithName( "with-name", cl::desc("Display any symbol or type with the specified exact name"), - cl::cat(TypeCategory), cl::ZeroOrMore, cl::sub(PrettySubcommand)); + cl::cat(TypeCategory), cl::sub(PrettySubcommand)); cl::opt Compilands("compilands", cl::desc("Display compilands"), cl::cat(TypeCategory), cl::sub(PrettySubcommand)); @@ -229,7 +229,7 @@ cl::opt Externals("externals", cl::desc("Dump external symbols"), cl::cat(TypeCategory), cl::sub(PrettySubcommand)); cl::list SymTypes( "sym-types", cl::desc("Type of symbols to dump (default all)"), - cl::cat(TypeCategory), cl::sub(PrettySubcommand), cl::ZeroOrMore, + cl::cat(TypeCategory), cl::sub(PrettySubcommand), cl::values( clEnumValN(SymLevel::Thunks, "thunks", "Display thunk symbols"), clEnumValN(SymLevel::Data, "data", "Display data symbols"), @@ -389,7 +389,7 @@ cl::opt cl::sub(BytesSubcommand), cl::cat(MsfBytes)); cl::list - DumpStreamData("stream-data", cl::CommaSeparated, cl::ZeroOrMore, + DumpStreamData("stream-data", cl::CommaSeparated, cl::desc("Dump binary data from specified streams. Format " "is SN[:Start][@Size]"), cl::sub(BytesSubcommand), cl::cat(MsfBytes)); @@ -505,7 +505,7 @@ cl::opt DontResolveForwardRefs( cl::cat(TypeOptions), cl::sub(DumpSubcommand)); cl::list DumpTypeIndex( - "type-index", cl::ZeroOrMore, cl::CommaSeparated, + "type-index", cl::CommaSeparated, cl::desc("only dump types with the specified hexadecimal type index"), cl::cat(TypeOptions), cl::sub(DumpSubcommand)); @@ -541,7 +541,7 @@ cl::list DumpGlobalNames( "global-name", cl::desc( "With -globals, only dump globals whose name matches the given value"), - cl::cat(SymbolOptions), cl::sub(DumpSubcommand), cl::ZeroOrMore); + cl::cat(SymbolOptions), cl::sub(DumpSubcommand)); cl::opt DumpPublics("publics", cl::desc("dump Publics stream data"), cl::cat(SymbolOptions), cl::sub(DumpSubcommand)); cl::opt DumpPublicExtras("public-extras", @@ -706,7 +706,7 @@ cl::opt DumpModuleFiles("module-files", cl::desc("dump file information"), cl::cat(FileOptions), cl::sub(PdbToYamlSubcommand)); cl::list DumpModuleSubsections( - "subsections", cl::ZeroOrMore, cl::CommaSeparated, + "subsections", cl::CommaSeparated, cl::desc("dump subsections from each module's debug stream"), ChunkValues, cl::cat(FileOptions), cl::sub(PdbToYamlSubcommand)); cl::opt DumpModuleSyms("module-syms", cl::desc("dump module symbols"), diff --git a/llvm/tools/llvm-reduce/llvm-reduce.cpp b/llvm/tools/llvm-reduce/llvm-reduce.cpp index 362136f26219..f70074e2adf3 100644 --- a/llvm/tools/llvm-reduce/llvm-reduce.cpp +++ b/llvm/tools/llvm-reduce/llvm-reduce.cpp @@ -60,7 +60,7 @@ static cl::opt cl::cat(LLVMReduceOptions)); static cl::list - TestArguments("test-arg", cl::ZeroOrMore, + TestArguments("test-arg", cl::desc("Arguments passed onto the interesting-ness test"), cl::cat(LLVMReduceOptions)); diff --git a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp index 893d8a55c895..456c61b79a34 100644 --- a/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp +++ b/llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp @@ -46,7 +46,7 @@ using namespace llvm::object; static cl::OptionCategory RTDyldCategory("RTDyld Options"); -static cl::list InputFileList(cl::Positional, cl::ZeroOrMore, +static cl::list InputFileList(cl::Positional, cl::desc(""), cl::cat(RTDyldCategory)); diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp index ec9901aa9501..e886cb3b7ded 100644 --- a/llvm/unittests/Support/CommandLineTest.cpp +++ b/llvm/unittests/Support/CommandLineTest.cpp @@ -803,7 +803,7 @@ TEST(CommandLineTest, ResponseFileWindows) { GTEST_SKIP(); StackOption> InputFilenames( - cl::Positional, cl::desc(""), cl::ZeroOrMore); + cl::Positional, cl::desc("")); StackOption TopLevelOpt("top-level", cl::init(false)); // Create response file. diff --git a/polly/lib/Transform/ScheduleOptimizer.cpp b/polly/lib/Transform/ScheduleOptimizer.cpp index 0de88c2f6c52..4b3f964e1089 100644 --- a/polly/lib/Transform/ScheduleOptimizer.cpp +++ b/polly/lib/Transform/ScheduleOptimizer.cpp @@ -127,8 +127,7 @@ static cl::list FirstLevelTileSizes("polly-tile-sizes", cl::desc("A tile size for each loop dimension, filled " "with --polly-default-tile-size"), - cl::Hidden, cl::ZeroOrMore, cl::CommaSeparated, - cl::cat(PollyCategory)); + cl::Hidden, cl::CommaSeparated, cl::cat(PollyCategory)); static cl::opt SecondLevelTiling("polly-2nd-level-tiling", @@ -145,7 +144,7 @@ static cl::list SecondLevelTileSizes("polly-2nd-level-tile-sizes", cl::desc("A tile size for each loop dimension, filled " "with --polly-default-tile-size"), - cl::Hidden, cl::ZeroOrMore, cl::CommaSeparated, + cl::Hidden, cl::CommaSeparated, cl::cat(PollyCategory)); static cl::opt RegisterTiling("polly-register-tiling", @@ -162,8 +161,7 @@ static cl::list RegisterTileSizes("polly-register-tile-sizes", cl::desc("A tile size for each loop dimension, filled " "with --polly-register-tile-size"), - cl::Hidden, cl::ZeroOrMore, cl::CommaSeparated, - cl::cat(PollyCategory)); + cl::Hidden, cl::CommaSeparated, cl::cat(PollyCategory)); static cl::opt PragmaBasedOpts( "polly-pragma-based-opts",