Skip to content

Commit cf08b46

Browse files
committed
[NFC]Make file-local cl::opt global variables static
1 parent c5663f2 commit cf08b46

File tree

13 files changed

+106
-100
lines changed

13 files changed

+106
-100
lines changed

llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ using namespace llvm;
2828
//===----------------------------------------------------------------------===//
2929

3030
namespace {
31-
cl::opt<std::string> InputIR(
32-
"input-IR",
33-
cl::desc("Specify the name of an IR file to load for function definitions"),
34-
cl::value_desc("input IR file name"));
31+
cl::opt<std::string>
32+
InputIR("input-IR",
33+
cl::desc("Specify the name of an IR file to load for function definitions"),
34+
cl::value_desc("input IR file name"));
3535
} // namespace
3636

3737
//===----------------------------------------------------------------------===//

llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/LLJITWithExecutorProcessControl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ static void reportErrorAndExit() {
117117
exit(1);
118118
}
119119

120-
cl::list<std::string> InputArgv(cl::Positional,
121-
cl::desc("<program arguments>..."));
120+
static cl::list<std::string> InputArgv(cl::Positional,
121+
cl::desc("<program arguments>..."));
122122

123123
int main(int argc, char *argv[]) {
124124
// Initialize LLVM.

llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ const llvm::StringRef MainMod =
8686
declare i32 @bar()
8787
)";
8888

89-
cl::list<std::string> InputArgv(cl::Positional,
90-
cl::desc("<program arguments>..."));
89+
static cl::list<std::string> InputArgv(cl::Positional,
90+
cl::desc("<program arguments>..."));
9191

