Skip to content

Commit 71f4c7d

Browse files
authored
[NFC]Make file-local cl::opt global variables static (#126486)
#125983
1 parent 1b043c2 commit 71f4c7d

File tree

52 files changed

+301
-288
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+301
-288
lines changed

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ using namespace llvm;
3131
// Command-line options
3232
//===----------------------------------------------------------------------===//
3333

34-
cl::opt<std::string>
35-
InputIR("input-IR",
36-
cl::desc("Specify the name of an IR file to load for function definitions"),
37-
cl::value_desc("input IR file name"));
38-
39-
cl::opt<bool>
40-
UseObjectCache("use-object-cache",
41-
cl::desc("Enable use of the MCJIT object caching"),
42-
cl::init(false));
34+
static cl::opt<std::string> InputIR(
35+
"input-IR",
36+
cl::desc("Specify the name of an IR file to load for function definitions"),
37+
cl::value_desc("input IR file name"));
38+
39+
static cl::opt<bool>
40+
UseObjectCache("use-object-cache",
41+
cl::desc("Enable use of the MCJIT object caching"),
42+
cl::init(false));
4343

4444
//===----------------------------------------------------------------------===//
4545
// Lexer

llvm/examples/OrcV2Examples/LLJITDumpObjects/LLJITDumpObjects.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ using namespace llvm::orc;
2121

2222
ExitOnError ExitOnErr;
2323

24-
cl::opt<bool> DumpJITdObjects("dump-jitted-objects",
25-
cl::desc("dump jitted objects"), cl::Optional,
26-
cl::init(true));
24+
static cl::opt<bool> DumpJITdObjects("dump-jitted-objects",
25+
cl::desc("dump jitted objects"),
26+
cl::Optional, cl::init(true));
2727

28-
cl::opt<std::string> DumpDir("dump-dir",
29-
cl::desc("directory to dump objects to"),
30-
cl::Optional, cl::init(""));
28+
static cl::opt<std::string> DumpDir("dump-dir",
29+
cl::desc("directory to dump objects to"),
30+
cl::Optional, cl::init(""));
3131

32-
cl::opt<std::string> DumpFileStem("dump-file-stem",
33-
cl::desc("Override default dump names"),
34-
cl::Optional, cl::init(""));
32+
static cl::opt<std::string>
33+
DumpFileStem("dump-file-stem", cl::desc("Override default dump names"),
34+
cl::Optional, cl::init(""));
3535

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

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/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ using namespace llvm;
5555
using namespace llvm::orc;
5656

5757
// Path of the module summary index file.
58-
cl::opt<std::string> IndexFile{cl::desc("<module summary index>"),
59-
cl::Positional, cl::init("-")};
58+
static cl::opt<std::string> IndexFile{cl::desc("<module summary index>"),
59+
cl::Positional, cl::init("-")};
6060

6161
// Describe a fail state that is caused by the given ModuleSummaryIndex
6262
// providing multiple definitions of the given global value name. It will dump

llvm/lib/Analysis/AliasAnalysis.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,10 @@ STATISTIC(NumNoAlias, "Number of NoAlias results");
5858
STATISTIC(NumMayAlias, "Number of MayAlias results");
5959
STATISTIC(NumMustAlias, "Number of MustAlias results");
6060

61-
namespace llvm {
6261
/// Allow disabling BasicAA from the AA results. This is particularly useful
6362
/// when testing to isolate a single AA implementation.
64-
cl::opt<bool> DisableBasicAA("disable-basic-aa", cl::Hidden, cl::init(false));
65-
} // namespace llvm
63+
static cl::opt<bool> DisableBasicAA("disable-basic-aa", cl::Hidden,
64+
cl::init(false));
6665

6766
#ifndef NDEBUG
6867
/// Print a trace of alias analysis queries and their results.

llvm/lib/Analysis/BranchProbabilityInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static cl::opt<bool> PrintBranchProb(
5454
"print-bpi", cl::init(false), cl::Hidden,
5555
cl::desc("Print the branch probability info."));
5656

57-
cl::opt<std::string> PrintBranchProbFuncName(
57+
static cl::opt<std::string> PrintBranchProbFuncName(
5858
"print-bpi-func-name", cl::Hidden,
5959
cl::desc("The option to specify the name of the function "
6060
"whose branch probability info is printed."));

llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ cl::opt<bool> EnableDetailedFunctionProperties(
3030
"enable-detailed-function-properties", cl::Hidden, cl::init(false),
3131
cl::desc("Whether or not to compute detailed function properties."));
3232

33-
cl::opt<unsigned> BigBasicBlockInstructionThreshold(
33+
static cl::opt<unsigned> BigBasicBlockInstructionThreshold(
3434
"big-basic-block-instruction-threshold", cl::Hidden, cl::init(500),
3535
cl::desc("The minimum number of instructions a basic block should contain "
3636
"before being considered big."));
3737

38-
cl::opt<unsigned> MediumBasicBlockInstructionThreshold(
38+
static cl::opt<unsigned> MediumBasicBlockInstructionThreshold(
3939
"medium-basic-block-instruction-threshold", cl::Hidden, cl::init(15),
4040
cl::desc("The minimum number of instructions a basic block should contain "
4141
"before being considered medium-sized."));

llvm/lib/Analysis/IRSimilarityIdentifier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ cl::opt<bool>
3636
cl::ReallyHidden,
3737
cl::desc("disable outlining indirect calls."));
3838

39-
cl::opt<bool>
39+
static cl::opt<bool>
4040
MatchCallsByName("ir-sim-calls-by-name", cl::init(false), cl::ReallyHidden,
4141
cl::desc("only allow matching call instructions if the "
4242
"name and type signature match."));

llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ AnalysisKey InlineSizeEstimatorAnalysis::Key;
3636
#include <deque>
3737
#include <optional>
3838

39-
cl::opt<std::string> TFIR2NativeModelPath(
39+
static cl::opt<std::string> TFIR2NativeModelPath(
4040
"ml-inliner-ir2native-model", cl::Hidden,
4141
cl::desc("Path to saved model evaluating native size from IR."));
4242

0 commit comments

Comments
 (0)