9292
int main(int argc, char *argv[]) {
9393
// Initialize LLVM.

llvm/tools/bugpoint/ExecutionDriver.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ cl::opt<std::string>
8282
InputFile("input", cl::init("/dev/null"),
8383
cl::desc("Filename to pipe in as stdin (default: /dev/null)"));
8484

85-
cl::list<std::string>
85+
static cl::list<std::string>
8686
AdditionalSOs("additional-so", cl::desc("Additional shared objects to load "
8787
"into executing programs"));
8888

89-
cl::list<std::string> AdditionalLinkerArgs(
89+
static cl::list<std::string> AdditionalLinkerArgs(
9090
"Xlinker", cl::desc("Additional arguments to pass to the linker"));
9191

9292
cl::opt<std::string> CustomCompileCommand(
@@ -113,20 +113,20 @@ cl::opt<std::string>
113113
}
114114

115115
namespace {
116-
cl::list<std::string> ToolArgv("tool-args", cl::Positional,
117-
cl::desc("<tool arguments>..."),
118-
cl::PositionalEatsArgs);
116+
static cl::list<std::string> ToolArgv("tool-args", cl::Positional,
117+
cl::desc("<tool arguments>..."),
118+
cl::PositionalEatsArgs);
119119

120-
cl::list<std::string> SafeToolArgv("safe-tool-args", cl::Positional,
121-
cl::desc("<safe-tool arguments>..."),
122-
cl::PositionalEatsArgs);
120+
static cl::list<std::string> SafeToolArgv("safe-tool-args", cl::Positional,
121+
cl::desc("<safe-tool arguments>..."),
122+
cl::PositionalEatsArgs);
123123

124-
static cl::opt<std::string> CCBinary("gcc", cl::init(""),
125-
cl::desc("The gcc binary to use."));
124+
cl::opt<std::string> CCBinary("gcc", cl::init(""),
125+
cl::desc("The gcc binary to use."));
126126

127-
cl::list<std::string> CCToolArgv("gcc-tool-args", cl::Positional,
128-
cl::desc("<gcc-tool arguments>..."),
129-
cl::PositionalEatsArgs);
127+
static cl::list<std::string> CCToolArgv("gcc-tool-args", cl::Positional,
128+
cl::desc("<gcc-tool arguments>..."),
129+
cl::PositionalEatsArgs);
130130
}
131131

132132
//===----------------------------------------------------------------------===//

llvm/tools/lli/lli.cpp

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ namespace {
9898
cl::opt<std::string>
9999
InputFile(cl::desc("<input bitcode>"), cl::Positional, cl::init("-"));
100100

101-
cl::list<std::string>
102-
InputArgv(cl::ConsumeAfter, cl::desc("<program arguments>..."));
101+
static cl::list<std::string> InputArgv(cl::ConsumeAfter,
102+
cl::desc("<program arguments>..."));
103103

104104
cl::opt<bool> ForceInterpreter("force-interpreter",
105105
cl::desc("Force interpretation: disable JIT"),
@@ -132,23 +132,23 @@ namespace {
132132
"(jit-kind=orc-lazy only)"),
133133
cl::init(0));
134134

135-
cl::list<std::string>
136-
ThreadEntryPoints("thread-entry",
137-
cl::desc("calls the given entry-point on a new thread "
138-
"(jit-kind=orc-lazy only)"));
135+
static cl::list<std::string>
136+
ThreadEntryPoints("thread-entry",
137+
cl::desc("calls the given entry-point on a new thread "
138+
"(jit-kind=orc-lazy only)"));
139139

140140
cl::opt<bool> PerModuleLazy(
141141
"per-module-lazy",
142142
cl::desc("Performs lazy compilation on whole module boundaries "
143143
"rather than individual functions"),
144144
cl::init(false));
145145

146-
cl::list<std::string>
146+
static cl::list<std::string>
147147
JITDylibs("jd",
148148
cl::desc("Specifies the JITDylib to be used for any subsequent "
149149
"-extra-module arguments."));
150150

151-
cl::list<std::string>
151+
static cl::list<std::string>
152152
Dylibs("dlopen", cl::desc("Dynamic libraries to load before linking"));
153153

154154
// The MCJIT supports building for a target address space separate from
@@ -185,20 +185,18 @@ namespace {
185185
cl::value_desc("function"),
186186
cl::init("main"));
187187

188-
cl::list<std::string>
189-
ExtraModules("extra-module",
190-
cl::desc("Extra modules to be loaded"),
191-
cl::value_desc("input bitcode"));
188+
static cl::list<std::string>
189+
ExtraModules("extra-module", cl::desc("Extra modules to be loaded"),
190+
cl::value_desc("input bitcode"));
192191

193-
cl::list<std::string>
194-
ExtraObjects("extra-object",
195-
cl::desc("Extra object files to be loaded"),
196-
cl::value_desc("input object"));
192+
static cl::list<std::string>
193+
ExtraObjects("extra-object", cl::desc("Extra object files to be loaded"),
194+
cl::value_desc("input object"));
197195

198-
cl::list<std::string>
199-
ExtraArchives("extra-archive",
200-
cl::desc("Extra archive files to be loaded"),
201-
cl::value_desc("input archive"));
196+
static cl::list<std::string>
197+
ExtraArchives("extra-archive",
198+
cl::desc("Extra archive files to be loaded"),
199+
cl::value_desc("input archive"));
202200

203201
cl::opt<bool>
204202
EnableCacheManager("enable-cache-manager",

llvm/tools/llvm-cov/CodeCoverage.cpp

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -655,15 +655,15 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
655655
cl::opt<std::string> CovFilename(
656656
cl::Positional, cl::desc("Covered executable or object file."));
657657

658-
cl::list<std::string> CovFilenames(
658+
static cl::list<std::string> CovFilenames(
659659
"object", cl::desc("Coverage executable or object file"));
660660

661661
cl::opt<bool> DebugDumpCollectedObjects(
662662
"dump-collected-objects", cl::Optional, cl::Hidden,
663663
cl::desc("Show the collected coverage object files"));
664664

665-
cl::list<std::string> InputSourceFiles("sources", cl::Positional,
666-
cl::desc("<Source files>"));
665+
static cl::list<std::string> InputSourceFiles("sources", cl::Positional,
666+
cl::desc("<Source files>"));
667667

668668
cl::opt<bool> DebugDumpCollectedPaths(
669669
"dump-collected-paths", cl::Optional, cl::Hidden,
@@ -674,13 +674,13 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
674674
cl::desc(
675675
"File with the profile data obtained after an instrumented run"));
676676

677-
cl::list<std::string> Arches(
677+
static cl::list<std::string> Arches(
678678
"arch", cl::desc("architectures of the coverage mapping binaries"));
679679

680680
cl::opt<bool> DebugDump("dump", cl::Optional,
681681
cl::desc("Show internal debug dump"));
682682

683-
cl::list<std::string> DebugFileDirectory(
683+
static cl::list<std::string> DebugFileDirectory(
684684
"debug-file-directory",
685685
cl::desc("Directories to search for object files by build ID"));
686686
cl::opt<bool> Debuginfod(
@@ -698,31 +698,31 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
698698
"lcov tracefile output")),
699699
cl::init(CoverageViewOptions::OutputFormat::Text));
700700

701-
cl::list<std::string> PathRemaps(
701+
static cl::list<std::string> PathRemaps(
702702
"path-equivalence", cl::Optional,
703703
cl::desc("<from>,<to> Map coverage data paths to local source file "
704704
"paths"));
705705

706706
cl::OptionCategory FilteringCategory("Function filtering options");
707707

708-
cl::list<std::string> NameFilters(
708+
static cl::list<std::string> NameFilters(
709709
"name", cl::Optional,
710710
cl::desc("Show code coverage only for functions with the given name"),
711711
cl::cat(FilteringCategory));
712712

713-
cl::list<std::string> NameFilterFiles(
713+
static cl::list<std::string> NameFilterFiles(
714714
"name-allowlist", cl::Optional,
715715
cl::desc("Show code coverage only for functions listed in the given "
716716
"file"),
717717
cl::cat(FilteringCategory));
718718

719-
cl::list<std::string> NameRegexFilters(
719+
static cl::list<std::string> NameRegexFilters(
720720
"name-regex", cl::Optional,
721721
cl::desc("Show code coverage only for functions that match the given "
722722
"regular expression"),
723723
cl::cat(FilteringCategory));
724724

725-
cl::list<std::string> IgnoreFilenameRegexFilters(
725+
static cl::list<std::string> IgnoreFilenameRegexFilters(
726726
"ignore-filename-regex", cl::Optional,
727727
cl::desc("Skip source code files with file paths that match the given "
728728
"regular expression"),
@@ -756,7 +756,7 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
756756
"use-color", cl::desc("Emit colored output (default=autodetect)"),
757757
cl::init(cl::BOU_UNSET));
758758

759-
cl::list<std::string> DemanglerOpts(
759+
static cl::list<std::string> DemanglerOpts(
760760
"Xdemangler", cl::desc("<demangler-path>|<demangler-option>"));
761761

762762
cl::opt<bool> RegionSummary(
@@ -784,8 +784,8 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
784784
cl::opt<unsigned> NumThreads(
785785
"num-threads", cl::init(0),
786786
cl::desc("Number of merge threads to use (default: autodetect)"));
787-
cl::alias NumThreadsA("j", cl::desc("Alias for --num-threads"),
788-
cl::aliasopt(NumThreads));
787+
static cl::alias NumThreadsA("j", cl::desc("Alias for --num-threads"),
788+
cl::aliasopt(NumThreads));
789789

790790
cl::opt<std::string> CompilationDirectory(
791791
"compilation-dir", cl::init(""),
@@ -1020,8 +1020,8 @@ int CodeCoverageTool::doShow(int argc, const char **argv,
10201020
cl::opt<std::string> ShowOutputDirectory(
10211021
"output-dir", cl::init(""),
10221022
cl::desc("Directory in which coverage information is written out"));
1023-
cl::alias ShowOutputDirectoryA("o", cl::desc("Alias for --output-dir"),
1024-
cl::aliasopt(ShowOutputDirectory));
1023+
static cl::alias ShowOutputDirectoryA("o", cl::desc("Alias for --output-dir"),
1024+
cl::aliasopt(ShowOutputDirectory));
10251025

10261026
cl::opt<bool> BinaryCounters(
10271027
"binary-counters", cl::Optional,

llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ static cl::opt<std::string> NewSymbolFile(cl::Positional, cl::Required,
3636
static cl::opt<std::string> RemappingFile("remapping-file", cl::Required,
3737
cl::desc("Remapping file"),
3838
cl::cat(CXXMapCategory));
39-
cl::alias RemappingFileA("r", cl::aliasopt(RemappingFile),
40-
cl::cat(CXXMapCategory));
39+
static cl::alias RemappingFileA("r", cl::aliasopt(RemappingFile),
40+
cl::cat(CXXMapCategory));
4141
static cl::opt<std::string> OutputFilename("output", cl::value_desc("output"),
4242
cl::init("-"),
4343
cl::desc("Output file"),
4444
cl::cat(CXXMapCategory));
45-
cl::alias OutputFilenameA("o", cl::aliasopt(OutputFilename),
46-
cl::cat(CXXMapCategory));
45+
static cl::alias OutputFilenameA("o", cl::aliasopt(OutputFilename),
46+
cl::cat(CXXMapCategory));
4747

4848
static cl::opt<bool> WarnAmbiguous(
4949
"Wambiguous",

llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,10 @@ cl::ValuesClass ChunkValues = cl::values(
154154
clEnumValN(ModuleSubsection::All, "all", "All known subsections"));
155155

156156
namespace diadump {
157-
cl::list<std::string> InputFilenames(cl::Positional,
158-
cl::desc("<input PDB files>"),
159-
cl::OneOrMore, cl::sub(DiaDumpSubcommand));
157+
static cl::list<std::string> InputFilenames(cl::Positional,
158+
cl::desc("<input PDB files>"),
159+
cl::OneOrMore,
160+
cl::sub(DiaDumpSubcommand));
160161

161162
cl::opt<bool> Native("native", cl::desc("Use native PDB reader instead of DIA"),
162163
cl::sub(DiaDumpSubcommand));
@@ -198,9 +199,10 @@ static cl::opt<bool> Typedefs("typedefs", cl::desc("Dump typedefs"),
198199
FilterOptions Filters;
199200

200201
namespace pretty {
201-
cl::list<std::string> InputFilenames(cl::Positional,
202-
cl::desc("<input PDB files>"),
203-
cl::OneOrMore, cl::sub(PrettySubcommand));
202+
static cl::list<std::string> InputFilenames(cl::Positional,
203+
cl::desc("<input PDB files>"),
204+
cl::OneOrMore,
205+
cl::sub(PrettySubcommand));
204206

205207
cl::opt<bool> InjectedSources("injected-sources",
206208
cl::desc("Display injected sources"),
@@ -224,7 +226,7 @@ cl::opt<bool> Globals("globals", cl::desc("Dump global symbols"),
224226
cl::cat(TypeCategory), cl::sub(PrettySubcommand));
225227
cl::opt<bool> Externals("externals", cl::desc("Dump external symbols"),
226228
cl::cat(TypeCategory), cl::sub(PrettySubcommand));
227-
cl::list<SymLevel> SymTypes(
229+
static cl::list<SymLevel> SymTypes(
228230
"sym-types", cl::desc("Type of symbols to dump (default all)"),
229231
cl::cat(TypeCategory), cl::sub(PrettySubcommand),
230232
cl::values(
@@ -438,9 +440,10 @@ cl::opt<bool> SplitChunks(
438440
cl::desc(
439441
"When dumping debug chunks, show a different section for each chunk"),
440442
cl::sub(BytesSubcommand), cl::cat(ModuleCategory));
441-
cl::list<std::string> InputFilenames(cl::Positional,
442-
cl::desc("<input PDB files>"),
443-
cl::OneOrMore, cl::sub(BytesSubcommand));
443+
static cl::list<std::string> InputFilenames(cl::Positional,
444+
cl::desc("<input PDB files>"),
445+
cl::OneOrMore,
446+
cl::sub(BytesSubcommand));
444447

445448
} // namespace bytes
446449

@@ -640,9 +643,10 @@ cl::opt<bool> DumpSectionHeaders("section-headers",
640643
cl::opt<bool> RawAll("all", cl::desc("Implies most other options."),
641644
cl::cat(MiscOptions), cl::sub(DumpSubcommand));
642645

643-
cl::list<std::string> InputFilenames(cl::Positional,
644-
cl::desc("<input PDB files>"),
645-
cl::OneOrMore, cl::sub(DumpSubcommand));
646+
static cl::list<std::string> InputFilenames(cl::Positional,
647+
cl::desc("<input PDB files>"),
648+
cl::OneOrMore,
649+
cl::sub(DumpSubcommand));
646650
}
647651

648652
namespace yaml2pdb {
@@ -717,9 +721,10 @@ cl::list<std::string> InputFilename(cl::Positional,
717721
} // namespace pdb2yaml
718722

719723
namespace merge {
720-
cl::list<std::string> InputFilenames(cl::Positional,
721-
cl::desc("<input PDB files>"),
722-
cl::OneOrMore, cl::sub(MergeSubcommand));
724+
static cl::list<std::string> InputFilenames(cl::Positional,
725+
cl::desc("<input PDB files>"),
726+
cl::OneOrMore,
727+
cl::sub(MergeSubcommand));
723728
cl::opt<std::string>
724729
PdbOutputFile("pdb", cl::desc("the name of the PDB file to write"),
725730
cl::sub(MergeSubcommand));
@@ -749,9 +754,10 @@ cl::opt<InputFileType> InputType(
749754
} // namespace explain
750755

751756
namespace exportstream {
752-
cl::list<std::string> InputFilename(cl::Positional,
753-
cl::desc("<input PDB file>"), cl::Required,
754-
cl::sub(ExportSubcommand));
757+
static cl::list<std::string> InputFilename(cl::Positional,
758+
cl::desc("<input PDB file>"),
759+
cl::Required,
760+
cl::sub(ExportSubcommand));
755761
cl::opt<std::string> OutputFile("out",
756762
cl::desc("The file to write the stream to"),
757763
cl::Required, cl::sub(ExportSubcommand));

0 commit comments

Comments
 (0)