[Lldb-commits] [clang] [clang-tools-extra] [flang] [lldb] [llvm] [mlir] [polly] Add static to command line option (cl::opt) (PR #126243)
via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 7 05:18:54 PST 2025
https://github.com/chrisPyr created https://github.com/llvm/llvm-project/pull/126243
#125983
>From 1cd8a7681a338e4a6186b801416e69bcdecf66f1 Mon Sep 17 00:00:00 2001
From: Chris <smile51293 at gmail.com>
Date: Fri, 7 Feb 2025 19:09:02 +0800
Subject: [PATCH] Add static to command line option (cl::opt)
---
bolt/lib/Core/BinaryContext.cpp | 7 +-
bolt/lib/Core/BinaryData.cpp | 2 +-
bolt/lib/Core/BinaryFunction.cpp | 15 +-
bolt/lib/Passes/Aligner.cpp | 29 ++-
bolt/lib/Passes/ContinuityStats.cpp | 2 +-
bolt/lib/Passes/FrameOptimizer.cpp | 2 +-
bolt/lib/Passes/Instrumentation.cpp | 2 +-
bolt/lib/Passes/PLTCall.cpp | 26 +--
bolt/lib/Passes/RetpolineInsertion.cpp | 24 +--
bolt/lib/Passes/StokeInfo.cpp | 2 +-
bolt/lib/Passes/TailDuplication.cpp | 2 +-
bolt/lib/Profile/StaleProfileMatching.cpp | 24 +--
bolt/lib/Profile/YAMLProfileReader.cpp | 6 +-
bolt/lib/Rewrite/RewriteInstance.cpp | 25 +--
bolt/tools/bat-dump/bat-dump.cpp | 2 +-
bolt/tools/driver/llvm-bolt.cpp | 2 +-
bolt/tools/merge-fdata/merge-fdata.cpp | 2 +-
.../tool/ClangChangeNamespace.cpp | 35 ++--
.../tool/ClangIncludeFixer.cpp | 32 +--
.../clang-move/tool/ClangMove.cpp | 24 +--
.../tool/ClangReorderFields.cpp | 3 +-
.../clangd/index/dex/dexp/Dexp.cpp | 6 +-
.../clangd/index/remote/monitor/Monitor.cpp | 2 +-
.../clangd/index/remote/server/Server.cpp | 26 +--
clang-tools-extra/clangd/tool/Check.cpp | 13 +-
.../include-cleaner/tool/IncludeCleaner.cpp | 16 +-
.../ClangOffloadBundler.cpp | 74 +++----
clang/unittests/Tooling/ExecutionTest.cpp | 2 +-
clang/utils/TableGen/TableGen.cpp | 10 +-
flang/lib/Lower/OpenMP/Utils.cpp | 6 +-
flang/lib/Optimizer/Builder/IntrinsicCall.cpp | 2 +-
.../lib/Optimizer/Passes/CommandLineOpts.cpp | 20 +-
lldb/tools/lldb-test/lldb-test.cpp | 25 +--
.../Kaleidoscope/MCJIT/cached/toy-jit.cpp | 8 +-
.../Kaleidoscope/MCJIT/cached/toy.cpp | 18 +-
.../Kaleidoscope/MCJIT/complete/toy.cpp | 51 ++---
.../LLJITDumpObjects/LLJITDumpObjects.cpp | 18 +-
.../LLJITWithThinLTOSummaries.cpp | 4 +-
llvm/lib/Analysis/AliasAnalysis.cpp | 3 +-
llvm/lib/Analysis/BranchProbabilityInfo.cpp | 2 +-
.../Analysis/FunctionPropertiesAnalysis.cpp | 4 +-
llvm/lib/Analysis/IRSimilarityIdentifier.cpp | 2 +-
.../Analysis/InlineSizeEstimatorAnalysis.cpp | 2 +-
llvm/lib/Analysis/MemoryProfileInfo.cpp | 2 +-
llvm/lib/CGData/CodeGenData.cpp | 4 +-
.../CodeGen/AsmPrinter/DwarfCompileUnit.cpp | 2 +-
llvm/lib/CodeGen/MachinePipeliner.cpp | 2 +-
llvm/lib/CodeGen/MachineScheduler.cpp | 18 +-
llvm/lib/CodeGen/MachineStripDebug.cpp | 2 +-
llvm/lib/CodeGen/WindowScheduler.cpp | 12 +-
llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp | 30 +--
llvm/lib/LTO/LTOCodeGenerator.cpp | 13 +-
.../AArch64LowerHomogeneousPrologEpilog.cpp | 2 +-
.../AArch64/AArch64StackTaggingPreRA.cpp | 5 +-
.../AArch64/AArch64TargetTransformInfo.cpp | 2 +-
.../AMDGPU/AMDGPULowerModuleLDSPass.cpp | 4 +-
llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp | 2 +-
llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp | 2 +-
.../Target/ARM/MVELaneInterleavingPass.cpp | 2 +-
.../Target/Hexagon/HexagonCopyToCombine.cpp | 11 +-
.../Target/Hexagon/HexagonISelDAGToDAG.cpp | 25 +--
.../Target/Hexagon/HexagonVectorCombine.cpp | 18 +-
.../MCTargetDesc/HexagonMCTargetDesc.cpp | 62 +++---
.../WebAssembly/WebAssemblyMCInstLower.cpp | 2 +-
.../Target/X86/MCTargetDesc/X86AsmBackend.cpp | 35 ++--
llvm/lib/Transforms/IPO/ElimAvailExtern.cpp | 2 +-
llvm/lib/Transforms/IPO/ExpandVariadics.cpp | 2 +-
.../IPO/MemProfContextDisambiguation.cpp | 2 +-
llvm/lib/Transforms/IPO/ModuleInliner.cpp | 2 +-
.../Instrumentation/InstrProfiling.cpp | 35 ++--
.../SanitizerBinaryMetadata.cpp | 25 +--
llvm/lib/Transforms/Scalar/LICM.cpp | 2 +-
llvm/lib/Transforms/Utils/Debugify.cpp | 8 +-
.../Vectorize/LoopVectorizationLegality.cpp | 2 +-
.../Transforms/Vectorize/LoopVectorize.cpp | 2 +-
.../SandboxVectorizer/SeedCollector.cpp | 6 +-
llvm/tools/bugpoint/BugDriver.cpp | 6 +-
llvm/tools/bugpoint/CrashDebugger.cpp | 62 +++---
llvm/tools/bugpoint/ExecutionDriver.cpp | 32 +--
llvm/tools/bugpoint/ExtractFunction.cpp | 7 +-
llvm/tools/bugpoint/OptimizerDriver.cpp | 2 +-
llvm/tools/bugpoint/ToolRunner.cpp | 16 +-
llvm/tools/lli/lli.cpp | 152 +++++++-------
llvm/tools/llvm-as/llvm-as.cpp | 2 +-
llvm/tools/llvm-cat/llvm-cat.cpp | 2 +-
.../tools/llvm-cfi-verify/llvm-cfi-verify.cpp | 24 ++-
llvm/tools/llvm-cov/CodeCoverage.cpp | 122 +++++------
llvm/tools/llvm-cov/TestingSupport.cpp | 6 +-
llvm/tools/llvm-cov/gcov.cpp | 76 +++----
llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp | 2 +-
llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp | 33 +--
llvm/tools/llvm-diff/llvm-diff.cpp | 2 +-
llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp | 11 +-
llvm/tools/llvm-extract/llvm-extract.cpp | 2 +-
llvm/tools/llvm-jitlink/llvm-jitlink.cpp | 6 +-
llvm/tools/llvm-lto/llvm-lto.cpp | 2 +-
llvm/tools/llvm-lto2/llvm-lto2.cpp | 2 +-
llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp | 26 +--
llvm/tools/llvm-profdata/llvm-profdata.cpp | 190 +++++++++---------
llvm/tools/llvm-undname/llvm-undname.cpp | 51 ++---
.../reduce-chunk-list/reduce-chunk-list.cpp | 6 +-
llvm/tools/yaml2obj/yaml2obj.cpp | 20 +-
llvm/unittests/Support/CommandLineTest.cpp | 12 +-
llvm/utils/KillTheDoctor/KillTheDoctor.cpp | 67 +++---
llvm/utils/TableGen/DAGISelMatcherEmitter.cpp | 2 +-
llvm/utils/TableGen/DecoderEmitter.cpp | 2 +-
.../TableGen/GlobalISelCombinerEmitter.cpp | 12 +-
llvm/utils/TableGen/GlobalISelEmitter.cpp | 2 +-
llvm/utils/TableGen/RegisterInfoEmitter.cpp | 2 +-
llvm/utils/fpcmp/fpcmp.cpp | 16 +-
llvm/utils/yaml-bench/YAMLBench.cpp | 2 +-
.../mlir-lsp-server/MlirLspServerMain.cpp | 8 +-
.../MlirPdllLspServerMain.cpp | 8 +-
mlir/lib/Tools/mlir-tblgen/MlirTblgenMain.cpp | 7 +-
.../TableGenLspServerMain.cpp | 8 +-
mlir/tools/mlir-pdll/mlir-pdll.cpp | 16 +-
mlir/tools/mlir-rewrite/mlir-rewrite.cpp | 3 +-
mlir/tools/mlir-runner/mlir-runner.cpp | 2 +-
.../mlir-src-sharder/mlir-src-sharder.cpp | 14 +-
mlir/tools/mlir-tblgen/DialectGen.cpp | 2 +-
mlir/tools/mlir-tblgen/OpDocGen.cpp | 4 +-
mlir/tools/mlir-tblgen/OpGenHelpers.cpp | 2 +-
.../tools/tblgen-to-irdl/OpDefinitionsGen.cpp | 2 +-
.../kernelreplay/llvm-omp-kernel-replay.cpp | 2 +-
.../tools/offload-tblgen/offload-tblgen.cpp | 2 +-
polly/lib/CodeGen/LoopGenerators.cpp | 2 +-
polly/lib/Transform/DeLICM.cpp | 14 +-
polly/lib/Transform/DeadCodeElimination.cpp | 2 +-
128 files changed, 1009 insertions(+), 995 deletions(-)
diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp
index f9fc536f3569ad3..637b6785916fed3 100644
--- a/bolt/lib/Core/BinaryContext.cpp
+++ b/bolt/lib/Core/BinaryContext.cpp
@@ -46,9 +46,10 @@ using namespace llvm;
namespace opts {
-cl::opt<bool> NoHugePages("no-huge-pages",
- cl::desc("use regular size pages for code alignment"),
- cl::Hidden, cl::cat(BoltCategory));
+static cl::opt<bool>
+ NoHugePages("no-huge-pages",
+ cl::desc("use regular size pages for code alignment"),
+ cl::Hidden, cl::cat(BoltCategory));
static cl::opt<bool>
PrintDebugInfo("print-debug-info",
diff --git a/bolt/lib/Core/BinaryData.cpp b/bolt/lib/Core/BinaryData.cpp
index e9ddf08d8695f46..88f13eafd614d95 100644
--- a/bolt/lib/Core/BinaryData.cpp
+++ b/bolt/lib/Core/BinaryData.cpp
@@ -24,7 +24,7 @@ namespace opts {
extern cl::OptionCategory BoltCategory;
extern cl::opt<unsigned> Verbosity;
-cl::opt<bool>
+static cl::opt<bool>
PrintSymbolAliases("print-aliases",
cl::desc("print aliases when printing objects"),
cl::Hidden, cl::cat(BoltCategory));
diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp
index bc45caf3ec8b749..4dcf9534fd36081 100644
--- a/bolt/lib/Core/BinaryFunction.cpp
+++ b/bolt/lib/Core/BinaryFunction.cpp
@@ -66,7 +66,7 @@ extern cl::opt<unsigned> Verbosity;
extern bool processAllFunctions();
-cl::opt<bool> CheckEncoding(
+static cl::opt<bool> CheckEncoding(
"check-encoding",
cl::desc("perform verification of LLVM instruction encoding/decoding. "
"Every instruction in the input is decoded and re-encoded. "
@@ -143,14 +143,11 @@ cl::opt<bool>
cl::desc("print time spent constructing binary functions"),
cl::Hidden, cl::cat(BoltCategory));
-cl::opt<bool>
-TrapOnAVX512("trap-avx512",
- cl::desc("in relocation mode trap upon entry to any function that uses "
- "AVX-512 instructions"),
- cl::init(false),
- cl::ZeroOrMore,
- cl::Hidden,
- cl::cat(BoltCategory));
+static cl::opt<bool> TrapOnAVX512(
+ "trap-avx512",
+ cl::desc("in relocation mode trap upon entry to any function that uses "
+ "AVX-512 instructions"),
+ cl::init(false), cl::ZeroOrMore, cl::Hidden, cl::cat(BoltCategory));
bool shouldPrint(const BinaryFunction &Function) {
if (Function.isIgnored())
diff --git a/bolt/lib/Passes/Aligner.cpp b/bolt/lib/Passes/Aligner.cpp
index 555f82a5a817808..c3ddedaaa14660a 100644
--- a/bolt/lib/Passes/Aligner.cpp
+++ b/bolt/lib/Passes/Aligner.cpp
@@ -25,15 +25,12 @@ extern cl::opt<bool> AlignBlocks;
extern cl::opt<bool> PreserveBlocksAlignment;
extern cl::opt<unsigned> AlignFunctions;
-cl::opt<unsigned>
-AlignBlocksMinSize("align-blocks-min-size",
- cl::desc("minimal size of the basic block that should be aligned"),
- cl::init(0),
- cl::ZeroOrMore,
- cl::Hidden,
- cl::cat(BoltOptCategory));
-
-cl::opt<unsigned> AlignBlocksThreshold(
+static cl::opt<unsigned> AlignBlocksMinSize(
+ "align-blocks-min-size",
+ cl::desc("minimal size of the basic block that should be aligned"),
+ cl::init(0), cl::ZeroOrMore, cl::Hidden, cl::cat(BoltOptCategory));
+
+static cl::opt<unsigned> AlignBlocksThreshold(
"align-blocks-threshold",
cl::desc(
"align only blocks with frequency larger than containing function "
@@ -42,19 +39,17 @@ cl::opt<unsigned> AlignBlocksThreshold(
"containing function."),
cl::init(800), cl::Hidden, cl::cat(BoltOptCategory));
-cl::opt<unsigned> AlignFunctionsMaxBytes(
+static cl::opt<unsigned> AlignFunctionsMaxBytes(
"align-functions-max-bytes",
cl::desc("maximum number of bytes to use to align functions"), cl::init(32),
cl::cat(BoltOptCategory));
-cl::opt<unsigned>
-BlockAlignment("block-alignment",
- cl::desc("boundary to use for alignment of basic blocks"),
- cl::init(16),
- cl::ZeroOrMore,
- cl::cat(BoltOptCategory));
+static cl::opt<unsigned>
+ BlockAlignment("block-alignment",
+ cl::desc("boundary to use for alignment of basic blocks"),
+ cl::init(16), cl::ZeroOrMore, cl::cat(BoltOptCategory));
-cl::opt<bool>
+static cl::opt<bool>
UseCompactAligner("use-compact-aligner",
cl::desc("Use compact approach for aligning functions"),
cl::init(true), cl::cat(BoltOptCategory));
diff --git a/bolt/lib/Passes/ContinuityStats.cpp b/bolt/lib/Passes/ContinuityStats.cpp
index b32365b59065dce..af5fb6285a90b5d 100644
--- a/bolt/lib/Passes/ContinuityStats.cpp
+++ b/bolt/lib/Passes/ContinuityStats.cpp
@@ -26,7 +26,7 @@ using namespace bolt;
namespace opts {
extern cl::opt<unsigned> Verbosity;
-cl::opt<unsigned> NumFunctionsForContinuityCheck(
+static cl::opt<unsigned> NumFunctionsForContinuityCheck(
"num-functions-for-continuity-check",
cl::desc("number of hottest functions to print aggregated "
"CFG discontinuity stats of."),
diff --git a/bolt/lib/Passes/FrameOptimizer.cpp b/bolt/lib/Passes/FrameOptimizer.cpp
index 1c0f9555f9eb9be..81d4d9367f58ccb 100644
--- a/bolt/lib/Passes/FrameOptimizer.cpp
+++ b/bolt/lib/Passes/FrameOptimizer.cpp
@@ -43,7 +43,7 @@ FrameOptimization("frame-opt",
cl::ZeroOrMore,
cl::cat(BoltOptCategory));
-cl::opt<bool> RemoveStores(
+static cl::opt<bool> RemoveStores(
"frame-opt-rm-stores", cl::init(FOP_NONE),
cl::desc("apply additional analysis to remove stores (experimental)"),
cl::cat(BoltOptCategory));
diff --git a/bolt/lib/Passes/Instrumentation.cpp b/bolt/lib/Passes/Instrumentation.cpp
index 76766b05b917607..ed40e63611abd52 100644
--- a/bolt/lib/Passes/Instrumentation.cpp
+++ b/bolt/lib/Passes/Instrumentation.cpp
@@ -71,7 +71,7 @@ cl::opt<bool> InstrumentationWaitForks(
"(use with instrumentation-sleep-time option)"),
cl::init(false), cl::Optional, cl::cat(BoltInstrCategory));
-cl::opt<bool>
+static cl::opt<bool>
InstrumentHotOnly("instrument-hot-only",
cl::desc("only insert instrumentation on hot functions "
"(needs profile, default: false)"),
diff --git a/bolt/lib/Passes/PLTCall.cpp b/bolt/lib/Passes/PLTCall.cpp
index 31c2d92ebc20413..90b5f586a7bad6d 100644
--- a/bolt/lib/Passes/PLTCall.cpp
+++ b/bolt/lib/Passes/PLTCall.cpp
@@ -22,22 +22,16 @@ namespace opts {
extern cl::OptionCategory BoltOptCategory;
-cl::opt<bolt::PLTCall::OptType>
-PLT("plt",
- cl::desc("optimize PLT calls (requires linking with -znow)"),
- cl::init(bolt::PLTCall::OT_NONE),
- cl::values(clEnumValN(bolt::PLTCall::OT_NONE,
- "none",
- "do not optimize PLT calls"),
- clEnumValN(bolt::PLTCall::OT_HOT,
- "hot",
- "optimize executed (hot) PLT calls"),
- clEnumValN(bolt::PLTCall::OT_ALL,
- "all",
- "optimize all PLT calls")),
- cl::ZeroOrMore,
- cl::cat(BoltOptCategory));
-
+static cl::opt<bolt::PLTCall::OptType>
+ PLT("plt", cl::desc("optimize PLT calls (requires linking with -znow)"),
+ cl::init(bolt::PLTCall::OT_NONE),
+ cl::values(clEnumValN(bolt::PLTCall::OT_NONE, "none",
+ "do not optimize PLT calls"),
+ clEnumValN(bolt::PLTCall::OT_HOT, "hot",
+ "optimize executed (hot) PLT calls"),
+ clEnumValN(bolt::PLTCall::OT_ALL, "all",
+ "optimize all PLT calls")),
+ cl::ZeroOrMore, cl::cat(BoltOptCategory));
}
namespace llvm {
diff --git a/bolt/lib/Passes/RetpolineInsertion.cpp b/bolt/lib/Passes/RetpolineInsertion.cpp
index 171177d9e933326..f8702893a222b16 100644
--- a/bolt/lib/Passes/RetpolineInsertion.cpp
+++ b/bolt/lib/Passes/RetpolineInsertion.cpp
@@ -33,19 +33,17 @@ namespace opts {
extern cl::OptionCategory BoltCategory;
-llvm::cl::opt<bool> InsertRetpolines("insert-retpolines",
- cl::desc("run retpoline insertion pass"),
- cl::cat(BoltCategory));
-
-llvm::cl::opt<bool>
-RetpolineLfence("retpoline-lfence",
- cl::desc("determine if lfence instruction should exist in the retpoline"),
- cl::init(true),
- cl::ZeroOrMore,
- cl::Hidden,
- cl::cat(BoltCategory));
-
-cl::opt<RetpolineInsertion::AvailabilityOptions> R11Availability(
+static llvm::cl::opt<bool>
+ InsertRetpolines("insert-retpolines",
+ cl::desc("run retpoline insertion pass"),
+ cl::cat(BoltCategory));
+
+static llvm::cl::opt<bool> RetpolineLfence(
+ "retpoline-lfence",
+ cl::desc("determine if lfence instruction should exist in the retpoline"),
+ cl::init(true), cl::ZeroOrMore, cl::Hidden, cl::cat(BoltCategory));
+
+static cl::opt<RetpolineInsertion::AvailabilityOptions> R11Availability(
"r11-availability",
cl::desc("determine the availability of r11 before indirect branches"),
cl::init(RetpolineInsertion::AvailabilityOptions::NEVER),
diff --git a/bolt/lib/Passes/StokeInfo.cpp b/bolt/lib/Passes/StokeInfo.cpp
index dd033508d200c10..9da460a2877c907 100644
--- a/bolt/lib/Passes/StokeInfo.cpp
+++ b/bolt/lib/Passes/StokeInfo.cpp
@@ -21,7 +21,7 @@ using namespace llvm;
using namespace bolt;
namespace opts {
-cl::OptionCategory StokeOptCategory("STOKE pass options");
+static cl::OptionCategory StokeOptCategory("STOKE pass options");
static cl::opt<std::string>
StokeOutputDataFilename("stoke-out",
diff --git a/bolt/lib/Passes/TailDuplication.cpp b/bolt/lib/Passes/TailDuplication.cpp
index 463ea49527fa6cd..354f9b78830c301 100644
--- a/bolt/lib/Passes/TailDuplication.cpp
+++ b/bolt/lib/Passes/TailDuplication.cpp
@@ -26,7 +26,7 @@ namespace opts {
extern cl::OptionCategory BoltOptCategory;
extern cl::opt<bool> NoThreads;
-cl::opt<bolt::TailDuplication::DuplicationMode> TailDuplicationMode(
+static cl::opt<bolt::TailDuplication::DuplicationMode> TailDuplicationMode(
"tail-duplication",
cl::desc("duplicate unconditional branches that cross a cache line"),
cl::init(bolt::TailDuplication::TD_NONE),
diff --git a/bolt/lib/Profile/StaleProfileMatching.cpp b/bolt/lib/Profile/StaleProfileMatching.cpp
index b66a3f478f1a7b0..1a61949d774726d 100644
--- a/bolt/lib/Profile/StaleProfileMatching.cpp
+++ b/bolt/lib/Profile/StaleProfileMatching.cpp
@@ -52,66 +52,66 @@ cl::opt<bool>
cl::desc("Infer counts from stale profile data."),
cl::init(false), cl::Hidden, cl::cat(BoltOptCategory));
-cl::opt<unsigned> StaleMatchingMinMatchedBlock(
+static cl::opt<unsigned> StaleMatchingMinMatchedBlock(
"stale-matching-min-matched-block",
cl::desc("Percentage threshold of matched basic blocks at which stale "
"profile inference is executed."),
cl::init(0), cl::Hidden, cl::cat(BoltOptCategory));
-cl::opt<unsigned> StaleMatchingMaxFuncSize(
+static cl::opt<unsigned> StaleMatchingMaxFuncSize(
"stale-matching-max-func-size",
cl::desc("The maximum size of a function to consider for inference."),
cl::init(10000), cl::Hidden, cl::cat(BoltOptCategory));
// Parameters of the profile inference algorithm. The default values are tuned
// on several benchmarks.
-cl::opt<bool> StaleMatchingEvenFlowDistribution(
+static cl::opt<bool> StaleMatchingEvenFlowDistribution(
"stale-matching-even-flow-distribution",
cl::desc("Try to evenly distribute flow when there are multiple equally "
"likely options."),
cl::init(true), cl::ReallyHidden, cl::cat(BoltOptCategory));
-cl::opt<bool> StaleMatchingRebalanceUnknown(
+static cl::opt<bool> StaleMatchingRebalanceUnknown(
"stale-matching-rebalance-unknown",
cl::desc("Evenly re-distribute flow among unknown subgraphs."),
cl::init(false), cl::ReallyHidden, cl::cat(BoltOptCategory));
-cl::opt<bool> StaleMatchingJoinIslands(
+static cl::opt<bool> StaleMatchingJoinIslands(
"stale-matching-join-islands",
cl::desc("Join isolated components having positive flow."), cl::init(true),
cl::ReallyHidden, cl::cat(BoltOptCategory));
-cl::opt<unsigned> StaleMatchingCostBlockInc(
+static cl::opt<unsigned> StaleMatchingCostBlockInc(
"stale-matching-cost-block-inc",
cl::desc("The cost of increasing a block count by one."), cl::init(150),
cl::ReallyHidden, cl::cat(BoltOptCategory));
-cl::opt<unsigned> StaleMatchingCostBlockDec(
+static cl::opt<unsigned> StaleMatchingCostBlockDec(
"stale-matching-cost-block-dec",
cl::desc("The cost of decreasing a block count by one."), cl::init(150),
cl::ReallyHidden, cl::cat(BoltOptCategory));
-cl::opt<unsigned> StaleMatchingCostJumpInc(
+static cl::opt<unsigned> StaleMatchingCostJumpInc(
"stale-matching-cost-jump-inc",
cl::desc("The cost of increasing a jump count by one."), cl::init(150),
cl::ReallyHidden, cl::cat(BoltOptCategory));
-cl::opt<unsigned> StaleMatchingCostJumpDec(
+static cl::opt<unsigned> StaleMatchingCostJumpDec(
"stale-matching-cost-jump-dec",
cl::desc("The cost of decreasing a jump count by one."), cl::init(150),
cl::ReallyHidden, cl::cat(BoltOptCategory));
-cl::opt<unsigned> StaleMatchingCostBlockUnknownInc(
+static cl::opt<unsigned> StaleMatchingCostBlockUnknownInc(
"stale-matching-cost-block-unknown-inc",
cl::desc("The cost of increasing an unknown block count by one."),
cl::init(1), cl::ReallyHidden, cl::cat(BoltOptCategory));
-cl::opt<unsigned> StaleMatchingCostJumpUnknownInc(
+static cl::opt<unsigned> StaleMatchingCostJumpUnknownInc(
"stale-matching-cost-jump-unknown-inc",
cl::desc("The cost of increasing an unknown jump count by one."),
cl::init(140), cl::ReallyHidden, cl::cat(BoltOptCategory));
-cl::opt<unsigned> StaleMatchingCostJumpUnknownFTInc(
+static cl::opt<unsigned> StaleMatchingCostJumpUnknownFTInc(
"stale-matching-cost-jump-unknown-ft-inc",
cl::desc(
"The cost of increasing an unknown fall-through jump count by one."),
diff --git a/bolt/lib/Profile/YAMLProfileReader.cpp b/bolt/lib/Profile/YAMLProfileReader.cpp
index e3872b373f41788..f5636bfe3e1f19e 100644
--- a/bolt/lib/Profile/YAMLProfileReader.cpp
+++ b/bolt/lib/Profile/YAMLProfileReader.cpp
@@ -28,7 +28,7 @@ extern cl::OptionCategory BoltOptCategory;
extern cl::opt<bool> InferStaleProfile;
extern cl::opt<bool> Lite;
-cl::opt<unsigned> NameSimilarityFunctionMatchingThreshold(
+static cl::opt<unsigned> NameSimilarityFunctionMatchingThreshold(
"name-similarity-function-matching-threshold",
cl::desc("Match functions using namespace and edit distance"), cl::init(0),
cl::Hidden, cl::cat(BoltOptCategory));
@@ -38,11 +38,11 @@ static llvm::cl::opt<bool>
cl::desc("ignore hash while reading function profile"),
cl::Hidden, cl::cat(BoltOptCategory));
-llvm::cl::opt<bool>
+static llvm::cl::opt<bool>
MatchProfileWithFunctionHash("match-profile-with-function-hash",
cl::desc("Match profile with function hash"),
cl::Hidden, cl::cat(BoltOptCategory));
-llvm::cl::opt<bool>
+static llvm::cl::opt<bool>
MatchWithCallGraph("match-with-call-graph",
cl::desc("Match functions with call graph"), cl::Hidden,
cl::cat(BoltOptCategory));
diff --git a/bolt/lib/Rewrite/RewriteInstance.cpp b/bolt/lib/Rewrite/RewriteInstance.cpp
index 4329235d4704972..a5a23a19256712a 100644
--- a/bolt/lib/Rewrite/RewriteInstance.cpp
+++ b/bolt/lib/Rewrite/RewriteInstance.cpp
@@ -90,9 +90,10 @@ extern cl::opt<bolt::IdenticalCodeFolding::ICFLevel, false,
llvm::bolt::DeprecatedICFNumericOptionParser>
ICF;
-cl::opt<bool> AllowStripped("allow-stripped",
- cl::desc("allow processing of stripped binaries"),
- cl::Hidden, cl::cat(BoltCategory));
+static cl::opt<bool>
+ AllowStripped("allow-stripped",
+ cl::desc("allow processing of stripped binaries"), cl::Hidden,
+ cl::cat(BoltCategory));
static cl::opt<bool> ForceToDataRelocations(
"force-data-relocations",
@@ -100,7 +101,7 @@ static cl::opt<bool> ForceToDataRelocations(
cl::Hidden, cl::cat(BoltCategory));
-cl::opt<std::string>
+static cl::opt<std::string>
BoltID("bolt-id",
cl::desc("add any string to tag this execution in the "
"output binary via bolt info section"),
@@ -174,9 +175,10 @@ cl::opt<bool> PrintAll("print-all",
cl::desc("print functions after each stage"), cl::Hidden,
cl::cat(BoltCategory));
-cl::opt<bool> PrintProfile("print-profile",
- cl::desc("print functions after attaching profile"),
- cl::Hidden, cl::cat(BoltCategory));
+static cl::opt<bool>
+ PrintProfile("print-profile",
+ cl::desc("print functions after attaching profile"),
+ cl::Hidden, cl::cat(BoltCategory));
cl::opt<bool> PrintCFG("print-cfg",
cl::desc("print functions after CFG construction"),
@@ -217,11 +219,10 @@ SkipFunctionNamesFile("skip-funcs-file",
cl::Hidden,
cl::cat(BoltCategory));
-cl::opt<bool>
-TrapOldCode("trap-old-code",
- cl::desc("insert traps in old function bodies (relocation mode)"),
- cl::Hidden,
- cl::cat(BoltCategory));
+static cl::opt<bool> TrapOldCode(
+ "trap-old-code",
+ cl::desc("insert traps in old function bodies (relocation mode)"),
+ cl::Hidden, cl::cat(BoltCategory));
static cl::opt<std::string> DWPPathName("dwp",
cl::desc("Path and name to DWP file."),
diff --git a/bolt/tools/bat-dump/bat-dump.cpp b/bolt/tools/bat-dump/bat-dump.cpp
index 709eb076bca2da7..8a743cba175401f 100644
--- a/bolt/tools/bat-dump/bat-dump.cpp
+++ b/bolt/tools/bat-dump/bat-dump.cpp
@@ -39,7 +39,7 @@ using namespace bolt;
namespace opts {
-cl::OptionCategory BatDumpCategory("BAT dump options");
+static cl::OptionCategory BatDumpCategory("BAT dump options");
static cl::OptionCategory *BatDumpCategories[] = {&BatDumpCategory};
diff --git a/bolt/tools/driver/llvm-bolt.cpp b/bolt/tools/driver/llvm-bolt.cpp
index efa06cd68cb997d..4ce699e501de0a1 100644
--- a/bolt/tools/driver/llvm-bolt.cpp
+++ b/bolt/tools/driver/llvm-bolt.cpp
@@ -63,7 +63,7 @@ BoltProfile("b",
cl::aliasopt(InputDataFilename),
cl::cat(BoltCategory));
-cl::opt<std::string>
+static cl::opt<std::string>
LogFile("log-file",
cl::desc("redirect journaling to a file instead of stdout/stderr"),
cl::Hidden, cl::cat(BoltCategory));
diff --git a/bolt/tools/merge-fdata/merge-fdata.cpp b/bolt/tools/merge-fdata/merge-fdata.cpp
index 74a5f8ca2d47780..864aa674741997b 100644
--- a/bolt/tools/merge-fdata/merge-fdata.cpp
+++ b/bolt/tools/merge-fdata/merge-fdata.cpp
@@ -31,7 +31,7 @@ using namespace llvm::yaml::bolt;
namespace opts {
-cl::OptionCategory MergeFdataCategory("merge-fdata options");
+static cl::OptionCategory MergeFdataCategory("merge-fdata options");
enum SortType : char {
ST_NONE,
diff --git a/clang-tools-extra/clang-change-namespace/tool/ClangChangeNamespace.cpp b/clang-tools-extra/clang-change-namespace/tool/ClangChangeNamespace.cpp
index 22d26db0c11bcf0..d5457aaf67ea1f3 100644
--- a/clang-tools-extra/clang-change-namespace/tool/ClangChangeNamespace.cpp
+++ b/clang-tools-extra/clang-change-namespace/tool/ClangChangeNamespace.cpp
@@ -45,34 +45,35 @@ using namespace llvm;
namespace {
-cl::OptionCategory ChangeNamespaceCategory("Change namespace.");
+static cl::OptionCategory ChangeNamespaceCategory("Change namespace.");
-cl::opt<std::string> OldNamespace("old_namespace", cl::Required,
- cl::desc("Old namespace."),
- cl::cat(ChangeNamespaceCategory));
+static cl::opt<std::string> OldNamespace("old_namespace", cl::Required,
+ cl::desc("Old namespace."),
+ cl::cat(ChangeNamespaceCategory));
-cl::opt<std::string> NewNamespace("new_namespace", cl::Required,
- cl::desc("New namespace."),
- cl::cat(ChangeNamespaceCategory));
+static cl::opt<std::string> NewNamespace("new_namespace", cl::Required,
+ cl::desc("New namespace."),
+ cl::cat(ChangeNamespaceCategory));
-cl::opt<std::string> FilePattern(
+static cl::opt<std::string> FilePattern(
"file_pattern", cl::Required,
cl::desc("Only rename namespaces in files that match the given pattern."),
cl::cat(ChangeNamespaceCategory));
-cl::opt<bool> Inplace("i", cl::desc("Inplace edit <file>s, if specified."),
- cl::cat(ChangeNamespaceCategory));
+static cl::opt<bool> Inplace("i",
+ cl::desc("Inplace edit <file>s, if specified."),
+ cl::cat(ChangeNamespaceCategory));
-cl::opt<bool>
+static cl::opt<bool>
DumpYAML("dump_result",
- cl::desc("Dump new file contents in YAML, if specified."),
- cl::cat(ChangeNamespaceCategory));
+ cl::desc("Dump new file contents in YAML, if specified."),
+ cl::cat(ChangeNamespaceCategory));
-cl::opt<std::string> Style("style",
- cl::desc("The style name used for reformatting."),
- cl::init("LLVM"), cl::cat(ChangeNamespaceCategory));
+static cl::opt<std::string>
+ Style("style", cl::desc("The style name used for reformatting."),
+ cl::init("LLVM"), cl::cat(ChangeNamespaceCategory));
-cl::opt<std::string> AllowedFile(
+static cl::opt<std::string> AllowedFile(
"allowed_file",
cl::desc("A file containing regexes of symbol names that are not expected "
"to be updated when changing namespaces around them."),
diff --git a/clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp b/clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp
index 6e51f25a6640742..5f1eebaf5d9f79d 100644
--- a/clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp
+++ b/clang-tools-extra/clang-include-fixer/tool/ClangIncludeFixer.cpp
@@ -79,7 +79,7 @@ template <> struct MappingTraits<IncludeFixerContext> {
} // namespace llvm
namespace {
-cl::OptionCategory IncludeFixerCategory("Tool options");
+static cl::OptionCategory IncludeFixerCategory("Tool options");
enum DatabaseFormatTy {
fixed, ///< Hard-coded mapping.
@@ -87,32 +87,32 @@ enum DatabaseFormatTy {
fuzzyYaml, ///< Yaml database with fuzzy-matched identifiers.
};
-cl::opt<DatabaseFormatTy> DatabaseFormat(
+static cl::opt<DatabaseFormatTy> DatabaseFormat(
"db", cl::desc("Specify input format"),
cl::values(clEnumVal(fixed, "Hard-coded mapping"),
clEnumVal(yaml, "Yaml database created by find-all-symbols"),
clEnumVal(fuzzyYaml, "Yaml database, with fuzzy-matched names")),
cl::init(yaml), cl::cat(IncludeFixerCategory));
-cl::opt<std::string> Input("input",
- cl::desc("String to initialize the database"),
- cl::cat(IncludeFixerCategory));
+static cl::opt<std::string> Input("input",
+ cl::desc("String to initialize the database"),
+ cl::cat(IncludeFixerCategory));
-cl::opt<std::string>
+static cl::opt<std::string>
QuerySymbol("query-symbol",
- cl::desc("Query a given symbol (e.g. \"a::b::foo\") in\n"
- "database directly without parsing the file."),
- cl::cat(IncludeFixerCategory));
+ cl::desc("Query a given symbol (e.g. \"a::b::foo\") in\n"
+ "database directly without parsing the file."),
+ cl::cat(IncludeFixerCategory));
-cl::opt<bool>
+static cl::opt<bool>
MinimizeIncludePaths("minimize-paths",
cl::desc("Whether to minimize added include paths"),
cl::init(true), cl::cat(IncludeFixerCategory));
-cl::opt<bool> Quiet("q", cl::desc("Reduce terminal output"), cl::init(false),
- cl::cat(IncludeFixerCategory));
+static cl::opt<bool> Quiet("q", cl::desc("Reduce terminal output"),
+ cl::init(false), cl::cat(IncludeFixerCategory));
-cl::opt<bool>
+static cl::opt<bool>
STDINMode("stdin",
cl::desc("Override source file's content (in the overlaying\n"
"virtual file system) with input from <stdin> and run\n"
@@ -121,7 +121,7 @@ cl::opt<bool>
"used for editor integration."),
cl::init(false), cl::cat(IncludeFixerCategory));
-cl::opt<bool> OutputHeaders(
+static cl::opt<bool> OutputHeaders(
"output-headers",
cl::desc("Print the symbol being queried and all its relevant headers in\n"
"JSON format to stdout:\n"
@@ -136,7 +136,7 @@ cl::opt<bool> OutputHeaders(
" }"),
cl::init(false), cl::cat(IncludeFixerCategory));
-cl::opt<std::string> InsertHeader(
+static cl::opt<std::string> InsertHeader(
"insert-header",
cl::desc("Insert a specific header. This should run with STDIN mode.\n"
"The result is written to stdout. It is currently used for\n"
@@ -151,7 +151,7 @@ cl::opt<std::string> InsertHeader(
" QualifiedName: \"a::foo\"} ]}\""),
cl::init(""), cl::cat(IncludeFixerCategory));
-cl::opt<std::string>
+static cl::opt<std::string>
Style("style",
cl::desc("Fallback style for reformatting after inserting new\n"
"headers if there is no clang-format config file found."),
diff --git a/clang-tools-extra/clang-move/tool/ClangMove.cpp b/clang-tools-extra/clang-move/tool/ClangMove.cpp
index 655ea81ee37d4fa..0d1636ccb60d017 100644
--- a/clang-tools-extra/clang-move/tool/ClangMove.cpp
+++ b/clang-tools-extra/clang-move/tool/ClangMove.cpp
@@ -37,55 +37,55 @@ std::error_code CreateNewFile(const llvm::Twine &path) {
return llvm::sys::Process::SafelyCloseFileDescriptor(fd);
}
-cl::OptionCategory ClangMoveCategory("clang-move options");
+static cl::OptionCategory ClangMoveCategory("clang-move options");
cl::list<std::string> Names("names", cl::CommaSeparated,
cl::desc("The list of the names of classes being "
"moved, e.g. \"Foo,a::Foo,b::Foo\"."),
cl::cat(ClangMoveCategory));
-cl::opt<std::string>
+static cl::opt<std::string>
OldHeader("old_header",
cl::desc("The relative/absolute file path of old header."),
cl::cat(ClangMoveCategory));
-cl::opt<std::string>
+static cl::opt<std::string>
OldCC("old_cc", cl::desc("The relative/absolute file path of old cc."),
cl::cat(ClangMoveCategory));
-cl::opt<std::string>
+static cl::opt<std::string>
NewHeader("new_header",
cl::desc("The relative/absolute file path of new header."),
cl::cat(ClangMoveCategory));
-cl::opt<std::string>
+static cl::opt<std::string>
NewCC("new_cc", cl::desc("The relative/absolute file path of new cc."),
cl::cat(ClangMoveCategory));
-cl::opt<bool>
+static cl::opt<bool>
OldDependOnNew("old_depend_on_new",
cl::desc("Whether old header will depend on new header. If "
"true, clang-move will "
"add #include of new header to old header."),
cl::init(false), cl::cat(ClangMoveCategory));
-cl::opt<bool>
+static cl::opt<bool>
NewDependOnOld("new_depend_on_old",
cl::desc("Whether new header will depend on old header. If "
"true, clang-move will "
"add #include of old header to new header."),
cl::init(false), cl::cat(ClangMoveCategory));
-cl::opt<std::string>
+static cl::opt<std::string>
Style("style",
cl::desc("The style name used for reformatting. Default is \"llvm\""),
cl::init("llvm"), cl::cat(ClangMoveCategory));
-cl::opt<bool> Dump("dump_result",
- cl::desc("Dump results in JSON format to stdout."),
- cl::cat(ClangMoveCategory));
+static cl::opt<bool> Dump("dump_result",
+ cl::desc("Dump results in JSON format to stdout."),
+ cl::cat(ClangMoveCategory));
-cl::opt<bool> DumpDecls(
+static cl::opt<bool> DumpDecls(
"dump_decls",
cl::desc("Dump all declarations in old header (JSON format) to stdout. If "
"the option is specified, other command options will be ignored. "
diff --git a/clang-tools-extra/clang-reorder-fields/tool/ClangReorderFields.cpp b/clang-tools-extra/clang-reorder-fields/tool/ClangReorderFields.cpp
index 5b77ee7b5738c6e..4b524801896a296 100644
--- a/clang-tools-extra/clang-reorder-fields/tool/ClangReorderFields.cpp
+++ b/clang-tools-extra/clang-reorder-fields/tool/ClangReorderFields.cpp
@@ -32,7 +32,8 @@
using namespace llvm;
using namespace clang;
-cl::OptionCategory ClangReorderFieldsCategory("clang-reorder-fields options");
+static cl::OptionCategory
+ ClangReorderFieldsCategory("clang-reorder-fields options");
static cl::opt<std::string>
RecordName("record-name", cl::Required,
diff --git a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
index f185808ae154449..e3849b296c491f9 100644
--- a/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
+++ b/clang-tools-extra/clangd/index/dex/dexp/Dexp.cpp
@@ -27,14 +27,14 @@ namespace clang {
namespace clangd {
namespace {
-llvm::cl::opt<std::string> IndexLocation(
+static llvm::cl::opt<std::string> IndexLocation(
llvm::cl::desc("<path to index file | remote:server.address>"),
llvm::cl::Positional);
-llvm::cl::opt<std::string>
+static llvm::cl::opt<std::string>
ExecCommand("c", llvm::cl::desc("Command to execute and then exit."));
-llvm::cl::opt<std::string> ProjectRoot(
+static llvm::cl::opt<std::string> ProjectRoot(
"project-root",
llvm::cl::desc(
"Path to the project. Required when connecting using remote index."));
diff --git a/clang-tools-extra/clangd/index/remote/monitor/Monitor.cpp b/clang-tools-extra/clangd/index/remote/monitor/Monitor.cpp
index 9a58b5871bfce1a..3aef8feb5088c4e 100644
--- a/clang-tools-extra/clangd/index/remote/monitor/Monitor.cpp
+++ b/clang-tools-extra/clangd/index/remote/monitor/Monitor.cpp
@@ -28,7 +28,7 @@ This tool requests monitoring information (uptime, index freshness) from the
server and prints it to stdout.
)";
-llvm::cl::opt<std::string>
+static llvm::cl::opt<std::string>
ServerAddress("server-address", llvm::cl::Positional,
llvm::cl::desc("Address of the invoked server."),
llvm::cl::Required);
diff --git a/clang-tools-extra/clangd/index/remote/server/Server.cpp b/clang-tools-extra/clangd/index/remote/server/Server.cpp
index 890b6c27ed9282b..05e836bc9a62cde 100644
--- a/clang-tools-extra/clangd/index/remote/server/Server.cpp
+++ b/clang-tools-extra/clangd/index/remote/server/Server.cpp
@@ -59,13 +59,15 @@ This is an experimental remote index implementation. The server opens Dex and
awaits gRPC lookup requests from the client.
)";
-llvm::cl::opt<std::string> IndexPath(llvm::cl::desc("<INDEX FILE>"),
- llvm::cl::Positional, llvm::cl::Required);
+static llvm::cl::opt<std::string> IndexPath(llvm::cl::desc("<INDEX FILE>"),
+ llvm::cl::Positional,
+ llvm::cl::Required);
-llvm::cl::opt<std::string> IndexRoot(llvm::cl::desc("<PROJECT ROOT>"),
- llvm::cl::Positional, llvm::cl::Required);
+static llvm::cl::opt<std::string> IndexRoot(llvm::cl::desc("<PROJECT ROOT>"),
+ llvm::cl::Positional,
+ llvm::cl::Required);
-llvm::cl::opt<Logger::Level> LogLevel{
+static llvm::cl::opt<Logger::Level> LogLevel{
"log",
llvm::cl::desc("Verbosity of log messages written to stderr"),
values(clEnumValN(Logger::Error, "error", "Error messages only"),
@@ -74,38 +76,38 @@ llvm::cl::opt<Logger::Level> LogLevel{
llvm::cl::init(Logger::Info),
};
-llvm::cl::opt<bool> LogPublic{
+static llvm::cl::opt<bool> LogPublic{
"log-public",
llvm::cl::desc("Avoid logging potentially-sensitive request details"),
llvm::cl::init(false),
};
-llvm::cl::opt<std::string> LogPrefix{
+static llvm::cl::opt<std::string> LogPrefix{
"log-prefix",
llvm::cl::desc("A string that'll be prepended to all log statements. "
"Useful when running multiple instances on same host."),
};
-llvm::cl::opt<std::string> TraceFile(
+static llvm::cl::opt<std::string> TraceFile(
"trace-file",
llvm::cl::desc("Path to the file where tracer logs will be stored"));
-llvm::cl::opt<bool> PrettyPrint{
+static llvm::cl::opt<bool> PrettyPrint{
"pretty",
llvm::cl::desc("Pretty-print JSON output in the trace"),
llvm::cl::init(false),
};
-llvm::cl::opt<std::string> ServerAddress(
+static llvm::cl::opt<std::string> ServerAddress(
"server-address", llvm::cl::init("0.0.0.0:50051"),
llvm::cl::desc("Address of the invoked server. Defaults to 0.0.0.0:50051"));
-llvm::cl::opt<size_t> IdleTimeoutSeconds(
+static llvm::cl::opt<size_t> IdleTimeoutSeconds(
"idle-timeout", llvm::cl::init(8 * 60),
llvm::cl::desc("Maximum time a channel may stay idle until server closes "
"the connection, in seconds. Defaults to 480."));
-llvm::cl::opt<size_t> LimitResults(
+static llvm::cl::opt<size_t> LimitResults(
"limit-results", llvm::cl::init(10000),
llvm::cl::desc("Maximum number of results to stream as a response to "
"single request. Limit is to keep the server from being "
diff --git a/clang-tools-extra/clangd/tool/Check.cpp b/clang-tools-extra/clangd/tool/Check.cpp
index df8d075e80596f1..2a2caa5b7afb42b 100644
--- a/clang-tools-extra/clangd/tool/Check.cpp
+++ b/clang-tools-extra/clangd/tool/Check.cpp
@@ -83,11 +83,11 @@ namespace clangd {
namespace {
// These will never be shown in --help, ClangdMain doesn't list the category.
-llvm::cl::opt<std::string> CheckTidyTime{
+static llvm::cl::opt<std::string> CheckTidyTime{
"check-tidy-time",
llvm::cl::desc("Print the overhead of checks matching this glob"),
llvm::cl::init("")};
-llvm::cl::opt<std::string> CheckFileLines{
+static llvm::cl::opt<std::string> CheckFileLines{
"check-lines",
llvm::cl::desc(
"Limits the range of tokens in -check file on which "
@@ -95,19 +95,18 @@ llvm::cl::opt<std::string> CheckFileLines{
"testing to lines 3 to 7 (inclusive) or --check-lines=5 to restrict "
"to one line. Default is testing entire file."),
llvm::cl::init("")};
-llvm::cl::opt<bool> CheckLocations{
+static llvm::cl::opt<bool> CheckLocations{
"check-locations",
llvm::cl::desc(
"Runs certain features (e.g. hover) at each point in the file. "
"Somewhat slow."),
llvm::cl::init(true)};
-llvm::cl::opt<bool> CheckCompletion{
+static llvm::cl::opt<bool> CheckCompletion{
"check-completion",
llvm::cl::desc("Run code-completion at each point (slow)"),
llvm::cl::init(false)};
-llvm::cl::opt<bool> CheckWarnings{
- "check-warnings",
- llvm::cl::desc("Print warnings as well as errors"),
+static llvm::cl::opt<bool> CheckWarnings{
+ "check-warnings", llvm::cl::desc("Print warnings as well as errors"),
llvm::cl::init(false)};
// Print the diagnostics meeting severity threshold, and return count of errors.
diff --git a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
index 1d9458ffc4d3272..eb34128b077c806 100644
--- a/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
+++ b/clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp
@@ -48,16 +48,16 @@ missing entirely. (clang-include-fixer can do this).
)")
.trim();
-cl::OptionCategory IncludeCleaner("clang-include-cleaner");
+static cl::OptionCategory IncludeCleaner("clang-include-cleaner");
-cl::opt<std::string> HTMLReportPath{
+static cl::opt<std::string> HTMLReportPath{
"html",
cl::desc("Specify an output filename for an HTML report. "
"This describes both recommendations and reasons for changes."),
cl::cat(IncludeCleaner),
};
-cl::opt<std::string> OnlyHeaders{
+static cl::opt<std::string> OnlyHeaders{
"only-headers",
cl::desc("A comma-separated list of regexes to match against suffix of a "
"header. Only headers that match will be analyzed."),
@@ -65,7 +65,7 @@ cl::opt<std::string> OnlyHeaders{
cl::cat(IncludeCleaner),
};
-cl::opt<std::string> IgnoreHeaders{
+static cl::opt<std::string> IgnoreHeaders{
"ignore-headers",
cl::desc("A comma-separated list of regexes to match against suffix of a "
"header, and disable analysis if matched."),
@@ -74,7 +74,7 @@ cl::opt<std::string> IgnoreHeaders{
};
enum class PrintStyle { Changes, Final };
-cl::opt<PrintStyle> Print{
+static cl::opt<PrintStyle> Print{
"print",
cl::values(
clEnumValN(PrintStyle::Changes, "changes", "Print symbolic changes"),
@@ -85,19 +85,19 @@ cl::opt<PrintStyle> Print{
cl::cat(IncludeCleaner),
};
-cl::opt<bool> Edit{
+static cl::opt<bool> Edit{
"edit",
cl::desc("Apply edits to analyzed source files"),
cl::cat(IncludeCleaner),
};
-cl::opt<bool> Insert{
+static cl::opt<bool> Insert{
"insert",
cl::desc("Allow header insertions"),
cl::init(true),
cl::cat(IncludeCleaner),
};
-cl::opt<bool> Remove{
+static cl::opt<bool> Remove{
"remove",
cl::desc("Allow header removals"),
cl::init(true),
diff --git a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
index 14c584064e311c8..cc755ba7e2c10a2 100644
--- a/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
+++ b/clang/tools/clang-offload-bundler/ClangOffloadBundler.cpp
@@ -62,12 +62,12 @@ static void PrintVersion(raw_ostream &OS) {
int main(int argc, const char **argv) {
- cl::opt<bool> Help("h", cl::desc("Alias for -help"), cl::Hidden);
+ static cl::opt<bool> Help("h", cl::desc("Alias for -help"), cl::Hidden);
// Mark all our options with this category, everything else (except for
// -version and -help) will be hidden.
- cl::OptionCategory
- ClangOffloadBundlerCategory("clang-offload-bundler options");
+ static cl::OptionCategory ClangOffloadBundlerCategory(
+ "clang-offload-bundler options");
cl::list<std::string>
InputFileNames("input",
cl::desc("Input file."
@@ -92,7 +92,7 @@ int main(int argc, const char **argv) {
TargetNames("targets", cl::CommaSeparated,
cl::desc("[<offload kind>-<target triple>,...]"),
cl::cat(ClangOffloadBundlerCategory));
- cl::opt<std::string> FilesType(
+ static cl::opt<std::string> FilesType(
"type", cl::Required,
cl::desc("Type of the files to be bundled/unbundled.\n"
"Current supported types are:\n"
@@ -109,43 +109,43 @@ int main(int argc, const char **argv) {
" gch - precompiled-header\n"
" ast - clang AST file"),
cl::cat(ClangOffloadBundlerCategory));
- cl::opt<bool>
- Unbundle("unbundle",
- cl::desc("Unbundle bundled file into several output files.\n"),
- cl::init(false), cl::cat(ClangOffloadBundlerCategory));
- cl::opt<bool>
- ListBundleIDs("list", cl::desc("List bundle IDs in the bundled file.\n"),
- cl::init(false), cl::cat(ClangOffloadBundlerCategory));
- cl::opt<bool> PrintExternalCommands(
- "###",
- cl::desc("Print any external commands that are to be executed "
- "instead of actually executing them - for testing purposes.\n"),
- cl::init(false), cl::cat(ClangOffloadBundlerCategory));
- cl::opt<bool>
- AllowMissingBundles("allow-missing-bundles",
- cl::desc("Create empty files if bundles are missing "
- "when unbundling.\n"),
- cl::init(false), cl::cat(ClangOffloadBundlerCategory));
- cl::opt<unsigned>
- BundleAlignment("bundle-align",
- cl::desc("Alignment of bundle for binary files"),
- cl::init(1), cl::cat(ClangOffloadBundlerCategory));
- cl::opt<bool> CheckInputArchive(
+ static cl::opt<bool> Unbundle(
+ "unbundle",
+ cl::desc("Unbundle bundled file into several output files.\n"),
+ cl::init(false), cl::cat(ClangOffloadBundlerCategory));
+ static cl::opt<bool> ListBundleIDs(
+ "list", cl::desc("List bundle IDs in the bundled file.\n"),
+ cl::init(false), cl::cat(ClangOffloadBundlerCategory));
+ static cl::opt<bool> PrintExternalCommands(
+ "###",
+ cl::desc("Print any external commands that are to be executed "
+ "instead of actually executing them - for testing purposes.\n"),
+ cl::init(false), cl::cat(ClangOffloadBundlerCategory));
+ static cl::opt<bool> AllowMissingBundles(
+ "allow-missing-bundles",
+ cl::desc("Create empty files if bundles are missing "
+ "when unbundling.\n"),
+ cl::init(false), cl::cat(ClangOffloadBundlerCategory));
+ static cl::opt<unsigned> BundleAlignment(
+ "bundle-align", cl::desc("Alignment of bundle for binary files"),
+ cl::init(1), cl::cat(ClangOffloadBundlerCategory));
+ static cl::opt<bool> CheckInputArchive(
"check-input-archive",
cl::desc("Check if input heterogeneous archive is "
"valid in terms of TargetID rules.\n"),
cl::init(false), cl::cat(ClangOffloadBundlerCategory));
- cl::opt<bool> HipOpenmpCompatible(
- "hip-openmp-compatible",
- cl::desc("Treat hip and hipv4 offload kinds as "
- "compatible with openmp kind, and vice versa.\n"),
- cl::init(false), cl::cat(ClangOffloadBundlerCategory));
- cl::opt<bool> Compress("compress",
- cl::desc("Compress output file when bundling.\n"),
- cl::init(false), cl::cat(ClangOffloadBundlerCategory));
- cl::opt<bool> Verbose("verbose", cl::desc("Print debug information.\n"),
- cl::init(false), cl::cat(ClangOffloadBundlerCategory));
- cl::opt<int> CompressionLevel(
+ static cl::opt<bool> HipOpenmpCompatible(
+ "hip-openmp-compatible",
+ cl::desc("Treat hip and hipv4 offload kinds as "
+ "compatible with openmp kind, and vice versa.\n"),
+ cl::init(false), cl::cat(ClangOffloadBundlerCategory));
+ static cl::opt<bool> Compress(
+ "compress", cl::desc("Compress output file when bundling.\n"),
+ cl::init(false), cl::cat(ClangOffloadBundlerCategory));
+ static cl::opt<bool> Verbose(
+ "verbose", cl::desc("Print debug information.\n"), cl::init(false),
+ cl::cat(ClangOffloadBundlerCategory));
+ static cl::opt<int> CompressionLevel(
"compression-level", cl::desc("Specify the compression level (integer)"),
cl::value_desc("n"), cl::Optional, cl::cat(ClangOffloadBundlerCategory));
diff --git a/clang/unittests/Tooling/ExecutionTest.cpp b/clang/unittests/Tooling/ExecutionTest.cpp
index b0fd7ccb950ff48..3b985bbf3573c8c 100644
--- a/clang/unittests/Tooling/ExecutionTest.cpp
+++ b/clang/unittests/Tooling/ExecutionTest.cpp
@@ -143,7 +143,7 @@ TEST(CreateToolExecutorTest, FailedCreateExecutorUndefinedFlag) {
}
TEST(CreateToolExecutorTest, RegisterFlagsBeforeReset) {
- llvm::cl::opt<std::string> BeforeReset(
+ static llvm::cl::opt<std::string> BeforeReset(
"before_reset", llvm::cl::desc("Defined before reset."),
llvm::cl::init(""));
diff --git a/clang/utils/TableGen/TableGen.cpp b/clang/utils/TableGen/TableGen.cpp
index 569d7a6a3ac8b79..45eb486da5153e6 100644
--- a/clang/utils/TableGen/TableGen.cpp
+++ b/clang/utils/TableGen/TableGen.cpp
@@ -114,7 +114,7 @@ enum ActionType {
};
namespace {
-cl::opt<ActionType> Action(
+static cl::opt<ActionType> Action(
cl::desc("Action to perform:"),
cl::values(
clEnumValN(PrintRecords, "print-records",
@@ -317,10 +317,10 @@ cl::opt<ActionType> Action(
"Generate a list of attributes supported by #pragma clang "
"attribute for testing purposes")));
-cl::opt<std::string>
-ClangComponent("clang-component",
- cl::desc("Only use warnings from specified component"),
- cl::value_desc("component"), cl::Hidden);
+static cl::opt<std::string>
+ ClangComponent("clang-component",
+ cl::desc("Only use warnings from specified component"),
+ cl::value_desc("component"), cl::Hidden);
bool ClangTableGenMain(raw_ostream &OS, const RecordKeeper &Records) {
switch (Action) {
diff --git a/flang/lib/Lower/OpenMP/Utils.cpp b/flang/lib/Lower/OpenMP/Utils.cpp
index 35722fa7d1b1206..bcdc565441e335c 100644
--- a/flang/lib/Lower/OpenMP/Utils.cpp
+++ b/flang/lib/Lower/OpenMP/Utils.cpp
@@ -27,18 +27,18 @@
#include <iterator>
-llvm::cl::opt<bool> treatIndexAsSection(
+static llvm::cl::opt<bool> treatIndexAsSection(
"openmp-treat-index-as-section",
llvm::cl::desc("In the OpenMP data clauses treat `a(N)` as `a(N:N)`."),
llvm::cl::init(true));
-llvm::cl::opt<bool> enableDelayedPrivatization(
+static llvm::cl::opt<bool> enableDelayedPrivatization(
"openmp-enable-delayed-privatization",
llvm::cl::desc(
"Emit `[first]private` variables as clauses on the MLIR ops."),
llvm::cl::init(true));
-llvm::cl::opt<bool> enableDelayedPrivatizationStaging(
+static llvm::cl::opt<bool> enableDelayedPrivatizationStaging(
"openmp-enable-delayed-privatization-staging",
llvm::cl::desc("For partially supported constructs, emit `[first]private` "
"variables as clauses on the MLIR ops."),
diff --git a/flang/lib/Optimizer/Builder/IntrinsicCall.cpp b/flang/lib/Optimizer/Builder/IntrinsicCall.cpp
index 9b684520ec07820..20eba88d6258fed 100644
--- a/flang/lib/Optimizer/Builder/IntrinsicCall.cpp
+++ b/flang/lib/Optimizer/Builder/IntrinsicCall.cpp
@@ -760,7 +760,7 @@ static llvm::cl::opt<bool> outlineAllIntrinsics(
/// Command line option to modify math runtime behavior used to implement
/// intrinsics. This option applies both to early and late math-lowering modes.
enum MathRuntimeVersion { fastVersion, relaxedVersion, preciseVersion };
-llvm::cl::opt<MathRuntimeVersion> mathRuntimeVersion(
+static llvm::cl::opt<MathRuntimeVersion> mathRuntimeVersion(
"math-runtime", llvm::cl::desc("Select math operations' runtime behavior:"),
llvm::cl::values(
clEnumValN(fastVersion, "fast", "use fast runtime behavior"),
diff --git a/flang/lib/Optimizer/Passes/CommandLineOpts.cpp b/flang/lib/Optimizer/Passes/CommandLineOpts.cpp
index f95a280883cbaf3..e2b0a453312bc53 100644
--- a/flang/lib/Optimizer/Passes/CommandLineOpts.cpp
+++ b/flang/lib/Optimizer/Passes/CommandLineOpts.cpp
@@ -14,26 +14,26 @@
using namespace llvm;
#define DisableOption(DOName, DOOption, DODescription) \
- cl::opt<bool> disable##DOName("disable-" DOOption, \
- cl::desc("disable " DODescription " pass"), \
- cl::init(false), cl::Hidden)
+ static cl::opt<bool> disable##DOName( \
+ "disable-" DOOption, cl::desc("disable " DODescription " pass"), \
+ cl::init(false), cl::Hidden)
#define EnableOption(EOName, EOOption, EODescription) \
- cl::opt<bool> enable##EOName("enable-" EOOption, \
- cl::desc("enable " EODescription " pass"), \
- cl::init(false), cl::Hidden)
+ static cl::opt<bool> enable##EOName( \
+ "enable-" EOOption, cl::desc("enable " EODescription " pass"), \
+ cl::init(false), cl::Hidden)
-cl::opt<bool> dynamicArrayStackToHeapAllocation(
+static cl::opt<bool> dynamicArrayStackToHeapAllocation(
"fdynamic-heap-array",
cl::desc("place all array allocations of dynamic size on the heap"),
cl::init(false), cl::Hidden);
-cl::opt<std::size_t> arrayStackAllocationThreshold(
+static cl::opt<std::size_t> arrayStackAllocationThreshold(
"fstack-array-size",
cl::desc(
"place all array allocations more than <size> elements on the heap"),
cl::init(~static_cast<std::size_t>(0)), cl::Hidden);
-cl::opt<bool> ignoreMissingTypeDescriptors(
+static cl::opt<bool> ignoreMissingTypeDescriptors(
"ignore-missing-type-desc",
cl::desc("ignore failures to find derived type descriptors when "
"translating FIR to LLVM"),
@@ -50,7 +50,7 @@ DisableOption(FirMao, "memory-allocation-opt",
"memory allocation optimization");
DisableOption(FirAliasTags, "fir-alias-tags", "fir alias analysis");
-cl::opt<bool> useOldAliasTags(
+static cl::opt<bool> useOldAliasTags(
"use-old-alias-tags",
cl::desc("Use a single TBAA tree for all functions and do not use "
"the FIR alias tags pass"),
diff --git a/lldb/tools/lldb-test/lldb-test.cpp b/lldb/tools/lldb-test/lldb-test.cpp
index 1960240dc41514a..30a46681eca296f 100644
--- a/lldb/tools/lldb-test/lldb-test.cpp
+++ b/lldb/tools/lldb-test/lldb-test.cpp
@@ -66,12 +66,12 @@ cl::SubCommand SymTabSubcommand("symtab",
cl::SubCommand IRMemoryMapSubcommand("ir-memory-map", "Test IRMemoryMap");
cl::SubCommand AssertSubcommand("assert", "Test assert handling");
-cl::opt<std::string> Log("log", cl::desc("Path to a log file"), cl::init(""),
- cl::sub(BreakpointSubcommand),
- cl::sub(ObjectFileSubcommand),
- cl::sub(SymbolsSubcommand),
- cl::sub(SymTabSubcommand),
- cl::sub(IRMemoryMapSubcommand));
+static cl::opt<std::string> Log("log", cl::desc("Path to a log file"),
+ cl::init(""), cl::sub(BreakpointSubcommand),
+ cl::sub(ObjectFileSubcommand),
+ cl::sub(SymbolsSubcommand),
+ cl::sub(SymTabSubcommand),
+ cl::sub(IRMemoryMapSubcommand));
/// Create a target using the file pointed to by \p Filename, or abort.
TargetSP createTarget(Debugger &Dbg, const std::string &Filename);
@@ -98,12 +98,13 @@ static int evaluateBreakpoints(Debugger &Dbg);
} // namespace breakpoint
namespace object {
-cl::opt<bool> SectionContents("contents",
- cl::desc("Dump each section's contents"),
- cl::sub(ObjectFileSubcommand));
-cl::opt<bool> SectionDependentModules("dep-modules",
- cl::desc("Dump each dependent module"),
- cl::sub(ObjectFileSubcommand));
+static cl::opt<bool> SectionContents("contents",
+ cl::desc("Dump each section's contents"),
+ cl::sub(ObjectFileSubcommand));
+static cl::opt<bool>
+ SectionDependentModules("dep-modules",
+ cl::desc("Dump each dependent module"),
+ cl::sub(ObjectFileSubcommand));
cl::list<std::string> InputFilenames(cl::Positional, cl::desc("<input files>"),
cl::OneOrMore,
cl::sub(ObjectFileSubcommand));
diff --git a/llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp b/llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp
index ed1262b59064bf4..577b9570229aba1 100644
--- a/llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp
+++ b/llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp
@@ -28,10 +28,10 @@ using namespace llvm;
//===----------------------------------------------------------------------===//
namespace {
- cl::opt<std::string>
- InputIR("input-IR",
- cl::desc("Specify the name of an IR file to load for function definitions"),
- cl::value_desc("input IR file name"));
+static cl::opt<std::string> InputIR(
+ "input-IR",
+ cl::desc("Specify the name of an IR file to load for function definitions"),
+ cl::value_desc("input IR file name"));
} // namespace
//===----------------------------------------------------------------------===//
diff --git a/llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp b/llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp
index 09cd033f9ab297f..b4b7eac8a883106 100644
--- a/llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp
+++ b/llvm/examples/Kaleidoscope/MCJIT/cached/toy.cpp
@@ -31,15 +31,15 @@ using namespace llvm;
// Command-line options
//===----------------------------------------------------------------------===//
-cl::opt<std::string>
-InputIR("input-IR",
- cl::desc("Specify the name of an IR file to load for function definitions"),
- cl::value_desc("input IR file name"));
-
-cl::opt<bool>
-UseObjectCache("use-object-cache",
- cl::desc("Enable use of the MCJIT object caching"),
- cl::init(false));
+static cl::opt<std::string> InputIR(
+ "input-IR",
+ cl::desc("Specify the name of an IR file to load for function definitions"),
+ cl::value_desc("input IR file name"));
+
+static cl::opt<bool>
+ UseObjectCache("use-object-cache",
+ cl::desc("Enable use of the MCJIT object caching"),
+ cl::init(false));
//===----------------------------------------------------------------------===//
// Lexer
diff --git a/llvm/examples/Kaleidoscope/MCJIT/complete/toy.cpp b/llvm/examples/Kaleidoscope/MCJIT/complete/toy.cpp
index bc2267fe1829328..66c35d0dfb3071c 100644
--- a/llvm/examples/Kaleidoscope/MCJIT/complete/toy.cpp
+++ b/llvm/examples/Kaleidoscope/MCJIT/complete/toy.cpp
@@ -31,33 +31,34 @@ using namespace llvm;
//===----------------------------------------------------------------------===//
namespace {
- cl::opt<std::string>
- InputIR("input-IR",
- cl::desc("Specify the name of an IR file to load for function definitions"),
- cl::value_desc("input IR file name"));
-
- cl::opt<bool>
- VerboseOutput("verbose",
- cl::desc("Enable verbose output (results, IR, etc.) to stderr"),
- cl::init(false));
-
- cl::opt<bool>
- SuppressPrompts("suppress-prompts",
- cl::desc("Disable printing the 'ready' prompt"),
- cl::init(false));
-
- cl::opt<bool>
- DumpModulesOnExit("dump-modules",
- cl::desc("Dump IR from modules to stderr on shutdown"),
- cl::init(false));
-
- cl::opt<bool> EnableLazyCompilation(
- "enable-lazy-compilation", cl::desc("Enable lazy compilation when using the MCJIT engine"),
- cl::init(true));
+static cl::opt<std::string> InputIR(
+ "input-IR",
+ cl::desc("Specify the name of an IR file to load for function definitions"),
+ cl::value_desc("input IR file name"));
- cl::opt<bool> UseObjectCache(
- "use-object-cache", cl::desc("Enable use of the MCJIT object caching"),
+static cl::opt<bool> VerboseOutput(
+ "verbose", cl::desc("Enable verbose output (results, IR, etc.) to stderr"),
cl::init(false));
+
+static cl::opt<bool>
+ SuppressPrompts("suppress-prompts",
+ cl::desc("Disable printing the 'ready' prompt"),
+ cl::init(false));
+
+static cl::opt<bool>
+ DumpModulesOnExit("dump-modules",
+ cl::desc("Dump IR from modules to stderr on shutdown"),
+ cl::init(false));
+
+static cl::opt<bool> EnableLazyCompilation(
+ "enable-lazy-compilation",
+ cl::desc("Enable lazy compilation when using the MCJIT engine"),
+ cl::init(true));
+
+static cl::opt<bool>
+ UseObjectCache("use-object-cache",
+ cl::desc("Enable use of the MCJIT object caching"),
+ cl::init(false));
} // namespace
//===----------------------------------------------------------------------===//
diff --git a/llvm/examples/OrcV2Examples/LLJITDumpObjects/LLJITDumpObjects.cpp b/llvm/examples/OrcV2Examples/LLJITDumpObjects/LLJITDumpObjects.cpp
index c3752cc36c060c4..264656a838ae8d7 100644
--- a/llvm/examples/OrcV2Examples/LLJITDumpObjects/LLJITDumpObjects.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITDumpObjects/LLJITDumpObjects.cpp
@@ -21,17 +21,17 @@ using namespace llvm::orc;
ExitOnError ExitOnErr;
-cl::opt<bool> DumpJITdObjects("dump-jitted-objects",
- cl::desc("dump jitted objects"), cl::Optional,
- cl::init(true));
+static cl::opt<bool> DumpJITdObjects("dump-jitted-objects",
+ cl::desc("dump jitted objects"),
+ cl::Optional, cl::init(true));
-cl::opt<std::string> DumpDir("dump-dir",
- cl::desc("directory to dump objects to"),
- cl::Optional, cl::init(""));
+static cl::opt<std::string> DumpDir("dump-dir",
+ cl::desc("directory to dump objects to"),
+ cl::Optional, cl::init(""));
-cl::opt<std::string> DumpFileStem("dump-file-stem",
- cl::desc("Override default dump names"),
- cl::Optional, cl::init(""));
+static cl::opt<std::string>
+ DumpFileStem("dump-file-stem", cl::desc("Override default dump names"),
+ cl::Optional, cl::init(""));
int main(int argc, char *argv[]) {
// Initialize LLVM.
diff --git a/llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp b/llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp
index a7cb4fce9490967..f498a97442c44f6 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITWithThinLTOSummaries/LLJITWithThinLTOSummaries.cpp
@@ -55,8 +55,8 @@ using namespace llvm;
using namespace llvm::orc;
// Path of the module summary index file.
-cl::opt<std::string> IndexFile{cl::desc("<module summary index>"),
- cl::Positional, cl::init("-")};
+static cl::opt<std::string> IndexFile{cl::desc("<module summary index>"),
+ cl::Positional, cl::init("-")};
// Describe a fail state that is caused by the given ModuleSummaryIndex
// providing multiple definitions of the given global value name. It will dump
diff --git a/llvm/lib/Analysis/AliasAnalysis.cpp b/llvm/lib/Analysis/AliasAnalysis.cpp
index 061a7e8e5c34976..1455c91561eeda3 100644
--- a/llvm/lib/Analysis/AliasAnalysis.cpp
+++ b/llvm/lib/Analysis/AliasAnalysis.cpp
@@ -61,7 +61,8 @@ STATISTIC(NumMustAlias, "Number of MustAlias results");
namespace llvm {
/// Allow disabling BasicAA from the AA results. This is particularly useful
/// when testing to isolate a single AA implementation.
-cl::opt<bool> DisableBasicAA("disable-basic-aa", cl::Hidden, cl::init(false));
+static cl::opt<bool> DisableBasicAA("disable-basic-aa", cl::Hidden,
+ cl::init(false));
} // namespace llvm
#ifndef NDEBUG
diff --git a/llvm/lib/Analysis/BranchProbabilityInfo.cpp b/llvm/lib/Analysis/BranchProbabilityInfo.cpp
index 8077c28f79a390c..62c2b361f1b81c2 100644
--- a/llvm/lib/Analysis/BranchProbabilityInfo.cpp
+++ b/llvm/lib/Analysis/BranchProbabilityInfo.cpp
@@ -54,7 +54,7 @@ static cl::opt<bool> PrintBranchProb(
"print-bpi", cl::init(false), cl::Hidden,
cl::desc("Print the branch probability info."));
-cl::opt<std::string> PrintBranchProbFuncName(
+static cl::opt<std::string> PrintBranchProbFuncName(
"print-bpi-func-name", cl::Hidden,
cl::desc("The option to specify the name of the function "
"whose branch probability info is printed."));
diff --git a/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp b/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp
index 0ffbc90d7ee22d6..c135fe12dc37ee7 100644
--- a/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp
+++ b/llvm/lib/Analysis/FunctionPropertiesAnalysis.cpp
@@ -30,12 +30,12 @@ cl::opt<bool> EnableDetailedFunctionProperties(
"enable-detailed-function-properties", cl::Hidden, cl::init(false),
cl::desc("Whether or not to compute detailed function properties."));
-cl::opt<unsigned> BigBasicBlockInstructionThreshold(
+static cl::opt<unsigned> BigBasicBlockInstructionThreshold(
"big-basic-block-instruction-threshold", cl::Hidden, cl::init(500),
cl::desc("The minimum number of instructions a basic block should contain "
"before being considered big."));
-cl::opt<unsigned> MediumBasicBlockInstructionThreshold(
+static cl::opt<unsigned> MediumBasicBlockInstructionThreshold(
"medium-basic-block-instruction-threshold", cl::Hidden, cl::init(15),
cl::desc("The minimum number of instructions a basic block should contain "
"before being considered medium-sized."));
diff --git a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
index 42e986e6179dd34..e1daf02ee6bba29 100644
--- a/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
+++ b/llvm/lib/Analysis/IRSimilarityIdentifier.cpp
@@ -36,7 +36,7 @@ cl::opt<bool>
cl::ReallyHidden,
cl::desc("disable outlining indirect calls."));
-cl::opt<bool>
+static cl::opt<bool>
MatchCallsByName("ir-sim-calls-by-name", cl::init(false), cl::ReallyHidden,
cl::desc("only allow matching call instructions if the "
"name and type signature match."));
diff --git a/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp b/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp
index 4074b678d02595b..fcecfc795b571d5 100644
--- a/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp
+++ b/llvm/lib/Analysis/InlineSizeEstimatorAnalysis.cpp
@@ -36,7 +36,7 @@ AnalysisKey InlineSizeEstimatorAnalysis::Key;
#include <deque>
#include <optional>
-cl::opt<std::string> TFIR2NativeModelPath(
+static cl::opt<std::string> TFIR2NativeModelPath(
"ml-inliner-ir2native-model", cl::Hidden,
cl::desc("Path to saved model evaluating native size from IR."));
diff --git a/llvm/lib/Analysis/MemoryProfileInfo.cpp b/llvm/lib/Analysis/MemoryProfileInfo.cpp
index a22344e19d04507..0c1a8a409e590ea 100644
--- a/llvm/lib/Analysis/MemoryProfileInfo.cpp
+++ b/llvm/lib/Analysis/MemoryProfileInfo.cpp
@@ -54,7 +54,7 @@ cl::opt<bool> MemProfReportHintedSizes(
// This is useful if we have enabled reporting of hinted sizes, and want to get
// information from the indexing step for all contexts (especially for testing),
// or have specified a value less than 100% for -memprof-cloning-cold-threshold.
-cl::opt<bool> MemProfKeepAllNotColdContexts(
+static cl::opt<bool> MemProfKeepAllNotColdContexts(
"memprof-keep-all-not-cold-contexts", cl::init(false), cl::Hidden,
cl::desc("Keep all non-cold contexts (increases cloning overheads)"));
diff --git a/llvm/lib/CGData/CodeGenData.cpp b/llvm/lib/CGData/CodeGenData.cpp
index 88dcdfd1f931a24..5230ea3e8d165da 100644
--- a/llvm/lib/CGData/CodeGenData.cpp
+++ b/llvm/lib/CGData/CodeGenData.cpp
@@ -27,10 +27,10 @@
using namespace llvm;
using namespace cgdata;
-cl::opt<bool>
+static cl::opt<bool>
CodeGenDataGenerate("codegen-data-generate", cl::init(false), cl::Hidden,
cl::desc("Emit CodeGen Data into custom sections"));
-cl::opt<std::string>
+static cl::opt<std::string>
CodeGenDataUsePath("codegen-data-use-path", cl::init(""), cl::Hidden,
cl::desc("File path to where .cgdata file is read"));
cl::opt<bool> CodeGenDataThinLTOTwoRounds(
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
index ddf0275ddfe6a47..379dc7e752b10ad 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp
@@ -44,7 +44,7 @@
using namespace llvm;
/// Query value using AddLinkageNamesToDeclCallOriginsForTuning.
-cl::opt<cl::boolOrDefault> AddLinkageNamesToDeclCallOrigins(
+static cl::opt<cl::boolOrDefault> AddLinkageNamesToDeclCallOrigins(
"add-linkage-names-to-declaration-call-origins", cl::Hidden,
cl::desc("Add DW_AT_linkage_name to function declaration DIEs "
"referenced by DW_AT_call_origin attributes. Enabled by default "
diff --git a/llvm/lib/CodeGen/MachinePipeliner.cpp b/llvm/lib/CodeGen/MachinePipeliner.cpp
index 064b0a0f11747a4..a34b204fed6dc8b 100644
--- a/llvm/lib/CodeGen/MachinePipeliner.cpp
+++ b/llvm/lib/CodeGen/MachinePipeliner.cpp
@@ -209,7 +209,7 @@ cl::opt<int> SwpForceIssueWidth(
cl::init(-1));
/// A command line argument to set the window scheduling option.
-cl::opt<WindowSchedulingFlag> WindowSchedulingOption(
+static cl::opt<WindowSchedulingFlag> WindowSchedulingOption(
"window-sched", cl::Hidden, cl::init(WindowSchedulingFlag::WS_On),
cl::desc("Set how to use window scheduling algorithm."),
cl::values(clEnumValN(WindowSchedulingFlag::WS_Off, "off",
diff --git a/llvm/lib/CodeGen/MachineScheduler.cpp b/llvm/lib/CodeGen/MachineScheduler.cpp
index df90077b15f331f..1b06c1af87056a6 100644
--- a/llvm/lib/CodeGen/MachineScheduler.cpp
+++ b/llvm/lib/CodeGen/MachineScheduler.cpp
@@ -90,7 +90,7 @@ cl::opt<MISched::Direction> PreRADirection(
clEnumValN(MISched::Bidirectional, "bidirectional",
"Force bidirectional pre reg-alloc list scheduling")));
-cl::opt<MISched::Direction> PostRADirection(
+static cl::opt<MISched::Direction> PostRADirection(
"misched-postra-direction", cl::Hidden,
cl::desc("Post reg-alloc list scheduling direction"),
cl::init(MISched::Unspecified),
@@ -102,24 +102,24 @@ cl::opt<MISched::Direction> PostRADirection(
clEnumValN(MISched::Bidirectional, "bidirectional",
"Force bidirectional post reg-alloc list scheduling")));
-cl::opt<bool>
-DumpCriticalPathLength("misched-dcpl", cl::Hidden,
- cl::desc("Print critical path length to stdout"));
+static cl::opt<bool>
+ DumpCriticalPathLength("misched-dcpl", cl::Hidden,
+ cl::desc("Print critical path length to stdout"));
cl::opt<bool> VerifyScheduling(
"verify-misched", cl::Hidden,
cl::desc("Verify machine instrs before and after machine scheduling"));
#ifndef NDEBUG
-cl::opt<bool> ViewMISchedDAGs(
+static cl::opt<bool> ViewMISchedDAGs(
"view-misched-dags", cl::Hidden,
cl::desc("Pop up a window to show MISched dags after they are processed"));
-cl::opt<bool> PrintDAGs("misched-print-dags", cl::Hidden,
- cl::desc("Print schedule DAGs"));
-cl::opt<bool> MISchedDumpReservedCycles(
+static cl::opt<bool> PrintDAGs("misched-print-dags", cl::Hidden,
+ cl::desc("Print schedule DAGs"));
+static cl::opt<bool> MISchedDumpReservedCycles(
"misched-dump-reserved-cycles", cl::Hidden, cl::init(false),
cl::desc("Dump resource usage at schedule boundary."));
-cl::opt<bool> MischedDetailResourceBooking(
+static cl::opt<bool> MischedDetailResourceBooking(
"misched-detail-resource-booking", cl::Hidden, cl::init(false),
cl::desc("Show details of invoking getNextResoufceCycle."));
#else
diff --git a/llvm/lib/CodeGen/MachineStripDebug.cpp b/llvm/lib/CodeGen/MachineStripDebug.cpp
index ea291f64bff4321..a9b9d1eb93b16dd 100644
--- a/llvm/lib/CodeGen/MachineStripDebug.cpp
+++ b/llvm/lib/CodeGen/MachineStripDebug.cpp
@@ -23,7 +23,7 @@
using namespace llvm;
namespace {
-cl::opt<bool>
+static cl::opt<bool>
OnlyDebugifiedDefault("mir-strip-debugify-only",
cl::desc("Should mir-strip-debug only strip debug "
"info from debugified modules by default"),
diff --git a/llvm/lib/CodeGen/WindowScheduler.cpp b/llvm/lib/CodeGen/WindowScheduler.cpp
index 379740cae78d5c6..6fe1c2eec283c58 100644
--- a/llvm/lib/CodeGen/WindowScheduler.cpp
+++ b/llvm/lib/CodeGen/WindowScheduler.cpp
@@ -61,32 +61,32 @@ STATISTIC(NumWindowSchedule,
STATISTIC(NumFailAnalyseII,
"Window scheduling abort due to the failure of the II analysis");
-cl::opt<unsigned>
+static cl::opt<unsigned>
WindowSearchNum("window-search-num",
cl::desc("The number of searches per loop in the window "
"algorithm. 0 means no search number limit."),
cl::Hidden, cl::init(6));
-cl::opt<unsigned> WindowSearchRatio(
+static cl::opt<unsigned> WindowSearchRatio(
"window-search-ratio",
cl::desc("The ratio of searches per loop in the window algorithm. 100 "
"means search all positions in the loop, while 0 means not "
"performing any search."),
cl::Hidden, cl::init(40));
-cl::opt<unsigned> WindowIICoeff(
+static cl::opt<unsigned> WindowIICoeff(
"window-ii-coeff",
cl::desc(
"The coefficient used when initializing II in the window algorithm."),
cl::Hidden, cl::init(5));
-cl::opt<unsigned> WindowRegionLimit(
+static cl::opt<unsigned> WindowRegionLimit(
"window-region-limit",
cl::desc(
"The lower limit of the scheduling region in the window algorithm."),
cl::Hidden, cl::init(3));
-cl::opt<unsigned> WindowDiffLimit(
+static cl::opt<unsigned> WindowDiffLimit(
"window-diff-limit",
cl::desc("The lower limit of the difference between best II and base II in "
"the window algorithm. If the difference is smaller than "
@@ -96,7 +96,7 @@ cl::opt<unsigned> WindowDiffLimit(
// WindowIILimit serves as an indicator of abnormal scheduling results and could
// potentially be referenced by the derived target window scheduler.
-cl::opt<unsigned>
+static cl::opt<unsigned>
WindowIILimit("window-ii-limit",
cl::desc("The upper limit of II in the window algorithm."),
cl::Hidden, cl::init(1000));
diff --git a/llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp b/llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp
index 6ced8c76b037c43..96a549c4a9f0b33 100644
--- a/llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/DebugUtils.cpp
@@ -24,20 +24,22 @@ namespace {
#ifndef NDEBUG
-cl::opt<bool> PrintHidden("debug-orc-print-hidden", cl::init(true),
- cl::desc("debug print hidden symbols defined by "
- "materialization units"),
- cl::Hidden);
-
-cl::opt<bool> PrintCallable("debug-orc-print-callable", cl::init(true),
- cl::desc("debug print callable symbols defined by "
- "materialization units"),
- cl::Hidden);
-
-cl::opt<bool> PrintData("debug-orc-print-data", cl::init(true),
- cl::desc("debug print data symbols defined by "
- "materialization units"),
- cl::Hidden);
+static cl::opt<bool>
+ PrintHidden("debug-orc-print-hidden", cl::init(true),
+ cl::desc("debug print hidden symbols defined by "
+ "materialization units"),
+ cl::Hidden);
+
+static cl::opt<bool>
+ PrintCallable("debug-orc-print-callable", cl::init(true),
+ cl::desc("debug print callable symbols defined by "
+ "materialization units"),
+ cl::Hidden);
+
+static cl::opt<bool> PrintData("debug-orc-print-data", cl::init(true),
+ cl::desc("debug print data symbols defined by "
+ "materialization units"),
+ cl::Hidden);
#endif // NDEBUG
diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp
index a192392e045851b..774e63899f64bd7 100644
--- a/llvm/lib/LTO/LTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -109,21 +109,20 @@ cl::opt<std::string> RemarksFormat(
cl::desc("The format used for serializing remarks (default: YAML)"),
cl::value_desc("format"), cl::init("yaml"));
-cl::opt<std::string> LTOStatsFile(
- "lto-stats-file",
- cl::desc("Save statistics to the specified file"),
- cl::Hidden);
+static cl::opt<std::string>
+ LTOStatsFile("lto-stats-file",
+ cl::desc("Save statistics to the specified file"), cl::Hidden);
-cl::opt<std::string> AIXSystemAssemblerPath(
+static cl::opt<std::string> AIXSystemAssemblerPath(
"lto-aix-system-assembler",
cl::desc("Path to a system assembler, picked up on AIX only"),
cl::value_desc("path"));
-cl::opt<bool>
+static cl::opt<bool>
LTORunCSIRInstr("cs-profile-generate",
cl::desc("Perform context sensitive PGO instrumentation"));
-cl::opt<std::string>
+static cl::opt<std::string>
LTOCSIRProfile("cs-profile-path",
cl::desc("Context sensitive profile file path"));
} // namespace llvm
diff --git a/llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp b/llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp
index ed531038395c435..b5911ac09cc1812 100644
--- a/llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp
+++ b/llvm/lib/Target/AArch64/AArch64LowerHomogeneousPrologEpilog.cpp
@@ -32,7 +32,7 @@ using namespace llvm;
#define AARCH64_LOWER_HOMOGENEOUS_PROLOG_EPILOG_NAME \
"AArch64 homogeneous prolog/epilog lowering pass"
-cl::opt<int> FrameHelperSizeThreshold(
+static cl::opt<int> FrameHelperSizeThreshold(
"frame-helper-size-threshold", cl::init(2), cl::Hidden,
cl::desc("The minimum number of instructions that are outlined in a frame "
"helper (default = 2)"));
diff --git a/llvm/lib/Target/AArch64/AArch64StackTaggingPreRA.cpp b/llvm/lib/Target/AArch64/AArch64StackTaggingPreRA.cpp
index 51bf4b8c30044ec..558f20848babd99 100644
--- a/llvm/lib/Target/AArch64/AArch64StackTaggingPreRA.cpp
+++ b/llvm/lib/Target/AArch64/AArch64StackTaggingPreRA.cpp
@@ -31,9 +31,8 @@ using namespace llvm;
enum UncheckedLdStMode { UncheckedNever, UncheckedSafe, UncheckedAlways };
-cl::opt<UncheckedLdStMode> ClUncheckedLdSt(
- "stack-tagging-unchecked-ld-st", cl::Hidden,
- cl::init(UncheckedSafe),
+static cl::opt<UncheckedLdStMode> ClUncheckedLdSt(
+ "stack-tagging-unchecked-ld-st", cl::Hidden, cl::init(UncheckedSafe),
cl::desc(
"Unconditionally apply unchecked-ld-st optimization (even for large "
"stack frames, or in the presence of variable sized allocas)."),
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
index 325056c781a532d..751e8d534c707ea 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -185,7 +185,7 @@ class TailFoldingOption {
TailFoldingOption TailFoldingOptionLoc;
-cl::opt<TailFoldingOption, true, cl::parser<std::string>> SVETailFolding(
+static cl::opt<TailFoldingOption, true, cl::parser<std::string>> SVETailFolding(
"sve-tail-folding",
cl::desc(
"Control the use of vectorisation using tail-folding for SVE where the"
diff --git a/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp b/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
index 55497c837ee23ee..fe98e37618d16e1 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPULowerModuleLDSPass.cpp
@@ -216,13 +216,13 @@ using namespace AMDGPU;
namespace {
-cl::opt<bool> SuperAlignLDSGlobals(
+static cl::opt<bool> SuperAlignLDSGlobals(
"amdgpu-super-align-lds-globals",
cl::desc("Increase alignment of LDS if it is not on align boundary"),
cl::init(true), cl::Hidden);
enum class LoweringKind { module, table, kernel, hybrid };
-cl::opt<LoweringKind> LoweringKindLoc(
+static cl::opt<LoweringKind> LoweringKindLoc(
"amdgpu-lower-module-lds-strategy",
cl::desc("Specify lowering strategy for function LDS access:"), cl::Hidden,
cl::init(LoweringKind::hybrid),
diff --git a/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp b/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
index 17207773b4858c6..81ad451a4485bfb 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
@@ -120,7 +120,7 @@ using namespace AMDGPU;
namespace {
-cl::opt<bool>
+static cl::opt<bool>
AsanInstrumentLDS("amdgpu-asan-instrument-lds",
cl::desc("Run asan instrumentation on LDS instructions "
"lowered to global memory"),
diff --git a/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp b/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp
index a39487c318f8e0e..77f4782699c96e2 100644
--- a/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp
@@ -17,7 +17,7 @@ using namespace llvm;
#define DEBUG_TYPE "arm-selectiondag-info"
-cl::opt<TPLoop::MemTransfer> EnableMemtransferTPLoop(
+static cl::opt<TPLoop::MemTransfer> EnableMemtransferTPLoop(
"arm-memtransfer-tploop", cl::Hidden,
cl::desc("Control conversion of memcpy to "
"Tail predicated loops (WLSTP)"),
diff --git a/llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp b/llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp
index 36269caa835a221..e6bb4986c836e81 100644
--- a/llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp
+++ b/llvm/lib/Target/ARM/MVELaneInterleavingPass.cpp
@@ -70,7 +70,7 @@ using namespace llvm;
#define DEBUG_TYPE "mve-laneinterleave"
-cl::opt<bool> EnableInterleave(
+static cl::opt<bool> EnableInterleave(
"enable-mve-interleave", cl::Hidden, cl::init(true),
cl::desc("Enable interleave MVE vector operation lowering"));
diff --git a/llvm/lib/Target/Hexagon/HexagonCopyToCombine.cpp b/llvm/lib/Target/Hexagon/HexagonCopyToCombine.cpp
index 99ac0c346d0c0d3..3971dc67ed56b4b 100644
--- a/llvm/lib/Target/Hexagon/HexagonCopyToCombine.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonCopyToCombine.cpp
@@ -41,12 +41,11 @@ static cl::opt<bool>
IsConst64Disabled("disable-const64", cl::Hidden,
cl::desc("Disable generation of const64"));
-static
-cl::opt<unsigned>
-MaxNumOfInstsBetweenNewValueStoreAndTFR("max-num-inst-between-tfr-and-nv-store",
- cl::Hidden, cl::init(4),
- cl::desc("Maximum distance between a tfr feeding a store we "
- "consider the store still to be newifiable"));
+
+static cl::opt<unsigned> MaxNumOfInstsBetweenNewValueStoreAndTFR(
+ "max-num-inst-between-tfr-and-nv-store", cl::Hidden, cl::init(4),
+ cl::desc("Maximum distance between a tfr feeding a store we "
+ "consider the store still to be newifiable"));
namespace llvm {
FunctionPass *createHexagonCopyToCombine();
diff --git a/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp b/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp
index 10db4f552cdcf28..dc0195a79d0867b 100644
--- a/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp
@@ -27,23 +27,20 @@ using namespace llvm;
#define DEBUG_TYPE "hexagon-isel"
#define PASS_NAME "Hexagon DAG->DAG Pattern Instruction Selection"
-static
-cl::opt<bool>
-EnableAddressRebalancing("isel-rebalance-addr", cl::Hidden, cl::init(true),
- cl::desc("Rebalance address calculation trees to improve "
- "instruction selection"));
+static cl::opt<bool> EnableAddressRebalancing(
+ "isel-rebalance-addr", cl::Hidden, cl::init(true),
+ cl::desc("Rebalance address calculation trees to improve "
+ "instruction selection"));
// Rebalance only if this allows e.g. combining a GA with an offset or
// factoring out a shift.
-static
-cl::opt<bool>
-RebalanceOnlyForOptimizations("rebalance-only-opt", cl::Hidden, cl::init(false),
- cl::desc("Rebalance address tree only if this allows optimizations"));
-
-static
-cl::opt<bool>
-RebalanceOnlyImbalancedTrees("rebalance-only-imbal", cl::Hidden,
- cl::init(false), cl::desc("Rebalance address tree only if it is imbalanced"));
+static cl::opt<bool> RebalanceOnlyForOptimizations(
+ "rebalance-only-opt", cl::Hidden, cl::init(false),
+ cl::desc("Rebalance address tree only if this allows optimizations"));
+
+static cl::opt<bool> RebalanceOnlyImbalancedTrees(
+ "rebalance-only-imbal", cl::Hidden, cl::init(false),
+ cl::desc("Rebalance address tree only if it is imbalanced"));
static cl::opt<bool> CheckSingleUse("hexagon-isel-su", cl::Hidden,
cl::init(true), cl::desc("Enable checking of SDNode's single-use status"));
diff --git a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
index 62b2839295d9697..1d34815c5e4c67a 100644
--- a/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonVectorCombine.cpp
@@ -59,15 +59,15 @@
using namespace llvm;
namespace {
-cl::opt<bool> DumpModule("hvc-dump-module", cl::Hidden);
-cl::opt<bool> VAEnabled("hvc-va", cl::Hidden, cl::init(true)); // Align
-cl::opt<bool> VIEnabled("hvc-vi", cl::Hidden, cl::init(true)); // Idioms
-cl::opt<bool> VADoFullStores("hvc-va-full-stores", cl::Hidden);
-
-cl::opt<unsigned> VAGroupCountLimit("hvc-va-group-count-limit", cl::Hidden,
- cl::init(~0));
-cl::opt<unsigned> VAGroupSizeLimit("hvc-va-group-size-limit", cl::Hidden,
- cl::init(~0));
+static cl::opt<bool> DumpModule("hvc-dump-module", cl::Hidden);
+static cl::opt<bool> VAEnabled("hvc-va", cl::Hidden, cl::init(true)); // Align
+static cl::opt<bool> VIEnabled("hvc-vi", cl::Hidden, cl::init(true)); // Idioms
+static cl::opt<bool> VADoFullStores("hvc-va-full-stores", cl::Hidden);
+
+static cl::opt<unsigned> VAGroupCountLimit("hvc-va-group-count-limit",
+ cl::Hidden, cl::init(~0));
+static cl::opt<unsigned> VAGroupSizeLimit("hvc-va-group-size-limit", cl::Hidden,
+ cl::init(~0));
class HexagonVectorCombine {
public:
diff --git a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
index baa208816786dc7..c5c0c0e7fd09cbf 100644
--- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
+++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
@@ -65,39 +65,39 @@ cl::opt<bool> llvm::HexagonDisableDuplex
cl::desc("Disable looking for duplex instructions for Hexagon"));
namespace { // These flags are to be deprecated
-cl::opt<bool> MV5("mv5", cl::Hidden, cl::desc("Build for Hexagon V5"),
- cl::init(false));
-cl::opt<bool> MV55("mv55", cl::Hidden, cl::desc("Build for Hexagon V55"),
- cl::init(false));
-cl::opt<bool> MV60("mv60", cl::Hidden, cl::desc("Build for Hexagon V60"),
- cl::init(false));
-cl::opt<bool> MV62("mv62", cl::Hidden, cl::desc("Build for Hexagon V62"),
- cl::init(false));
-cl::opt<bool> MV65("mv65", cl::Hidden, cl::desc("Build for Hexagon V65"),
- cl::init(false));
-cl::opt<bool> MV66("mv66", cl::Hidden, cl::desc("Build for Hexagon V66"),
- cl::init(false));
-cl::opt<bool> MV67("mv67", cl::Hidden, cl::desc("Build for Hexagon V67"),
- cl::init(false));
-cl::opt<bool> MV67T("mv67t", cl::Hidden, cl::desc("Build for Hexagon V67T"),
- cl::init(false));
-cl::opt<bool> MV68("mv68", cl::Hidden, cl::desc("Build for Hexagon V68"),
- cl::init(false));
-cl::opt<bool> MV69("mv69", cl::Hidden, cl::desc("Build for Hexagon V69"),
- cl::init(false));
-cl::opt<bool> MV71("mv71", cl::Hidden, cl::desc("Build for Hexagon V71"),
- cl::init(false));
-cl::opt<bool> MV71T("mv71t", cl::Hidden, cl::desc("Build for Hexagon V71T"),
- cl::init(false));
-cl::opt<bool> MV73("mv73", cl::Hidden, cl::desc("Build for Hexagon V73"),
- cl::init(false));
-cl::opt<bool> MV75("mv75", cl::Hidden, cl::desc("Build for Hexagon V75"),
- cl::init(false));
-cl::opt<bool> MV79("mv79", cl::Hidden, cl::desc("Build for Hexagon V79"),
- cl::init(false));
+static cl::opt<bool> MV5("mv5", cl::Hidden, cl::desc("Build for Hexagon V5"),
+ cl::init(false));
+static cl::opt<bool> MV55("mv55", cl::Hidden, cl::desc("Build for Hexagon V55"),
+ cl::init(false));
+static cl::opt<bool> MV60("mv60", cl::Hidden, cl::desc("Build for Hexagon V60"),
+ cl::init(false));
+static cl::opt<bool> MV62("mv62", cl::Hidden, cl::desc("Build for Hexagon V62"),
+ cl::init(false));
+static cl::opt<bool> MV65("mv65", cl::Hidden, cl::desc("Build for Hexagon V65"),
+ cl::init(false));
+static cl::opt<bool> MV66("mv66", cl::Hidden, cl::desc("Build for Hexagon V66"),
+ cl::init(false));
+static cl::opt<bool> MV67("mv67", cl::Hidden, cl::desc("Build for Hexagon V67"),
+ cl::init(false));
+static cl::opt<bool> MV67T("mv67t", cl::Hidden,
+ cl::desc("Build for Hexagon V67T"), cl::init(false));
+static cl::opt<bool> MV68("mv68", cl::Hidden, cl::desc("Build for Hexagon V68"),
+ cl::init(false));
+static cl::opt<bool> MV69("mv69", cl::Hidden, cl::desc("Build for Hexagon V69"),
+ cl::init(false));
+static cl::opt<bool> MV71("mv71", cl::Hidden, cl::desc("Build for Hexagon V71"),
+ cl::init(false));
+static cl::opt<bool> MV71T("mv71t", cl::Hidden,
+ cl::desc("Build for Hexagon V71T"), cl::init(false));
+static cl::opt<bool> MV73("mv73", cl::Hidden, cl::desc("Build for Hexagon V73"),
+ cl::init(false));
+static cl::opt<bool> MV75("mv75", cl::Hidden, cl::desc("Build for Hexagon V75"),
+ cl::init(false));
+static cl::opt<bool> MV79("mv79", cl::Hidden, cl::desc("Build for Hexagon V79"),
+ cl::init(false));
} // namespace
-cl::opt<Hexagon::ArchEnum> EnableHVX(
+static cl::opt<Hexagon::ArchEnum> EnableHVX(
"mhvx", cl::desc("Enable Hexagon Vector eXtensions"),
cl::values(clEnumValN(Hexagon::ArchEnum::V60, "v60", "Build for HVX v60"),
clEnumValN(Hexagon::ArchEnum::V62, "v62", "Build for HVX v62"),
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
index eed0b42863ee628..d78e755643fb449 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp
@@ -34,7 +34,7 @@ using namespace llvm;
// This disables the removal of registers when lowering into MC, as required
// by some current tests.
-cl::opt<bool>
+static cl::opt<bool>
WasmKeepRegisters("wasm-keep-registers", cl::Hidden,
cl::desc("WebAssembly: output stack registers in"
" instruction output for test purposes only."),
diff --git a/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp b/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
index e234d320b2a1940..e31091d3fc61389 100644
--- a/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
+++ b/llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp
@@ -74,7 +74,7 @@ class X86AlignBranchKind {
X86AlignBranchKind X86AlignBranchKindLoc;
-cl::opt<unsigned> X86AlignBranchBoundary(
+static cl::opt<unsigned> X86AlignBranchBoundary(
"x86-align-branch-boundary", cl::init(0),
cl::desc(
"Control how the assembler should align branches with NOP. If the "
@@ -83,19 +83,20 @@ cl::opt<unsigned> X86AlignBranchBoundary(
"against the boundary of specified size. The default value 0 does not "
"align branches."));
-cl::opt<X86AlignBranchKind, true, cl::parser<std::string>> X86AlignBranch(
- "x86-align-branch",
- cl::desc(
- "Specify types of branches to align (plus separated list of types):"
- "\njcc indicates conditional jumps"
- "\nfused indicates fused conditional jumps"
- "\njmp indicates direct unconditional jumps"
- "\ncall indicates direct and indirect calls"
- "\nret indicates rets"
- "\nindirect indicates indirect unconditional jumps"),
- cl::location(X86AlignBranchKindLoc));
-
-cl::opt<bool> X86AlignBranchWithin32BBoundaries(
+static cl::opt<X86AlignBranchKind, true, cl::parser<std::string>>
+ X86AlignBranch(
+ "x86-align-branch",
+ cl::desc(
+ "Specify types of branches to align (plus separated list of types):"
+ "\njcc indicates conditional jumps"
+ "\nfused indicates fused conditional jumps"
+ "\njmp indicates direct unconditional jumps"
+ "\ncall indicates direct and indirect calls"
+ "\nret indicates rets"
+ "\nindirect indicates indirect unconditional jumps"),
+ cl::location(X86AlignBranchKindLoc));
+
+static cl::opt<bool> X86AlignBranchWithin32BBoundaries(
"x86-branches-within-32B-boundaries", cl::init(false),
cl::desc(
"Align selected instructions to mitigate negative performance impact "
@@ -103,15 +104,15 @@ cl::opt<bool> X86AlignBranchWithin32BBoundaries(
"assumptions about labels corresponding to particular instructions, "
"and should be used with caution."));
-cl::opt<unsigned> X86PadMaxPrefixSize(
+static cl::opt<unsigned> X86PadMaxPrefixSize(
"x86-pad-max-prefix-size", cl::init(0),
cl::desc("Maximum number of prefixes to use for padding"));
-cl::opt<bool> X86PadForAlign(
+static cl::opt<bool> X86PadForAlign(
"x86-pad-for-align", cl::init(false), cl::Hidden,
cl::desc("Pad previous instructions to implement align directives"));
-cl::opt<bool> X86PadForBranchAlign(
+static cl::opt<bool> X86PadForBranchAlign(
"x86-pad-for-branch-align", cl::init(true), cl::Hidden,
cl::desc("Pad previous instructions to implement branch alignment"));
diff --git a/llvm/lib/Transforms/IPO/ElimAvailExtern.cpp b/llvm/lib/Transforms/IPO/ElimAvailExtern.cpp
index afd5e3ac15ac13f..ffdd1e4747c2789 100644
--- a/llvm/lib/Transforms/IPO/ElimAvailExtern.cpp
+++ b/llvm/lib/Transforms/IPO/ElimAvailExtern.cpp
@@ -30,7 +30,7 @@ using namespace llvm;
#define DEBUG_TYPE "elim-avail-extern"
-cl::opt<bool> ConvertToLocal(
+static cl::opt<bool> ConvertToLocal(
"avail-extern-to-local", cl::Hidden,
cl::desc("Convert available_externally into locals, renaming them "
"to avoid link-time clashes."));
diff --git a/llvm/lib/Transforms/IPO/ExpandVariadics.cpp b/llvm/lib/Transforms/IPO/ExpandVariadics.cpp
index 3121659edadd81b..b8bbbdb0aa4a820 100644
--- a/llvm/lib/Transforms/IPO/ExpandVariadics.cpp
+++ b/llvm/lib/Transforms/IPO/ExpandVariadics.cpp
@@ -70,7 +70,7 @@ using namespace llvm;
namespace {
-cl::opt<ExpandVariadicsMode> ExpandVariadicsModeOption(
+static cl::opt<ExpandVariadicsMode> ExpandVariadicsModeOption(
DEBUG_TYPE "-override", cl::desc("Override the behaviour of " DEBUG_TYPE),
cl::init(ExpandVariadicsMode::Unspecified),
cl::values(clEnumValN(ExpandVariadicsMode::Unspecified, "unspecified",
diff --git a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
index d748b162d78094e..08df374734dc877 100644
--- a/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
+++ b/llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
@@ -147,7 +147,7 @@ cl::opt<bool> SupportsHotColdNew(
"supports-hot-cold-new", cl::init(false), cl::Hidden,
cl::desc("Linking with hot/cold operator new interfaces"));
-cl::opt<bool> MemProfRequireDefinitionForPromotion(
+static cl::opt<bool> MemProfRequireDefinitionForPromotion(
"memprof-require-definition-for-promotion", cl::init(false), cl::Hidden,
cl::desc(
"Require target function definition when promoting indirect calls"));
diff --git a/llvm/lib/Transforms/IPO/ModuleInliner.cpp b/llvm/lib/Transforms/IPO/ModuleInliner.cpp
index dbc733826944b93..5dbbd73a4c5dc22 100644
--- a/llvm/lib/Transforms/IPO/ModuleInliner.cpp
+++ b/llvm/lib/Transforms/IPO/ModuleInliner.cpp
@@ -49,7 +49,7 @@ using namespace llvm;
STATISTIC(NumInlined, "Number of functions inlined");
STATISTIC(NumDeleted, "Number of functions deleted because all callers found");
-cl::opt<bool> CtxProfPromoteAlwaysInline(
+static cl::opt<bool> CtxProfPromoteAlwaysInline(
"ctx-prof-promote-alwaysinline", cl::init(false), cl::Hidden,
cl::desc("If using a contextual profile in this module, and an indirect "
"call target is marked as alwaysinline, perform indirect call "
diff --git a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
index 54b328b79a641f5..d13d1a1c040713d 100644
--- a/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
+++ b/llvm/lib/Transforms/Instrumentation/InstrProfiling.cpp
@@ -89,22 +89,22 @@ cl::opt<InstrProfCorrelator::ProfCorrelatorKind> ProfileCorrelate(
namespace {
-cl::opt<bool> DoHashBasedCounterSplit(
+static cl::opt<bool> DoHashBasedCounterSplit(
"hash-based-counter-split",
cl::desc("Rename counter variable of a comdat function based on cfg hash"),
cl::init(true));
-cl::opt<bool>
+static cl::opt<bool>
RuntimeCounterRelocation("runtime-counter-relocation",
cl::desc("Enable relocating counters at runtime."),
cl::init(false));
-cl::opt<bool> ValueProfileStaticAlloc(
+static cl::opt<bool> ValueProfileStaticAlloc(
"vp-static-alloc",
cl::desc("Do static counter allocation for value profiler"),
cl::init(true));
-cl::opt<double> NumCountersPerValueSite(
+static cl::opt<double> NumCountersPerValueSite(
"vp-counters-per-site",
cl::desc("The average number of profile counters allocated "
"per value profiling site."),
@@ -114,24 +114,24 @@ cl::opt<double> NumCountersPerValueSite(
// is usually smaller than 2.
cl::init(1.0));
-cl::opt<bool> AtomicCounterUpdateAll(
+static cl::opt<bool> AtomicCounterUpdateAll(
"instrprof-atomic-counter-update-all",
cl::desc("Make all profile counter updates atomic (for testing only)"),
cl::init(false));
-cl::opt<bool> AtomicCounterUpdatePromoted(
+static cl::opt<bool> AtomicCounterUpdatePromoted(
"atomic-counter-update-promoted",
cl::desc("Do counter update using atomic fetch add "
" for promoted counters only"),
cl::init(false));
-cl::opt<bool> AtomicFirstCounter(
+static cl::opt<bool> AtomicFirstCounter(
"atomic-first-counter",
cl::desc("Use atomic fetch add for first counter in a function (usually "
"the entry counter)"),
cl::init(false));
-cl::opt<bool> ConditionalCounterUpdate(
+static cl::opt<bool> ConditionalCounterUpdate(
"conditional-counter-update",
cl::desc("Do conditional counter updates in single byte counters mode)"),
cl::init(false));
@@ -141,36 +141,37 @@ cl::opt<bool> ConditionalCounterUpdate(
// pipeline is setup, i.e., the default value of true of this option
// does not mean the promotion will be done by default. Explicitly
// setting this option can override the default behavior.
-cl::opt<bool> DoCounterPromotion("do-counter-promotion",
- cl::desc("Do counter register promotion"),
- cl::init(false));
-cl::opt<unsigned> MaxNumOfPromotionsPerLoop(
+static cl::opt<bool>
+ DoCounterPromotion("do-counter-promotion",
+ cl::desc("Do counter register promotion"),
+ cl::init(false));
+static cl::opt<unsigned> MaxNumOfPromotionsPerLoop(
"max-counter-promotions-per-loop", cl::init(20),
cl::desc("Max number counter promotions per loop to avoid"
" increasing register pressure too much"));
// A debug option
-cl::opt<int>
+static cl::opt<int>
MaxNumOfPromotions("max-counter-promotions", cl::init(-1),
cl::desc("Max number of allowed counter promotions"));
-cl::opt<unsigned> SpeculativeCounterPromotionMaxExiting(
+static cl::opt<unsigned> SpeculativeCounterPromotionMaxExiting(
"speculative-counter-promotion-max-exiting", cl::init(3),
cl::desc("The max number of exiting blocks of a loop to allow "
" speculative counter promotion"));
-cl::opt<bool> SpeculativeCounterPromotionToLoop(
+static cl::opt<bool> SpeculativeCounterPromotionToLoop(
"speculative-counter-promotion-to-loop",
cl::desc("When the option is false, if the target block is in a loop, "
"the promotion will be disallowed unless the promoted counter "
" update can be further/iteratively promoted into an acyclic "
" region."));
-cl::opt<bool> IterativeCounterPromotion(
+static cl::opt<bool> IterativeCounterPromotion(
"iterative-counter-promotion", cl::init(true),
cl::desc("Allow counter promotion across the whole loop nest."));
-cl::opt<bool> SkipRetExitBlock(
+static cl::opt<bool> SkipRetExitBlock(
"skip-ret-exit-block", cl::init(true),
cl::desc("Suppress counter promotion if exit blocks contain ret."));
diff --git a/llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp b/llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
index 1759b95ddbc3078..f58826fe89f338b 100644
--- a/llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
+++ b/llvm/lib/Transforms/Instrumentation/SanitizerBinaryMetadata.cpp
@@ -86,26 +86,27 @@ using MetadataInfoSet = SetVector<const MetadataInfo *>;
//===--- Command-line options ---------------------------------------------===//
-cl::opt<bool> ClWeakCallbacks(
+static cl::opt<bool> ClWeakCallbacks(
"sanitizer-metadata-weak-callbacks",
cl::desc("Declare callbacks extern weak, and only call if non-null."),
cl::Hidden, cl::init(true));
-cl::opt<bool>
+static cl::opt<bool>
ClNoSanitize("sanitizer-metadata-nosanitize-attr",
cl::desc("Mark some metadata features uncovered in functions "
"with associated no_sanitize attributes."),
cl::Hidden, cl::init(true));
-cl::opt<bool> ClEmitCovered("sanitizer-metadata-covered",
- cl::desc("Emit PCs for covered functions."),
- cl::Hidden, cl::init(false));
-cl::opt<bool> ClEmitAtomics("sanitizer-metadata-atomics",
- cl::desc("Emit PCs for atomic operations."),
- cl::Hidden, cl::init(false));
-cl::opt<bool> ClEmitUAR("sanitizer-metadata-uar",
- cl::desc("Emit PCs for start of functions that are "
- "subject for use-after-return checking"),
- cl::Hidden, cl::init(false));
+static cl::opt<bool> ClEmitCovered("sanitizer-metadata-covered",
+ cl::desc("Emit PCs for covered functions."),
+ cl::Hidden, cl::init(false));
+static cl::opt<bool> ClEmitAtomics("sanitizer-metadata-atomics",
+ cl::desc("Emit PCs for atomic operations."),
+ cl::Hidden, cl::init(false));
+static cl::opt<bool>
+ ClEmitUAR("sanitizer-metadata-uar",
+ cl::desc("Emit PCs for start of functions that are "
+ "subject for use-after-return checking"),
+ cl::Hidden, cl::init(false));
//===--- Statistics -------------------------------------------------------===//
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index 1a65154ae5936bc..37cd1c65f937749 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -140,7 +140,7 @@ static cl::opt<unsigned> FPAssociationUpperLimit(
"Set upper limit for the number of transformations performed "
"during a single round of hoisting the reassociated expressions."));
-cl::opt<unsigned> IntAssociationUpperLimit(
+static cl::opt<unsigned> IntAssociationUpperLimit(
"licm-max-num-int-reassociations", cl::init(5U), cl::Hidden,
cl::desc(
"Set upper limit for the number of transformations performed "
diff --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp
index e5e2aa655693039..a0ca489a7a32eca 100644
--- a/llvm/lib/Transforms/Utils/Debugify.cpp
+++ b/llvm/lib/Transforms/Utils/Debugify.cpp
@@ -35,10 +35,10 @@ using namespace llvm;
namespace {
-cl::opt<bool> Quiet("debugify-quiet",
- cl::desc("Suppress verbose debugify output"));
+static cl::opt<bool> Quiet("debugify-quiet",
+ cl::desc("Suppress verbose debugify output"));
-cl::opt<uint64_t> DebugifyFunctionsLimit(
+static cl::opt<uint64_t> DebugifyFunctionsLimit(
"debugify-func-limit",
cl::desc("Set max number of processed functions per pass."),
cl::init(UINT_MAX));
@@ -48,7 +48,7 @@ enum class Level {
LocationsAndVariables
};
-cl::opt<Level> DebugifyLevel(
+static cl::opt<Level> DebugifyLevel(
"debugify-level", cl::desc("Kind of debug info to add"),
cl::values(clEnumValN(Level::Locations, "locations", "Locations only"),
clEnumValN(Level::LocationsAndVariables, "location+variables",
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
index e3599315e224f3d..279ae55ee635652 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
@@ -44,7 +44,7 @@ AllowStridedPointerIVs("lv-strided-pointer-ivs", cl::init(false), cl::Hidden,
"pointer induction variables."));
namespace llvm {
-cl::opt<bool>
+static cl::opt<bool>
HintsAllowReordering("hints-allow-reordering", cl::init(true), cl::Hidden,
cl::desc("Allow enabling loop hints to reorder "
"FP operations during vectorization."));
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 6ad44259ccdf6ef..174b00877d8c273 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -352,7 +352,7 @@ static cl::opt<bool> PreferPredicatedReductionSelect(
"Prefer predicating a reduction operation over an after loop select."));
namespace llvm {
-cl::opt<bool> EnableVPlanNativePath(
+static cl::opt<bool> EnableVPlanNativePath(
"enable-vplan-native-path", cl::Hidden,
cl::desc("Enable VPlan-native vectorization path with "
"support for outer loop vectorization."));
diff --git a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp
index bc86c785e84ae94..923a35e60c309e4 100644
--- a/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp
+++ b/llvm/lib/Transforms/Vectorize/SandboxVectorizer/SeedCollector.cpp
@@ -17,16 +17,16 @@
using namespace llvm;
namespace llvm::sandboxir {
-cl::opt<unsigned> SeedBundleSizeLimit(
+static cl::opt<unsigned> SeedBundleSizeLimit(
"sbvec-seed-bundle-size-limit", cl::init(32), cl::Hidden,
cl::desc("Limit the size of the seed bundle to cap compilation time."));
#define LoadSeedsDef "loads"
#define StoreSeedsDef "stores"
-cl::opt<std::string> CollectSeeds(
+static cl::opt<std::string> CollectSeeds(
"sbvec-collect-seeds", cl::init(LoadSeedsDef "," StoreSeedsDef), cl::Hidden,
cl::desc("Collect these seeds. Use empty for none or a comma-separated "
"list of '" LoadSeedsDef "' and '" StoreSeedsDef "'."));
-cl::opt<unsigned> SeedGroupsLimit(
+static cl::opt<unsigned> SeedGroupsLimit(
"sbvec-seed-groups-limit", cl::init(256), cl::Hidden,
cl::desc("Limit the number of collected seeds groups in a BB to "
"cap compilation time."));
diff --git a/llvm/tools/bugpoint/BugDriver.cpp b/llvm/tools/bugpoint/BugDriver.cpp
index f9b8d09501672c7..d2dedf7a305cce3 100644
--- a/llvm/tools/bugpoint/BugDriver.cpp
+++ b/llvm/tools/bugpoint/BugDriver.cpp
@@ -49,9 +49,9 @@ namespace {
// otherwise the raw input run through an interpreter is used as the reference
// source.
//
-cl::opt<std::string> OutputFile("output",
- cl::desc("Specify a reference program output "
- "(for miscompilation detection)"));
+static cl::opt<std::string>
+ OutputFile("output", cl::desc("Specify a reference program output "
+ "(for miscompilation detection)"));
}
/// If we reduce or update the program somehow, call this method to update
diff --git a/llvm/tools/bugpoint/CrashDebugger.cpp b/llvm/tools/bugpoint/CrashDebugger.cpp
index 7dbbf73679584fa..31d6fcb667dcf98 100644
--- a/llvm/tools/bugpoint/CrashDebugger.cpp
+++ b/llvm/tools/bugpoint/CrashDebugger.cpp
@@ -37,37 +37,43 @@
using namespace llvm;
namespace {
-cl::opt<bool> KeepMain("keep-main",
- cl::desc("Force function reduction to keep main"),
- cl::init(false));
-cl::opt<bool> NoGlobalRM("disable-global-remove",
- cl::desc("Do not remove global variables"),
- cl::init(false));
-
-cl::opt<bool> NoAttributeRM("disable-attribute-remove",
- cl::desc("Do not remove function attributes"),
- cl::init(false));
-
-cl::opt<bool> ReplaceFuncsWithNull(
+static cl::opt<bool> KeepMain("keep-main",
+ cl::desc("Force function reduction to keep main"),
+ cl::init(false));
+static cl::opt<bool> NoGlobalRM("disable-global-remove",
+ cl::desc("Do not remove global variables"),
+ cl::init(false));
+
+static cl::opt<bool>
+ NoAttributeRM("disable-attribute-remove",
+ cl::desc("Do not remove function attributes"),
+ cl::init(false));
+
+static cl::opt<bool> ReplaceFuncsWithNull(
"replace-funcs-with-null",
cl::desc("When stubbing functions, replace all uses will null"),
cl::init(false));
-cl::opt<bool> DontReducePassList("disable-pass-list-reduction",
- cl::desc("Skip pass list reduction steps"),
- cl::init(false));
-
-cl::opt<bool> NoNamedMDRM("disable-namedmd-remove",
- cl::desc("Do not remove global named metadata"),
- cl::init(false));
-cl::opt<bool> NoStripDebugInfo("disable-strip-debuginfo",
- cl::desc("Do not strip debug info metadata"),
- cl::init(false));
-cl::opt<bool> NoStripDebugTypeInfo("disable-strip-debug-types",
- cl::desc("Do not strip debug type info metadata"),
- cl::init(false));
-cl::opt<bool> VerboseErrors("verbose-errors",
- cl::desc("Print the output of crashing program"),
- cl::init(false));
+static cl::opt<bool>
+ DontReducePassList("disable-pass-list-reduction",
+ cl::desc("Skip pass list reduction steps"),
+ cl::init(false));
+
+static cl::opt<bool>
+ NoNamedMDRM("disable-namedmd-remove",
+ cl::desc("Do not remove global named metadata"),
+ cl::init(false));
+static cl::opt<bool>
+ NoStripDebugInfo("disable-strip-debuginfo",
+ cl::desc("Do not strip debug info metadata"),
+ cl::init(false));
+static cl::opt<bool>
+ NoStripDebugTypeInfo("disable-strip-debug-types",
+ cl::desc("Do not strip debug type info metadata"),
+ cl::init(false));
+static cl::opt<bool>
+ VerboseErrors("verbose-errors",
+ cl::desc("Print the output of crashing program"),
+ cl::init(false));
}
static bool isValidModule(std::unique_ptr<Module> &M,
diff --git a/llvm/tools/bugpoint/ExecutionDriver.cpp b/llvm/tools/bugpoint/ExecutionDriver.cpp
index 18187ad97ddddcf..a1235bb07cd8ba1 100644
--- a/llvm/tools/bugpoint/ExecutionDriver.cpp
+++ b/llvm/tools/bugpoint/ExecutionDriver.cpp
@@ -37,14 +37,14 @@ enum OutputType {
Custom
};
-cl::opt<double> AbsTolerance("abs-tolerance",
- cl::desc("Absolute error tolerated"),
- cl::init(0.0));
-cl::opt<double> RelTolerance("rel-tolerance",
- cl::desc("Relative error tolerated"),
- cl::init(0.0));
-
-cl::opt<OutputType> InterpreterSel(
+static cl::opt<double> AbsTolerance("abs-tolerance",
+ cl::desc("Absolute error tolerated"),
+ cl::init(0.0));
+static cl::opt<double> RelTolerance("rel-tolerance",
+ cl::desc("Relative error tolerated"),
+ cl::init(0.0));
+
+static cl::opt<OutputType> InterpreterSel(
cl::desc("Specify the \"test\" i.e. suspect back-end:"),
cl::values(clEnumValN(AutoPick, "auto", "Use best guess"),
clEnumValN(RunLLI, "run-int", "Execute with the interpreter"),
@@ -60,7 +60,7 @@ cl::opt<OutputType> InterpreterSel(
"the bitcode. Useful for cross-compilation.")),
cl::init(AutoPick));
-cl::opt<OutputType> SafeInterpreterSel(
+static cl::opt<OutputType> SafeInterpreterSel(
cl::desc("Specify \"safe\" i.e. known-good backend:"),
cl::values(clEnumValN(AutoPick, "safe-auto", "Use best guess"),
clEnumValN(RunLLC, "safe-run-llc", "Compile with LLC"),
@@ -69,16 +69,16 @@ cl::opt<OutputType> SafeInterpreterSel(
"the bitcode. Useful for cross-compilation.")),
cl::init(AutoPick));
-cl::opt<std::string> SafeInterpreterPath(
+static cl::opt<std::string> SafeInterpreterPath(
"safe-path", cl::desc("Specify the path to the \"safe\" backend program"),
cl::init(""));
-cl::opt<bool> AppendProgramExitCode(
+static cl::opt<bool> AppendProgramExitCode(
"append-exit-code",
cl::desc("Append the exit code to the output so it gets diff'd too"),
cl::init(false));
-cl::opt<std::string>
+static cl::opt<std::string>
InputFile("input", cl::init("/dev/null"),
cl::desc("Filename to pipe in as stdin (default: /dev/null)"));
@@ -89,12 +89,12 @@ cl::list<std::string>
cl::list<std::string> AdditionalLinkerArgs(
"Xlinker", cl::desc("Additional arguments to pass to the linker"));
-cl::opt<std::string> CustomCompileCommand(
+static cl::opt<std::string> CustomCompileCommand(
"compile-command", cl::init("llc"),
cl::desc("Command to compile the bitcode (use with -compile-custom) "
"(default: llc)"));
-cl::opt<std::string> CustomExecCommand(
+static cl::opt<std::string> CustomExecCommand(
"exec-command", cl::init("simulate"),
cl::desc("Command to execute the bitcode (use with -run-custom) "
"(default: simulate)"));
@@ -121,8 +121,8 @@ cl::list<std::string> SafeToolArgv("safe-tool-args", cl::Positional,
cl::desc("<safe-tool arguments>..."),
cl::PositionalEatsArgs);
-cl::opt<std::string> CCBinary("gcc", cl::init(""),
- cl::desc("The gcc binary to use."));
+static cl::opt<std::string> CCBinary("gcc", cl::init(""),
+ cl::desc("The gcc binary to use."));
cl::list<std::string> CCToolArgv("gcc-tool-args", cl::Positional,
cl::desc("<gcc-tool arguments>..."),
diff --git a/llvm/tools/bugpoint/ExtractFunction.cpp b/llvm/tools/bugpoint/ExtractFunction.cpp
index dd9a82c3203596c..19cdc2d636e2a85 100644
--- a/llvm/tools/bugpoint/ExtractFunction.cpp
+++ b/llvm/tools/bugpoint/ExtractFunction.cpp
@@ -41,9 +41,10 @@ extern cl::opt<std::string> OutputPrefix;
} // End llvm namespace
namespace {
-cl::opt<bool> NoDCE("disable-dce",
- cl::desc("Do not use the -dce pass to reduce testcases"));
-cl::opt<bool, true>
+static cl::opt<bool>
+ NoDCE("disable-dce",
+ cl::desc("Do not use the -dce pass to reduce testcases"));
+static cl::opt<bool, true>
NoSCFG("disable-simplifycfg", cl::location(DisableSimplifyCFG),
cl::desc("Do not use the -simplifycfg pass to reduce testcases"));
diff --git a/llvm/tools/bugpoint/OptimizerDriver.cpp b/llvm/tools/bugpoint/OptimizerDriver.cpp
index ce324594724cacd..0b29a1f17d87911 100644
--- a/llvm/tools/bugpoint/OptimizerDriver.cpp
+++ b/llvm/tools/bugpoint/OptimizerDriver.cpp
@@ -111,7 +111,7 @@ void BugDriver::EmitProgressBitcode(const Module &M, const std::string &ID,
outs() << " " << getPassesString(PassesToRun) << "\n";
}
-cl::opt<bool> SilencePasses(
+static cl::opt<bool> SilencePasses(
"silence-passes",
cl::desc("Suppress output of running passes (both stdout and stderr)"));
diff --git a/llvm/tools/bugpoint/ToolRunner.cpp b/llvm/tools/bugpoint/ToolRunner.cpp
index e45c89b746aeb72..bdf265f33fcf230 100644
--- a/llvm/tools/bugpoint/ToolRunner.cpp
+++ b/llvm/tools/bugpoint/ToolRunner.cpp
@@ -31,20 +31,20 @@ cl::opt<bool> SaveTemps("save-temps", cl::init(false),
}
namespace {
-cl::opt<std::string>
+static cl::opt<std::string>
RemoteClient("remote-client",
cl::desc("Remote execution client (rsh/ssh)"));
-cl::opt<std::string> RemoteHost("remote-host",
- cl::desc("Remote execution (rsh/ssh) host"));
+static cl::opt<std::string>
+ RemoteHost("remote-host", cl::desc("Remote execution (rsh/ssh) host"));
-cl::opt<std::string> RemotePort("remote-port",
- cl::desc("Remote execution (rsh/ssh) port"));
+static cl::opt<std::string>
+ RemotePort("remote-port", cl::desc("Remote execution (rsh/ssh) port"));
-cl::opt<std::string> RemoteUser("remote-user",
- cl::desc("Remote execution (rsh/ssh) user id"));
+static cl::opt<std::string>
+ RemoteUser("remote-user", cl::desc("Remote execution (rsh/ssh) user id"));
-cl::opt<std::string>
+static cl::opt<std::string>
RemoteExtra("remote-extra-options",
cl::desc("Remote execution (rsh/ssh) extra options"));
}
diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp
index 19246f03941673d..9322865af16f474 100644
--- a/llvm/tools/lli/lli.cpp
+++ b/llvm/tools/lli/lli.cpp
@@ -95,25 +95,26 @@ namespace {
enum class JITKind { MCJIT, Orc, OrcLazy };
enum class JITLinkerKind { Default, RuntimeDyld, JITLink };
- cl::opt<std::string>
- InputFile(cl::desc("<input bitcode>"), cl::Positional, cl::init("-"));
+ static cl::opt<std::string> InputFile(cl::desc("<input bitcode>"),
+ cl::Positional, cl::init("-"));
cl::list<std::string>
InputArgv(cl::ConsumeAfter, cl::desc("<program arguments>..."));
- cl::opt<bool> ForceInterpreter("force-interpreter",
- cl::desc("Force interpretation: disable JIT"),
- cl::init(false));
+ static cl::opt<bool>
+ ForceInterpreter("force-interpreter",
+ cl::desc("Force interpretation: disable JIT"),
+ cl::init(false));
- cl::opt<JITKind> UseJITKind(
- "jit-kind", cl::desc("Choose underlying JIT kind."),
- cl::init(JITKind::Orc),
- cl::values(clEnumValN(JITKind::MCJIT, "mcjit", "MCJIT"),
- clEnumValN(JITKind::Orc, "orc", "Orc JIT"),
- clEnumValN(JITKind::OrcLazy, "orc-lazy",
- "Orc-based lazy JIT.")));
+ static cl::opt<JITKind>
+ UseJITKind("jit-kind", cl::desc("Choose underlying JIT kind."),
+ cl::init(JITKind::Orc),
+ cl::values(clEnumValN(JITKind::MCJIT, "mcjit", "MCJIT"),
+ clEnumValN(JITKind::Orc, "orc", "Orc JIT"),
+ clEnumValN(JITKind::OrcLazy, "orc-lazy",
+ "Orc-based lazy JIT.")));
- cl::opt<JITLinkerKind>
+ static cl::opt<JITLinkerKind>
JITLinker("jit-linker", cl::desc("Choose the dynamic linker/loader."),
cl::init(JITLinkerKind::Default),
cl::values(clEnumValN(JITLinkerKind::Default, "default",
@@ -122,22 +123,22 @@ namespace {
"RuntimeDyld"),
clEnumValN(JITLinkerKind::JITLink, "jitlink",
"Orc-specific linker")));
- cl::opt<std::string> OrcRuntime("orc-runtime",
- cl::desc("Use ORC runtime from given path"),
- cl::init(""));
+ static cl::opt<std::string>
+ OrcRuntime("orc-runtime", cl::desc("Use ORC runtime from given path"),
+ cl::init(""));
- cl::opt<unsigned>
- LazyJITCompileThreads("compile-threads",
- cl::desc("Choose the number of compile threads "
- "(jit-kind=orc-lazy only)"),
- cl::init(0));
+ static cl::opt<unsigned>
+ LazyJITCompileThreads("compile-threads",
+ cl::desc("Choose the number of compile threads "
+ "(jit-kind=orc-lazy only)"),
+ cl::init(0));
cl::list<std::string>
ThreadEntryPoints("thread-entry",
cl::desc("calls the given entry-point on a new thread "
"(jit-kind=orc-lazy only)"));
- cl::opt<bool> PerModuleLazy(
+ static cl::opt<bool> PerModuleLazy(
"per-module-lazy",
cl::desc("Performs lazy compilation on whole module boundaries "
"rather than individual functions"),
@@ -154,36 +155,37 @@ namespace {
// The MCJIT supports building for a target address space separate from
// the JIT compilation process. Use a forked process and a copying
// memory manager with IPC to execute using this functionality.
- cl::opt<bool> RemoteMCJIT("remote-mcjit",
- cl::desc("Execute MCJIT'ed code in a separate process."),
- cl::init(false));
+ static cl::opt<bool>
+ RemoteMCJIT("remote-mcjit",
+ cl::desc("Execute MCJIT'ed code in a separate process."),
+ cl::init(false));
// Manually specify the child process for remote execution. This overrides
// the simulated remote execution that allocates address space for child
// execution. The child process will be executed and will communicate with
// lli via stdin/stdout pipes.
- cl::opt<std::string>
- ChildExecPath("mcjit-remote-process",
- cl::desc("Specify the filename of the process to launch "
- "for remote MCJIT execution. If none is specified,"
- "\n\tremote execution will be simulated in-process."),
- cl::value_desc("filename"), cl::init(""));
+ static cl::opt<std::string> ChildExecPath(
+ "mcjit-remote-process",
+ cl::desc("Specify the filename of the process to launch "
+ "for remote MCJIT execution. If none is specified,"
+ "\n\tremote execution will be simulated in-process."),
+ cl::value_desc("filename"), cl::init(""));
// Determine optimization level.
- cl::opt<char> OptLevel("O",
- cl::desc("Optimization level. [-O0, -O1, -O2, or -O3] "
- "(default = '-O2')"),
- cl::Prefix, cl::init('2'));
+ static cl::opt<char>
+ OptLevel("O",
+ cl::desc("Optimization level. [-O0, -O1, -O2, or -O3] "
+ "(default = '-O2')"),
+ cl::Prefix, cl::init('2'));
- cl::opt<std::string>
- TargetTriple("mtriple", cl::desc("Override target triple for module"));
+ static cl::opt<std::string>
+ TargetTriple("mtriple", cl::desc("Override target triple for module"));
- cl::opt<std::string>
- EntryFunc("entry-function",
- cl::desc("Specify the entry function (default = 'main') "
- "of the executable"),
- cl::value_desc("function"),
- cl::init("main"));
+ static cl::opt<std::string>
+ EntryFunc("entry-function",
+ cl::desc("Specify the entry function (default = 'main') "
+ "of the executable"),
+ cl::value_desc("function"), cl::init("main"));
cl::list<std::string>
ExtraModules("extra-module",
@@ -200,44 +202,44 @@ namespace {
cl::desc("Extra archive files to be loaded"),
cl::value_desc("input archive"));
- cl::opt<bool>
- EnableCacheManager("enable-cache-manager",
- cl::desc("Use cache manager to save/load modules"),
- cl::init(false));
-
- cl::opt<std::string>
- ObjectCacheDir("object-cache-dir",
- cl::desc("Directory to store cached object files "
- "(must be user writable)"),
- cl::init(""));
-
- cl::opt<std::string>
- FakeArgv0("fake-argv0",
- cl::desc("Override the 'argv[0]' value passed into the executing"
- " program"), cl::value_desc("executable"));
-
- cl::opt<bool>
- DisableCoreFiles("disable-core-files", cl::Hidden,
- cl::desc("Disable emission of core files if possible"));
-
- cl::opt<bool>
- NoLazyCompilation("disable-lazy-compilation",
- cl::desc("Disable JIT lazy compilation"),
- cl::init(false));
-
- cl::opt<bool>
- GenerateSoftFloatCalls("soft-float",
- cl::desc("Generate software floating point library calls"),
- cl::init(false));
+ static cl::opt<bool>
+ EnableCacheManager("enable-cache-manager",
+ cl::desc("Use cache manager to save/load modules"),
+ cl::init(false));
+
+ static cl::opt<std::string>
+ ObjectCacheDir("object-cache-dir",
+ cl::desc("Directory to store cached object files "
+ "(must be user writable)"),
+ cl::init(""));
+
+ static cl::opt<std::string> FakeArgv0(
+ "fake-argv0",
+ cl::desc("Override the 'argv[0]' value passed into the executing"
+ " program"),
+ cl::value_desc("executable"));
+
+ static cl::opt<bool>
+ DisableCoreFiles("disable-core-files", cl::Hidden,
+ cl::desc("Disable emission of core files if possible"));
+
+ static cl::opt<bool>
+ NoLazyCompilation("disable-lazy-compilation",
+ cl::desc("Disable JIT lazy compilation"),
+ cl::init(false));
+
+ static cl::opt<bool> GenerateSoftFloatCalls(
+ "soft-float", cl::desc("Generate software floating point library calls"),
+ cl::init(false));
- cl::opt<bool> NoProcessSymbols(
+ static cl::opt<bool> NoProcessSymbols(
"no-process-syms",
cl::desc("Do not resolve lli process symbols in JIT'd code"),
cl::init(false));
enum class LLJITPlatform { Inactive, Auto, ExecutorNative, GenericIR };
- cl::opt<LLJITPlatform> Platform(
+ static cl::opt<LLJITPlatform> Platform(
"lljit-platform", cl::desc("Platform to use with LLJIT"),
cl::init(LLJITPlatform::Auto),
cl::values(clEnumValN(LLJITPlatform::Auto, "Auto",
@@ -261,7 +263,7 @@ namespace {
DumpDebugObjects,
};
- cl::opt<DumpKind> OrcDumpKind(
+ static cl::opt<DumpKind> OrcDumpKind(
"orc-lazy-debug", cl::desc("Debug dumping for the orc-lazy JIT."),
cl::init(DumpKind::NoDump),
cl::values(
diff --git a/llvm/tools/llvm-as/llvm-as.cpp b/llvm/tools/llvm-as/llvm-as.cpp
index d8e36de59bcb4fd..1c29a7b671c46ea 100644
--- a/llvm/tools/llvm-as/llvm-as.cpp
+++ b/llvm/tools/llvm-as/llvm-as.cpp
@@ -30,7 +30,7 @@
#include <optional>
using namespace llvm;
-cl::OptionCategory AsCat("llvm-as Options");
+static cl::OptionCategory AsCat("llvm-as Options");
static cl::opt<std::string>
InputFilename(cl::Positional, cl::desc("<input .ll file>"), cl::init("-"));
diff --git a/llvm/tools/llvm-cat/llvm-cat.cpp b/llvm/tools/llvm-cat/llvm-cat.cpp
index f19f66d56216544..b6d6a80bcc2a170 100644
--- a/llvm/tools/llvm-cat/llvm-cat.cpp
+++ b/llvm/tools/llvm-cat/llvm-cat.cpp
@@ -32,7 +32,7 @@
using namespace llvm;
-cl::OptionCategory CatCategory("llvm-cat Options");
+static cl::OptionCategory CatCategory("llvm-cat Options");
static cl::opt<bool>
BinaryCat("b", cl::desc("Whether to perform binary concatenation"),
diff --git a/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp b/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
index 8a9d9ce41837a14..0f2c7da94230e7a 100644
--- a/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
+++ b/llvm/tools/llvm-cfi-verify/llvm-cfi-verify.cpp
@@ -35,23 +35,25 @@ using namespace llvm::cfi_verify;
static cl::OptionCategory CFIVerifyCategory("CFI Verify Options");
-cl::opt<std::string> InputFilename(cl::Positional, cl::desc("<input file>"),
- cl::Required, cl::cat(CFIVerifyCategory));
-cl::opt<std::string> IgnorelistFilename(cl::Positional,
- cl::desc("[ignorelist file]"),
- cl::init("-"),
- cl::cat(CFIVerifyCategory));
-cl::opt<bool> PrintGraphs(
+static cl::opt<std::string> InputFilename(cl::Positional,
+ cl::desc("<input file>"),
+ cl::Required,
+ cl::cat(CFIVerifyCategory));
+static cl::opt<std::string> IgnorelistFilename(cl::Positional,
+ cl::desc("[ignorelist file]"),
+ cl::init("-"),
+ cl::cat(CFIVerifyCategory));
+static cl::opt<bool> PrintGraphs(
"print-graphs",
cl::desc("Print graphs around indirect CF instructions in DOT format."),
cl::init(false), cl::cat(CFIVerifyCategory));
-cl::opt<unsigned> PrintBlameContext(
+static cl::opt<unsigned> PrintBlameContext(
"blame-context",
cl::desc("Print the blame context (if possible) for BAD instructions. This "
"specifies the number of lines of context to include, where zero "
"disables this feature."),
cl::init(0), cl::cat(CFIVerifyCategory));
-cl::opt<unsigned> PrintBlameContextAll(
+static cl::opt<unsigned> PrintBlameContextAll(
"blame-context-all",
cl::desc("Prints the blame context (if possible) for ALL instructions. "
"This specifies the number of lines of context for non-BAD "
@@ -59,8 +61,8 @@ cl::opt<unsigned> PrintBlameContextAll(
"unspecified, it prints this number of contextual lines for BAD "
"instructions as well."),
cl::init(0), cl::cat(CFIVerifyCategory));
-cl::opt<bool> Summarize("summarize", cl::desc("Print the summary only."),
- cl::init(false), cl::cat(CFIVerifyCategory));
+static cl::opt<bool> Summarize("summarize", cl::desc("Print the summary only."),
+ cl::init(false), cl::cat(CFIVerifyCategory));
ExitOnError ExitOnErr;
diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp
index 921f283deedc737..c55babec85d9f7b 100644
--- a/llvm/tools/llvm-cov/CodeCoverage.cpp
+++ b/llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -652,24 +652,24 @@ void CodeCoverageTool::writeSourceFileView(StringRef SourceFile,
}
int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
- cl::opt<std::string> CovFilename(
+ static cl::opt<std::string> CovFilename(
cl::Positional, cl::desc("Covered executable or object file."));
cl::list<std::string> CovFilenames(
"object", cl::desc("Coverage executable or object file"));
- cl::opt<bool> DebugDumpCollectedObjects(
+ static cl::opt<bool> DebugDumpCollectedObjects(
"dump-collected-objects", cl::Optional, cl::Hidden,
cl::desc("Show the collected coverage object files"));
cl::list<std::string> InputSourceFiles("sources", cl::Positional,
cl::desc("<Source files>"));
- cl::opt<bool> DebugDumpCollectedPaths(
+ static cl::opt<bool> DebugDumpCollectedPaths(
"dump-collected-paths", cl::Optional, cl::Hidden,
cl::desc("Show the collected paths to source files"));
- cl::opt<std::string, true> PGOFilename(
+ static cl::opt<std::string, true> PGOFilename(
"instr-profile", cl::Required, cl::location(this->PGOFilename),
cl::desc(
"File with the profile data obtained after an instrumented run"));
@@ -677,18 +677,18 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
cl::list<std::string> Arches(
"arch", cl::desc("architectures of the coverage mapping binaries"));
- cl::opt<bool> DebugDump("dump", cl::Optional,
- cl::desc("Show internal debug dump"));
+ static cl::opt<bool> DebugDump("dump", cl::Optional,
+ cl::desc("Show internal debug dump"));
cl::list<std::string> DebugFileDirectory(
"debug-file-directory",
cl::desc("Directories to search for object files by build ID"));
- cl::opt<bool> Debuginfod(
+ static cl::opt<bool> Debuginfod(
"debuginfod", cl::ZeroOrMore,
cl::desc("Use debuginfod to look up object files from profile"),
cl::init(canUseDebuginfod()));
- cl::opt<CoverageViewOptions::OutputFormat> Format(
+ static cl::opt<CoverageViewOptions::OutputFormat> Format(
"format", cl::desc("Output format for line-based coverage reports"),
cl::values(clEnumValN(CoverageViewOptions::OutputFormat::Text, "text",
"Text output"),
@@ -703,7 +703,7 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
cl::desc("<from>,<to> Map coverage data paths to local source file "
"paths"));
- cl::OptionCategory FilteringCategory("Function filtering options");
+ static cl::OptionCategory FilteringCategory("Function filtering options");
cl::list<std::string> NameFilters(
"name", cl::Optional,
@@ -728,70 +728,69 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
"regular expression"),
cl::cat(FilteringCategory));
- cl::opt<double> RegionCoverageLtFilter(
+ static cl::opt<double> RegionCoverageLtFilter(
"region-coverage-lt", cl::Optional,
cl::desc("Show code coverage only for functions with region coverage "
"less than the given threshold"),
cl::cat(FilteringCategory));
- cl::opt<double> RegionCoverageGtFilter(
+ static cl::opt<double> RegionCoverageGtFilter(
"region-coverage-gt", cl::Optional,
cl::desc("Show code coverage only for functions with region coverage "
"greater than the given threshold"),
cl::cat(FilteringCategory));
- cl::opt<double> LineCoverageLtFilter(
+ static cl::opt<double> LineCoverageLtFilter(
"line-coverage-lt", cl::Optional,
cl::desc("Show code coverage only for functions with line coverage less "
"than the given threshold"),
cl::cat(FilteringCategory));
- cl::opt<double> LineCoverageGtFilter(
+ static cl::opt<double> LineCoverageGtFilter(
"line-coverage-gt", cl::Optional,
cl::desc("Show code coverage only for functions with line coverage "
"greater than the given threshold"),
cl::cat(FilteringCategory));
- cl::opt<cl::boolOrDefault> UseColor(
+ static cl::opt<cl::boolOrDefault> UseColor(
"use-color", cl::desc("Emit colored output (default=autodetect)"),
cl::init(cl::BOU_UNSET));
cl::list<std::string> DemanglerOpts(
"Xdemangler", cl::desc("<demangler-path>|<demangler-option>"));
- cl::opt<bool> RegionSummary(
+ static cl::opt<bool> RegionSummary(
"show-region-summary", cl::Optional,
- cl::desc("Show region statistics in summary table"),
- cl::init(true));
+ cl::desc("Show region statistics in summary table"), cl::init(true));
- cl::opt<bool> BranchSummary(
+ static cl::opt<bool> BranchSummary(
"show-branch-summary", cl::Optional,
cl::desc("Show branch condition statistics in summary table"),
cl::init(true));
- cl::opt<bool> MCDCSummary("show-mcdc-summary", cl::Optional,
- cl::desc("Show MCDC statistics in summary table"),
- cl::init(false));
+ static cl::opt<bool> MCDCSummary(
+ "show-mcdc-summary", cl::Optional,
+ cl::desc("Show MCDC statistics in summary table"), cl::init(false));
- cl::opt<bool> InstantiationSummary(
+ static cl::opt<bool> InstantiationSummary(
"show-instantiation-summary", cl::Optional,
cl::desc("Show instantiation statistics in summary table"));
- cl::opt<bool> SummaryOnly(
+ static cl::opt<bool> SummaryOnly(
"summary-only", cl::Optional,
cl::desc("Export only summary information for each source file"));
- cl::opt<unsigned> NumThreads(
+ static cl::opt<unsigned> NumThreads(
"num-threads", cl::init(0),
cl::desc("Number of merge threads to use (default: autodetect)"));
cl::alias NumThreadsA("j", cl::desc("Alias for --num-threads"),
cl::aliasopt(NumThreads));
- cl::opt<std::string> CompilationDirectory(
+ static cl::opt<std::string> CompilationDirectory(
"compilation-dir", cl::init(""),
cl::desc("Directory used as a base for relative coverage mapping paths"));
- cl::opt<bool> CheckBinaryIDs(
+ static cl::opt<bool> CheckBinaryIDs(
"check-binary-ids", cl::desc("Fail if an object couldn't be found for a "
"binary ID in the profile"));
@@ -969,19 +968,19 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
int CodeCoverageTool::doShow(int argc, const char **argv,
CommandLineParserType commandLineParser) {
- cl::OptionCategory ViewCategory("Viewing options");
+ static cl::OptionCategory ViewCategory("Viewing options");
- cl::opt<bool> ShowLineExecutionCounts(
+ static cl::opt<bool> ShowLineExecutionCounts(
"show-line-counts", cl::Optional,
cl::desc("Show the execution counts for each line"), cl::init(true),
cl::cat(ViewCategory));
- cl::opt<bool> ShowRegions(
+ static cl::opt<bool> ShowRegions(
"show-regions", cl::Optional,
cl::desc("Show the execution counts for each region"),
cl::cat(ViewCategory));
- cl::opt<CoverageViewOptions::BranchOutputType> ShowBranches(
+ static cl::opt<CoverageViewOptions::BranchOutputType> ShowBranches(
"show-branches", cl::Optional,
cl::desc("Show coverage for branch conditions"), cl::cat(ViewCategory),
cl::values(clEnumValN(CoverageViewOptions::BranchOutputType::Count,
@@ -990,55 +989,57 @@ int CodeCoverageTool::doShow(int argc, const char **argv,
"percent", "Show True/False percent")),
cl::init(CoverageViewOptions::BranchOutputType::Off));
- cl::opt<bool> ShowMCDC(
+ static cl::opt<bool> ShowMCDC(
"show-mcdc", cl::Optional,
cl::desc("Show the MCDC Coverage for each applicable boolean expression"),
cl::cat(ViewCategory));
- cl::opt<bool> ShowBestLineRegionsCounts(
+ static cl::opt<bool> ShowBestLineRegionsCounts(
"show-line-counts-or-regions", cl::Optional,
cl::desc("Show the execution counts for each line, or the execution "
"counts for each region on lines that have multiple regions"),
cl::cat(ViewCategory));
- cl::opt<bool> ShowExpansions("show-expansions", cl::Optional,
- cl::desc("Show expanded source regions"),
- cl::cat(ViewCategory));
+ static cl::opt<bool> ShowExpansions("show-expansions", cl::Optional,
+ cl::desc("Show expanded source regions"),
+ cl::cat(ViewCategory));
- cl::opt<bool> ShowInstantiations("show-instantiations", cl::Optional,
- cl::desc("Show function instantiations"),
- cl::init(true), cl::cat(ViewCategory));
+ static cl::opt<bool> ShowInstantiations(
+ "show-instantiations", cl::Optional,
+ cl::desc("Show function instantiations"), cl::init(true),
+ cl::cat(ViewCategory));
- cl::opt<bool> ShowDirectoryCoverage("show-directory-coverage", cl::Optional,
- cl::desc("Show directory coverage"),
- cl::cat(ViewCategory));
+ static cl::opt<bool> ShowDirectoryCoverage(
+ "show-directory-coverage", cl::Optional,
+ cl::desc("Show directory coverage"), cl::cat(ViewCategory));
- cl::opt<bool> ShowCreatedTime("show-created-time", cl::Optional,
- cl::desc("Show created time for each page."),
- cl::init(true), cl::cat(ViewCategory));
+ static cl::opt<bool> ShowCreatedTime(
+ "show-created-time", cl::Optional,
+ cl::desc("Show created time for each page."), cl::init(true),
+ cl::cat(ViewCategory));
- cl::opt<std::string> ShowOutputDirectory(
+ static cl::opt<std::string> ShowOutputDirectory(
"output-dir", cl::init(""),
cl::desc("Directory in which coverage information is written out"));
cl::alias ShowOutputDirectoryA("o", cl::desc("Alias for --output-dir"),
cl::aliasopt(ShowOutputDirectory));
- cl::opt<bool> BinaryCounters(
+ static cl::opt<bool> BinaryCounters(
"binary-counters", cl::Optional,
cl::desc("Show binary counters (1/0) in lines and branches instead of "
"integer execution counts"),
cl::cat(ViewCategory));
- cl::opt<uint32_t> TabSize(
+ static cl::opt<uint32_t> TabSize(
"tab-size", cl::init(2),
cl::desc(
"Set tab expansion size for html coverage reports (default = 2)"));
- cl::opt<std::string> ProjectTitle(
+ static cl::opt<std::string> ProjectTitle(
"project-title", cl::Optional,
cl::desc("Set project title for the coverage report"));
- cl::opt<std::string> CovWatermark(
+ static cl::opt<std::string> CovWatermark(
"coverage-watermark", cl::Optional,
cl::desc("<high>,<low> value indicate thresholds for high and low"
"coverage watermark"));
@@ -1223,7 +1224,7 @@ int CodeCoverageTool::doShow(int argc, const char **argv,
int CodeCoverageTool::doReport(int argc, const char **argv,
CommandLineParserType commandLineParser) {
- cl::opt<bool> ShowFunctionSummaries(
+ static cl::opt<bool> ShowFunctionSummaries(
"show-functions", cl::Optional, cl::init(false),
cl::desc("Show coverage summaries for each function"));
@@ -1270,19 +1271,20 @@ int CodeCoverageTool::doReport(int argc, const char **argv,
int CodeCoverageTool::doExport(int argc, const char **argv,
CommandLineParserType commandLineParser) {
- cl::OptionCategory ExportCategory("Exporting options");
+ static cl::OptionCategory ExportCategory("Exporting options");
- cl::opt<bool> SkipExpansions("skip-expansions", cl::Optional,
- cl::desc("Don't export expanded source regions"),
- cl::cat(ExportCategory));
+ static cl::opt<bool> SkipExpansions(
+ "skip-expansions", cl::Optional,
+ cl::desc("Don't export expanded source regions"),
+ cl::cat(ExportCategory));
- cl::opt<bool> SkipFunctions("skip-functions", cl::Optional,
- cl::desc("Don't export per-function data"),
- cl::cat(ExportCategory));
+ static cl::opt<bool> SkipFunctions("skip-functions", cl::Optional,
+ cl::desc("Don't export per-function data"),
+ cl::cat(ExportCategory));
- cl::opt<bool> SkipBranches("skip-branches", cl::Optional,
- cl::desc("Don't export branch data (LCOV)"),
- cl::cat(ExportCategory));
+ static cl::opt<bool> SkipBranches("skip-branches", cl::Optional,
+ cl::desc("Don't export branch data (LCOV)"),
+ cl::cat(ExportCategory));
auto Err = commandLineParser(argc, argv);
if (Err)
diff --git a/llvm/tools/llvm-cov/TestingSupport.cpp b/llvm/tools/llvm-cov/TestingSupport.cpp
index 6ad8c35d6e12f87..ef365505a29494b 100644
--- a/llvm/tools/llvm-cov/TestingSupport.cpp
+++ b/llvm/tools/llvm-cov/TestingSupport.cpp
@@ -23,10 +23,10 @@ using namespace llvm;
using namespace object;
int convertForTestingMain(int argc, const char *argv[]) {
- cl::opt<std::string> InputSourceFile(cl::Positional, cl::Required,
- cl::desc("<Source file>"));
+ static cl::opt<std::string> InputSourceFile(cl::Positional, cl::Required,
+ cl::desc("<Source file>"));
- cl::opt<std::string> OutputFilename(
+ static cl::opt<std::string> OutputFilename(
"o", cl::Required,
cl::desc(
"File with the profile data obtained after an instrumented run"));
diff --git a/llvm/tools/llvm-cov/gcov.cpp b/llvm/tools/llvm-cov/gcov.cpp
index 00ea12415b220ed..f960922fc03174e 100644
--- a/llvm/tools/llvm-cov/gcov.cpp
+++ b/llvm/tools/llvm-cov/gcov.cpp
@@ -84,85 +84,89 @@ int gcovMain(int argc, const char *argv[]) {
cl::list<std::string> SourceFiles(cl::Positional, cl::OneOrMore,
cl::desc("SOURCEFILE"));
- cl::opt<bool> AllBlocks("a", cl::Grouping, cl::init(false),
- cl::desc("Display all basic blocks"));
+ static cl::opt<bool> AllBlocks("a", cl::Grouping, cl::init(false),
+ cl::desc("Display all basic blocks"));
cl::alias AllBlocksA("all-blocks", cl::aliasopt(AllBlocks));
- cl::opt<bool> BranchProb("b", cl::Grouping, cl::init(false),
- cl::desc("Display branch probabilities"));
+ static cl::opt<bool> BranchProb("b", cl::Grouping, cl::init(false),
+ cl::desc("Display branch probabilities"));
cl::alias BranchProbA("branch-probabilities", cl::aliasopt(BranchProb));
- cl::opt<bool> BranchCount("c", cl::Grouping, cl::init(false),
- cl::desc("Display branch counts instead "
- "of percentages (requires -b)"));
+ static cl::opt<bool> BranchCount("c", cl::Grouping, cl::init(false),
+ cl::desc("Display branch counts instead "
+ "of percentages (requires -b)"));
cl::alias BranchCountA("branch-counts", cl::aliasopt(BranchCount));
- cl::opt<bool> LongNames("l", cl::Grouping, cl::init(false),
- cl::desc("Prefix filenames with the main file"));
+ static cl::opt<bool> LongNames(
+ "l", cl::Grouping, cl::init(false),
+ cl::desc("Prefix filenames with the main file"));
cl::alias LongNamesA("long-file-names", cl::aliasopt(LongNames));
- cl::opt<bool> FuncSummary("f", cl::Grouping, cl::init(false),
- cl::desc("Show coverage for each function"));
+ static cl::opt<bool> FuncSummary("f", cl::Grouping, cl::init(false),
+ cl::desc("Show coverage for each function"));
cl::alias FuncSummaryA("function-summaries", cl::aliasopt(FuncSummary));
// Supported by gcov 4.9~8. gcov 9 (GCC r265587) removed --intermediate-format
// and -i was changed to mean --json-format. We consider this format still
// useful and support -i.
- cl::opt<bool> Intermediate(
+ static cl::opt<bool> Intermediate(
"intermediate-format", cl::init(false),
cl::desc("Output .gcov in intermediate text format"));
cl::alias IntermediateA("i", cl::desc("Alias for --intermediate-format"),
cl::Grouping, cl::NotHidden,
cl::aliasopt(Intermediate));
- cl::opt<bool> Demangle("demangled-names", cl::init(false),
- cl::desc("Demangle function names"));
+ static cl::opt<bool> Demangle("demangled-names", cl::init(false),
+ cl::desc("Demangle function names"));
cl::alias DemangleA("m", cl::desc("Alias for --demangled-names"),
cl::Grouping, cl::NotHidden, cl::aliasopt(Demangle));
- cl::opt<bool> NoOutput("n", cl::Grouping, cl::init(false),
- cl::desc("Do not output any .gcov files"));
+ static cl::opt<bool> NoOutput("n", cl::Grouping, cl::init(false),
+ cl::desc("Do not output any .gcov files"));
cl::alias NoOutputA("no-output", cl::aliasopt(NoOutput));
- cl::opt<std::string> ObjectDir(
+ static cl::opt<std::string> ObjectDir(
"o", cl::value_desc("DIR|FILE"), cl::init(""),
cl::desc("Find objects in DIR or based on FILE's path"));
cl::alias ObjectDirA("object-directory", cl::aliasopt(ObjectDir));
cl::alias ObjectDirB("object-file", cl::aliasopt(ObjectDir));
- cl::opt<bool> PreservePaths("p", cl::Grouping, cl::init(false),
- cl::desc("Preserve path components"));
+ static cl::opt<bool> PreservePaths("p", cl::Grouping, cl::init(false),
+ cl::desc("Preserve path components"));
cl::alias PreservePathsA("preserve-paths", cl::aliasopt(PreservePaths));
- cl::opt<bool> RelativeOnly(
+ static cl::opt<bool> RelativeOnly(
"r", cl::Grouping,
cl::desc("Only dump files with relative paths or absolute paths with the "
"prefix specified by -s"));
cl::alias RelativeOnlyA("relative-only", cl::aliasopt(RelativeOnly));
- cl::opt<std::string> SourcePrefix("s", cl::desc("Source prefix to elide"));
+ static cl::opt<std::string> SourcePrefix("s",
+ cl::desc("Source prefix to elide"));
cl::alias SourcePrefixA("source-prefix", cl::aliasopt(SourcePrefix));
- cl::opt<bool> UseStdout("t", cl::Grouping, cl::init(false),
- cl::desc("Print to stdout"));
+ static cl::opt<bool> UseStdout("t", cl::Grouping, cl::init(false),
+ cl::desc("Print to stdout"));
cl::alias UseStdoutA("stdout", cl::aliasopt(UseStdout));
- cl::opt<bool> UncondBranch("u", cl::Grouping, cl::init(false),
- cl::desc("Display unconditional branch info "
- "(requires -b)"));
+ static cl::opt<bool> UncondBranch(
+ "u", cl::Grouping, cl::init(false),
+ cl::desc("Display unconditional branch info "
+ "(requires -b)"));
cl::alias UncondBranchA("unconditional-branches", cl::aliasopt(UncondBranch));
- cl::opt<bool> HashFilenames("x", cl::Grouping, cl::init(false),
- cl::desc("Hash long pathnames"));
+ static cl::opt<bool> HashFilenames("x", cl::Grouping, cl::init(false),
+ cl::desc("Hash long pathnames"));
cl::alias HashFilenamesA("hash-filenames", cl::aliasopt(HashFilenames));
-
- cl::OptionCategory DebugCat("Internal and debugging options");
- cl::opt<bool> DumpGCOV("dump", cl::init(false), cl::cat(DebugCat),
- cl::desc("Dump the gcov file to stderr"));
- cl::opt<std::string> InputGCNO("gcno", cl::cat(DebugCat), cl::init(""),
- cl::desc("Override inferred gcno file"));
- cl::opt<std::string> InputGCDA("gcda", cl::cat(DebugCat), cl::init(""),
- cl::desc("Override inferred gcda file"));
+ static cl::OptionCategory DebugCat("Internal and debugging options");
+ static cl::opt<bool> DumpGCOV("dump", cl::init(false), cl::cat(DebugCat),
+ cl::desc("Dump the gcov file to stderr"));
+ static cl::opt<std::string> InputGCNO(
+ "gcno", cl::cat(DebugCat), cl::init(""),
+ cl::desc("Override inferred gcno file"));
+ static cl::opt<std::string> InputGCDA(
+ "gcda", cl::cat(DebugCat), cl::init(""),
+ cl::desc("Override inferred gcda file"));
cl::ParseCommandLineOptions(argc, argv, "LLVM code coverage tool\n");
diff --git a/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp b/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
index c04aec19174b8dd..2022444931b8607 100644
--- a/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
+++ b/llvm/tools/llvm-cxxdump/llvm-cxxdump.cpp
@@ -33,7 +33,7 @@ using namespace llvm::object;
using namespace llvm::support;
namespace opts {
-cl::OptionCategory CXXDumpCategory("CXX Dump Options");
+static cl::OptionCategory CXXDumpCategory("CXX Dump Options");
cl::list<std::string> InputFilenames(cl::Positional,
cl::desc("<input object files>"),
cl::cat(CXXDumpCategory));
diff --git a/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp b/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp
index c5ccd64f1165395..0a148908ef61b7d 100644
--- a/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp
+++ b/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp
@@ -25,30 +25,31 @@
using namespace llvm;
-cl::OptionCategory CXXMapCategory("CXX Map Options");
-
-cl::opt<std::string> OldSymbolFile(cl::Positional, cl::Required,
- cl::desc("<symbol-file>"),
- cl::cat(CXXMapCategory));
-cl::opt<std::string> NewSymbolFile(cl::Positional, cl::Required,
- cl::desc("<symbol-file>"),
- cl::cat(CXXMapCategory));
-cl::opt<std::string> RemappingFile("remapping-file", cl::Required,
- cl::desc("Remapping file"),
- cl::cat(CXXMapCategory));
+static cl::OptionCategory CXXMapCategory("CXX Map Options");
+
+static cl::opt<std::string> OldSymbolFile(cl::Positional, cl::Required,
+ cl::desc("<symbol-file>"),
+ cl::cat(CXXMapCategory));
+static cl::opt<std::string> NewSymbolFile(cl::Positional, cl::Required,
+ cl::desc("<symbol-file>"),
+ cl::cat(CXXMapCategory));
+static cl::opt<std::string> RemappingFile("remapping-file", cl::Required,
+ 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::cat(CXXMapCategory));
+static cl::opt<std::string> OutputFilename("output", cl::value_desc("output"),
+ cl::init("-"),
+ cl::desc("Output file"),
+ cl::cat(CXXMapCategory));
cl::alias OutputFilenameA("o", cl::aliasopt(OutputFilename),
cl::cat(CXXMapCategory));
-cl::opt<bool> WarnAmbiguous(
+static cl::opt<bool> WarnAmbiguous(
"Wambiguous",
cl::desc("Warn on equivalent symbols in the output symbol list"),
cl::cat(CXXMapCategory));
-cl::opt<bool> WarnIncomplete(
+static cl::opt<bool> WarnIncomplete(
"Wincomplete",
cl::desc("Warn on input symbols missing from output symbol list"),
cl::cat(CXXMapCategory));
diff --git a/llvm/tools/llvm-diff/llvm-diff.cpp b/llvm/tools/llvm-diff/llvm-diff.cpp
index 3e77b1ed89b048c..2126b91f75ae1fd 100644
--- a/llvm/tools/llvm-diff/llvm-diff.cpp
+++ b/llvm/tools/llvm-diff/llvm-diff.cpp
@@ -56,7 +56,7 @@ static void diffGlobal(DifferenceEngine &Engine, Module &L, Module &R,
errs() << "No function named @" << Name << " in right module\n";
}
-cl::OptionCategory DiffCategory("Diff Options");
+static cl::OptionCategory DiffCategory("Diff Options");
static cl::opt<std::string> LeftFilename(cl::Positional,
cl::desc("<first file>"), cl::Required,
diff --git a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
index d63c51566e80cb5..43131b058941a6f 100644
--- a/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
+++ b/llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp
@@ -137,11 +137,12 @@ static list<std::string>
InputFilenames(Positional, desc("<input object files or .dSYM bundles>"),
cat(DwarfDumpCategory));
-cl::OptionCategory SectionCategory("Section-specific Dump Options",
- "These control which sections are dumped. "
- "Where applicable these parameters take an "
- "optional =<offset> argument to dump only "
- "the entry at the specified offset.");
+static cl::OptionCategory
+ SectionCategory("Section-specific Dump Options",
+ "These control which sections are dumped. "
+ "Where applicable these parameters take an "
+ "optional =<offset> argument to dump only "
+ "the entry at the specified offset.");
static opt<bool> DumpAll("all", desc("Dump all debug info sections"),
cat(SectionCategory));
diff --git a/llvm/tools/llvm-extract/llvm-extract.cpp b/llvm/tools/llvm-extract/llvm-extract.cpp
index 5fc9a31ab4ad7c7..9641178c78069bd 100644
--- a/llvm/tools/llvm-extract/llvm-extract.cpp
+++ b/llvm/tools/llvm-extract/llvm-extract.cpp
@@ -41,7 +41,7 @@
using namespace llvm;
-cl::OptionCategory ExtractCat("llvm-extract Options");
+static cl::OptionCategory ExtractCat("llvm-extract Options");
// InputFilename - The filename to read from.
static cl::opt<std::string> InputFilename(cl::Positional,
diff --git a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
index a7ab7554902f8f4..e98bf03e61b99e1 100644
--- a/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
+++ b/llvm/tools/llvm-jitlink/llvm-jitlink.cpp
@@ -94,7 +94,7 @@ static cl::list<bool> LazyLink("lazy",
enum class SpeculateKind { None, Simple };
-cl::opt<SpeculateKind> Speculate(
+static cl::opt<SpeculateKind> Speculate(
"speculate", cl::desc("Choose speculation scheme"),
cl::init(SpeculateKind::None),
cl::values(clEnumValN(SpeculateKind::None, "none", "No speculation"),
@@ -102,13 +102,13 @@ cl::opt<SpeculateKind> Speculate(
"Simple speculation")),
cl::cat(JITLinkCategory));
-cl::opt<std::string> SpeculateOrder(
+static cl::opt<std::string> SpeculateOrder(
"speculate-order",
cl::desc("A CSV file containing (JITDylib, Function) pairs to"
"speculatively look up"),
cl::cat(JITLinkCategory));
-cl::opt<std::string> RecordLazyExecs(
+static cl::opt<std::string> RecordLazyExecs(
"record-lazy-execs",
cl::desc("Write lazy-function executions to a CSV file as (JITDylib, "
"function) pairs"),
diff --git a/llvm/tools/llvm-lto/llvm-lto.cpp b/llvm/tools/llvm-lto/llvm-lto.cpp
index 4090faf4e3fd95b..516c7b7c6c83e10 100644
--- a/llvm/tools/llvm-lto/llvm-lto.cpp
+++ b/llvm/tools/llvm-lto/llvm-lto.cpp
@@ -109,7 +109,7 @@ enum ThinLTOModes {
THINALL
};
-cl::opt<ThinLTOModes> ThinLTOMode(
+static cl::opt<ThinLTOModes> ThinLTOMode(
"thinlto-action", cl::desc("Perform a single ThinLTO stage:"),
cl::values(
clEnumValN(
diff --git a/llvm/tools/llvm-lto2/llvm-lto2.cpp b/llvm/tools/llvm-lto2/llvm-lto2.cpp
index d4f022ef021a44e..3ad2a3ecb6752af 100644
--- a/llvm/tools/llvm-lto2/llvm-lto2.cpp
+++ b/llvm/tools/llvm-lto2/llvm-lto2.cpp
@@ -130,7 +130,7 @@ static cl::opt<bool> RemarksWithHotness(
cl::desc("With PGO, include profile count in optimization remarks"),
cl::Hidden);
-cl::opt<std::optional<uint64_t>, false, remarks::HotnessThresholdParser>
+static cl::opt<std::optional<uint64_t>, false, remarks::HotnessThresholdParser>
RemarksHotnessThreshold(
"pass-remarks-hotness-threshold",
cl::desc("Minimum profile count required for an "
diff --git a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
index 9da14cc52d6cb4f..fc20f9c6787e208 100644
--- a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
+++ b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
@@ -124,9 +124,9 @@ cl::SubCommand ExplainSubcommand("explain",
cl::SubCommand ExportSubcommand("export",
"Write binary data from a stream to a file");
-cl::OptionCategory TypeCategory("Symbol Type Options");
-cl::OptionCategory FilterCategory("Filtering and Sorting Options");
-cl::OptionCategory OtherOptions("Other Options");
+static cl::OptionCategory TypeCategory("Symbol Type Options");
+static cl::OptionCategory FilterCategory("Filtering and Sorting Options");
+static cl::OptionCategory OtherOptions("Other Options");
cl::ValuesClass ChunkValues = cl::values(
clEnumValN(ModuleSubsection::CrossScopeExports, "cme",
@@ -366,14 +366,14 @@ cl::opt<bool> NoEnumDefs("no-enum-definitions",
cl::cat(FilterCategory), cl::sub(PrettySubcommand));
}
-cl::OptionCategory FileOptions("Module & File Options");
+static cl::OptionCategory FileOptions("Module & File Options");
namespace bytes {
-cl::OptionCategory MsfBytes("MSF File Options");
-cl::OptionCategory DbiBytes("Dbi Stream Options");
-cl::OptionCategory PdbBytes("PDB Stream Options");
-cl::OptionCategory Types("Type Options");
-cl::OptionCategory ModuleCategory("Module Options");
+static cl::OptionCategory MsfBytes("MSF File Options");
+static cl::OptionCategory DbiBytes("Dbi Stream Options");
+static cl::OptionCategory PdbBytes("PDB Stream Options");
+static cl::OptionCategory Types("Type Options");
+static cl::OptionCategory ModuleCategory("Module Options");
std::optional<NumberRange> DumpBlockRange;
std::optional<NumberRange> DumpByteRange;
@@ -446,10 +446,10 @@ cl::list<std::string> InputFilenames(cl::Positional,
namespace dump {
-cl::OptionCategory MsfOptions("MSF Container Options");
-cl::OptionCategory TypeOptions("Type Record Options");
-cl::OptionCategory SymbolOptions("Symbol Options");
-cl::OptionCategory MiscOptions("Miscellaneous Options");
+static cl::OptionCategory MsfOptions("MSF Container Options");
+static cl::OptionCategory TypeOptions("Type Record Options");
+static cl::OptionCategory SymbolOptions("Symbol Options");
+static cl::OptionCategory MiscOptions("Miscellaneous Options");
// MSF OPTIONS
cl::opt<bool> DumpSummary("summary", cl::desc("dump file summary"),
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 560210e59eeba67..5fa1c23355120f1 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -103,31 +103,32 @@ cl::alias OutputFilenameA("o", cl::desc("Alias for --output"),
cl::aliasopt(OutputFilename));
// Options common to at least two commands.
-cl::opt<ProfileKinds> ProfileKind(
+static cl::opt<ProfileKinds> ProfileKind(
cl::desc("Profile kind:"), cl::sub(MergeSubcommand),
cl::sub(OverlapSubcommand), cl::init(instr),
cl::values(clEnumVal(instr, "Instrumentation profile (default)"),
clEnumVal(sample, "Sample profile")));
-cl::opt<std::string> Filename(cl::Positional, cl::desc("<profdata-file>"),
- cl::sub(ShowSubcommand),
- cl::sub(OrderSubcommand));
-cl::opt<unsigned> MaxDbgCorrelationWarnings(
+static cl::opt<std::string> Filename(cl::Positional,
+ cl::desc("<profdata-file>"),
+ cl::sub(ShowSubcommand),
+ cl::sub(OrderSubcommand));
+static cl::opt<unsigned> MaxDbgCorrelationWarnings(
"max-debug-info-correlation-warnings",
cl::desc("The maximum number of warnings to emit when correlating "
"profile from debug info (0 = no limit)"),
cl::sub(MergeSubcommand), cl::sub(ShowSubcommand), cl::init(5));
-cl::opt<std::string> ProfiledBinary(
+static cl::opt<std::string> ProfiledBinary(
"profiled-binary", cl::init(""),
cl::desc("Path to binary from which the profile was collected."),
cl::sub(ShowSubcommand), cl::sub(MergeSubcommand));
-cl::opt<std::string> DebugInfoFilename(
+static cl::opt<std::string> DebugInfoFilename(
"debug-info", cl::init(""),
cl::desc(
"For show, read and extract profile metadata from debug info and show "
"the functions it found. For merge, use the provided debug info to "
"correlate the raw profile."),
cl::sub(ShowSubcommand), cl::sub(MergeSubcommand));
-cl::opt<std::string>
+static cl::opt<std::string>
BinaryFilename("binary-file", cl::init(""),
cl::desc("For merge, use the provided unstripped bianry to "
"correlate the raw profile."),
@@ -135,10 +136,10 @@ cl::opt<std::string>
cl::list<std::string> DebugFileDirectory(
"debug-file-directory",
cl::desc("Directories to search for object files by build ID"));
-cl::opt<bool> DebugInfod("debuginfod", cl::init(false), cl::Hidden,
- cl::sub(MergeSubcommand),
- cl::desc("Enable debuginfod"));
-cl::opt<ProfCorrelatorKind> BIDFetcherProfileCorrelate(
+static cl::opt<bool> DebugInfod("debuginfod", cl::init(false), cl::Hidden,
+ cl::sub(MergeSubcommand),
+ cl::desc("Enable debuginfod"));
+static cl::opt<ProfCorrelatorKind> BIDFetcherProfileCorrelate(
"correlate",
cl::desc("Use debug-info or binary correlation to correlate profiles with "
"build id fetcher"),
@@ -149,7 +150,7 @@ cl::opt<ProfCorrelatorKind> BIDFetcherProfileCorrelate(
"Use debug info to correlate"),
clEnumValN(InstrProfCorrelator::BINARY, "binary",
"Use binary to correlate")));
-cl::opt<std::string> FuncNameFilter(
+static cl::opt<std::string> FuncNameFilter(
"function",
cl::desc("Only functions matching the filter are shown in the output. For "
"overlapping CSSPGO, this takes a function name with calling "
@@ -167,7 +168,7 @@ cl::list<std::string> InputFilenames(cl::Positional, cl::sub(MergeSubcommand),
cl::list<std::string> WeightedInputFilenames("weighted-input",
cl::sub(MergeSubcommand),
cl::desc("<weight>,<filename>"));
-cl::opt<ProfileFormat> OutputFormat(
+static cl::opt<ProfileFormat> OutputFormat(
cl::desc("Format of output profile"), cl::sub(MergeSubcommand),
cl::init(PF_Ext_Binary),
cl::values(clEnumValN(PF_Binary, "binary", "Binary encoding"),
@@ -177,69 +178,69 @@ cl::opt<ProfileFormat> OutputFormat(
clEnumValN(PF_Text, "text", "Text encoding"),
clEnumValN(PF_GCC, "gcc",
"GCC encoding (only meaningful for -sample)")));
-cl::opt<std::string>
+static cl::opt<std::string>
InputFilenamesFile("input-files", cl::init(""), cl::sub(MergeSubcommand),
cl::desc("Path to file containing newline-separated "
"[<weight>,]<filename> entries"));
cl::alias InputFilenamesFileA("f", cl::desc("Alias for --input-files"),
cl::aliasopt(InputFilenamesFile));
-cl::opt<bool> DumpInputFileList(
+static cl::opt<bool> DumpInputFileList(
"dump-input-file-list", cl::init(false), cl::Hidden,
cl::sub(MergeSubcommand),
cl::desc("Dump the list of input files and their weights, then exit"));
-cl::opt<std::string> RemappingFile("remapping-file", cl::value_desc("file"),
- cl::sub(MergeSubcommand),
- cl::desc("Symbol remapping file"));
+static cl::opt<std::string> RemappingFile("remapping-file",
+ cl::value_desc("file"),
+ cl::sub(MergeSubcommand),
+ cl::desc("Symbol remapping file"));
cl::alias RemappingFileA("r", cl::desc("Alias for --remapping-file"),
cl::aliasopt(RemappingFile));
-cl::opt<bool>
+static cl::opt<bool>
UseMD5("use-md5", cl::init(false), cl::Hidden,
cl::desc("Choose to use MD5 to represent string in name table (only "
"meaningful for -extbinary)"),
cl::sub(MergeSubcommand));
-cl::opt<bool> CompressAllSections(
+static cl::opt<bool> CompressAllSections(
"compress-all-sections", cl::init(false), cl::Hidden,
cl::sub(MergeSubcommand),
cl::desc("Compress all sections when writing the profile (only "
"meaningful for -extbinary)"));
-cl::opt<bool> SampleMergeColdContext(
+static cl::opt<bool> SampleMergeColdContext(
"sample-merge-cold-context", cl::init(false), cl::Hidden,
cl::sub(MergeSubcommand),
cl::desc(
"Merge context sample profiles whose count is below cold threshold"));
-cl::opt<bool> SampleTrimColdContext(
+static cl::opt<bool> SampleTrimColdContext(
"sample-trim-cold-context", cl::init(false), cl::Hidden,
cl::sub(MergeSubcommand),
cl::desc(
"Trim context sample profiles whose count is below cold threshold"));
-cl::opt<uint32_t> SampleColdContextFrameDepth(
+static cl::opt<uint32_t> SampleColdContextFrameDepth(
"sample-frame-depth-for-cold-context", cl::init(1),
cl::sub(MergeSubcommand),
cl::desc("Keep the last K frames while merging cold profile. 1 means the "
"context-less base profile"));
-cl::opt<size_t> OutputSizeLimit(
+static cl::opt<size_t> OutputSizeLimit(
"output-size-limit", cl::init(0), cl::Hidden, cl::sub(MergeSubcommand),
cl::desc("Trim cold functions until profile size is below specified "
"limit in bytes. This uses a heursitic and functions may be "
"excessively trimmed"));
-cl::opt<bool> GenPartialProfile(
+static cl::opt<bool> GenPartialProfile(
"gen-partial-profile", cl::init(false), cl::Hidden,
cl::sub(MergeSubcommand),
cl::desc("Generate a partial profile (only meaningful for -extbinary)"));
-cl::opt<bool> SplitLayout(
- "split-layout", cl::init(false), cl::Hidden,
- cl::sub(MergeSubcommand),
+static cl::opt<bool> SplitLayout(
+ "split-layout", cl::init(false), cl::Hidden, cl::sub(MergeSubcommand),
cl::desc("Split the profile to two sections with one containing sample "
"profiles with inlined functions and the other without (only "
"meaningful for -extbinary)"));
-cl::opt<std::string> SupplInstrWithSample(
+static cl::opt<std::string> SupplInstrWithSample(
"supplement-instr-with-sample", cl::init(""), cl::Hidden,
cl::sub(MergeSubcommand),
cl::desc("Supplement an instr profile with sample profile, to correct "
"the profile unrepresentativeness issue. The sample "
"profile is the input of the flag. Output will be in instr "
"format (The flag only works with -instr)"));
-cl::opt<float> ZeroCounterThreshold(
+static cl::opt<float> ZeroCounterThreshold(
"zero-counter-threshold", cl::init(0.7), cl::Hidden,
cl::sub(MergeSubcommand),
cl::desc("For the function which is cold in instr profile but hot in "
@@ -247,13 +248,13 @@ cl::opt<float> ZeroCounterThreshold(
"divided by the total number of counters is above the "
"threshold, the profile of the function will be regarded as "
"being harmful for performance and will be dropped."));
-cl::opt<unsigned> SupplMinSizeThreshold(
+static cl::opt<unsigned> SupplMinSizeThreshold(
"suppl-min-size-threshold", cl::init(10), cl::Hidden,
cl::sub(MergeSubcommand),
cl::desc("If the size of a function is smaller than the threshold, "
"assume it can be inlined by PGO early inliner and it won't "
"be adjusted based on sample profile."));
-cl::opt<unsigned> InstrProfColdThreshold(
+static cl::opt<unsigned> InstrProfColdThreshold(
"instr-prof-cold-threshold", cl::init(0), cl::Hidden,
cl::sub(MergeSubcommand),
cl::desc("User specified cold threshold for instr profile which will "
@@ -261,22 +262,21 @@ cl::opt<unsigned> InstrProfColdThreshold(
// WARNING: This reservoir size value is propagated to any input indexed
// profiles for simplicity. Changing this value between invocations could
// result in sample bias.
-cl::opt<uint64_t> TemporalProfTraceReservoirSize(
+static cl::opt<uint64_t> TemporalProfTraceReservoirSize(
"temporal-profile-trace-reservoir-size", cl::init(100),
cl::sub(MergeSubcommand),
cl::desc("The maximum number of stored temporal profile traces (default: "
"100)"));
-cl::opt<uint64_t> TemporalProfMaxTraceLength(
+static cl::opt<uint64_t> TemporalProfMaxTraceLength(
"temporal-profile-max-trace-length", cl::init(10000),
cl::sub(MergeSubcommand),
cl::desc("The maximum length of a single temporal profile trace "
"(default: 10000)"));
-cl::opt<std::string> FuncNameNegativeFilter(
- "no-function", cl::init(""),
- cl::sub(MergeSubcommand),
+static cl::opt<std::string> FuncNameNegativeFilter(
+ "no-function", cl::init(""), cl::sub(MergeSubcommand),
cl::desc("Exclude functions matching the filter from the output."));
-cl::opt<FailureMode>
+static cl::opt<FailureMode>
FailMode("failure-mode", cl::init(failIfAnyAreInvalid),
cl::desc("Failure mode:"), cl::sub(MergeSubcommand),
cl::values(clEnumValN(warnOnly, "warn",
@@ -286,21 +286,21 @@ cl::opt<FailureMode>
clEnumValN(failIfAllAreInvalid, "all",
"Fail only if all profiles are invalid.")));
-cl::opt<bool> OutputSparse(
+static cl::opt<bool> OutputSparse(
"sparse", cl::init(false), cl::sub(MergeSubcommand),
cl::desc("Generate a sparse profile (only meaningful for -instr)"));
-cl::opt<unsigned> NumThreads(
+static cl::opt<unsigned> NumThreads(
"num-threads", cl::init(0), cl::sub(MergeSubcommand),
cl::desc("Number of merge threads to use (default: autodetect)"));
cl::alias NumThreadsA("j", cl::desc("Alias for --num-threads"),
cl::aliasopt(NumThreads));
-cl::opt<std::string> ProfileSymbolListFile(
+static cl::opt<std::string> ProfileSymbolListFile(
"prof-sym-list", cl::init(""), cl::sub(MergeSubcommand),
cl::desc("Path to file containing the list of function symbols "
"used to populate profile symbol list"));
-cl::opt<SampleProfileLayout> ProfileLayout(
+static cl::opt<SampleProfileLayout> ProfileLayout(
"convert-sample-profile-layout",
cl::desc("Convert the generated profile to a profile with a new layout"),
cl::sub(MergeSubcommand), cl::init(SPL_None),
@@ -310,13 +310,13 @@ cl::opt<SampleProfileLayout> ProfileLayout(
clEnumValN(SPL_Flat, "flat",
"Profile with nested inlinee flatten out")));
-cl::opt<bool> DropProfileSymbolList(
+static cl::opt<bool> DropProfileSymbolList(
"drop-profile-symbol-list", cl::init(false), cl::Hidden,
cl::sub(MergeSubcommand),
cl::desc("Drop the profile symbol list when merging AutoFDO profiles "
"(only meaningful for -sample)"));
-cl::opt<bool> KeepVTableSymbols(
+static cl::opt<bool> KeepVTableSymbols(
"keep-vtable-symbols", cl::init(false), cl::Hidden,
cl::sub(MergeSubcommand),
cl::desc("If true, keep the vtable symbols in indexed profiles"));
@@ -325,19 +325,19 @@ cl::opt<bool> KeepVTableSymbols(
// some forward compatibility.
// TODO: Consider enabling this with future version changes as well, to ease
// deployment of newer versions of llvm-profdata.
-cl::opt<bool> DoWritePrevVersion(
+static cl::opt<bool> DoWritePrevVersion(
"write-prev-version", cl::init(false), cl::Hidden,
cl::desc("Write the previous version of indexed format, to enable "
"some forward compatibility."));
-cl::opt<memprof::IndexedVersion> MemProfVersionRequested(
+static cl::opt<memprof::IndexedVersion> MemProfVersionRequested(
"memprof-version", cl::Hidden, cl::sub(MergeSubcommand),
cl::desc("Specify the version of the memprof format to use"),
cl::init(memprof::Version3),
cl::values(clEnumValN(memprof::Version2, "2", "version 2"),
clEnumValN(memprof::Version3, "3", "version 3")));
-cl::opt<bool> MemProfFullSchema(
+static cl::opt<bool> MemProfFullSchema(
"memprof-full-schema", cl::Hidden, cl::sub(MergeSubcommand),
cl::desc("Use the full schema for serialization"), cl::init(false));
@@ -351,26 +351,26 @@ static cl::opt<unsigned> MemprofGenerateRandomHotnessSeed(
cl::desc("Random hotness seed to use (0 to generate new seed)"));
// Options specific to overlap subcommand.
-cl::opt<std::string> BaseFilename(cl::Positional, cl::Required,
- cl::desc("<base profile file>"),
- cl::sub(OverlapSubcommand));
-cl::opt<std::string> TestFilename(cl::Positional, cl::Required,
- cl::desc("<test profile file>"),
- cl::sub(OverlapSubcommand));
-
-cl::opt<unsigned long long> SimilarityCutoff(
+static cl::opt<std::string> BaseFilename(cl::Positional, cl::Required,
+ cl::desc("<base profile file>"),
+ cl::sub(OverlapSubcommand));
+static cl::opt<std::string> TestFilename(cl::Positional, cl::Required,
+ cl::desc("<test profile file>"),
+ cl::sub(OverlapSubcommand));
+
+static cl::opt<unsigned long long> SimilarityCutoff(
"similarity-cutoff", cl::init(0),
cl::desc("For sample profiles, list function names (with calling context "
"for csspgo) for overlapped functions "
"with similarities below the cutoff (percentage times 10000)."),
cl::sub(OverlapSubcommand));
-cl::opt<bool> IsCS(
+static cl::opt<bool> IsCS(
"cs", cl::init(false),
cl::desc("For context sensitive PGO counts. Does not work with CSSPGO."),
cl::sub(OverlapSubcommand));
-cl::opt<unsigned long long> OverlapValueCutoff(
+static cl::opt<unsigned long long> OverlapValueCutoff(
"value-cutoff", cl::init(-1),
cl::desc(
"Function level overlap information for every function (with calling "
@@ -379,10 +379,11 @@ cl::opt<unsigned long long> OverlapValueCutoff(
cl::sub(OverlapSubcommand));
// Options specific to show subcommand.
-cl::opt<bool> ShowCounts("counts", cl::init(false),
- cl::desc("Show counter values for shown functions"),
- cl::sub(ShowSubcommand));
-cl::opt<ShowFormat>
+static cl::opt<bool>
+ ShowCounts("counts", cl::init(false),
+ cl::desc("Show counter values for shown functions"),
+ cl::sub(ShowSubcommand));
+static cl::opt<ShowFormat>
SFormat("show-format", cl::init(ShowFormat::Text),
cl::desc("Emit output in the selected format if supported"),
cl::sub(ShowSubcommand),
@@ -391,94 +392,97 @@ cl::opt<ShowFormat>
clEnumValN(ShowFormat::Json, "json", "emit JSON"),
clEnumValN(ShowFormat::Yaml, "yaml", "emit YAML")));
// TODO: Consider replacing this with `--show-format=text-encoding`.
-cl::opt<bool>
+static cl::opt<bool>
TextFormat("text", cl::init(false),
cl::desc("Show instr profile data in text dump format"),
cl::sub(ShowSubcommand));
-cl::opt<bool>
+static cl::opt<bool>
JsonFormat("json",
cl::desc("Show sample profile data in the JSON format "
"(deprecated, please use --show-format=json)"),
cl::sub(ShowSubcommand));
-cl::opt<bool> ShowIndirectCallTargets(
+static cl::opt<bool> ShowIndirectCallTargets(
"ic-targets", cl::init(false),
cl::desc("Show indirect call site target values for shown functions"),
cl::sub(ShowSubcommand));
-cl::opt<bool> ShowVTables("show-vtables", cl::init(false),
- cl::desc("Show vtable names for shown functions"),
- cl::sub(ShowSubcommand));
-cl::opt<bool> ShowMemOPSizes(
+static cl::opt<bool>
+ ShowVTables("show-vtables", cl::init(false),
+ cl::desc("Show vtable names for shown functions"),
+ cl::sub(ShowSubcommand));
+static cl::opt<bool> ShowMemOPSizes(
"memop-sizes", cl::init(false),
cl::desc("Show the profiled sizes of the memory intrinsic calls "
"for shown functions"),
cl::sub(ShowSubcommand));
-cl::opt<bool> ShowDetailedSummary("detailed-summary", cl::init(false),
- cl::desc("Show detailed profile summary"),
- cl::sub(ShowSubcommand));
+static cl::opt<bool>
+ ShowDetailedSummary("detailed-summary", cl::init(false),
+ cl::desc("Show detailed profile summary"),
+ cl::sub(ShowSubcommand));
cl::list<uint32_t> DetailedSummaryCutoffs(
cl::CommaSeparated, "detailed-summary-cutoffs",
cl::desc(
"Cutoff percentages (times 10000) for generating detailed summary"),
cl::value_desc("800000,901000,999999"), cl::sub(ShowSubcommand));
-cl::opt<bool>
+static cl::opt<bool>
ShowHotFuncList("hot-func-list", cl::init(false),
cl::desc("Show profile summary of a list of hot functions"),
cl::sub(ShowSubcommand));
-cl::opt<bool> ShowAllFunctions("all-functions", cl::init(false),
- cl::desc("Details for each and every function"),
- cl::sub(ShowSubcommand));
-cl::opt<bool> ShowCS("showcs", cl::init(false),
- cl::desc("Show context sensitive counts"),
+static cl::opt<bool>
+ ShowAllFunctions("all-functions", cl::init(false),
+ cl::desc("Details for each and every function"),
cl::sub(ShowSubcommand));
-cl::opt<ProfileKinds> ShowProfileKind(
+static cl::opt<bool> ShowCS("showcs", cl::init(false),
+ cl::desc("Show context sensitive counts"),
+ cl::sub(ShowSubcommand));
+static cl::opt<ProfileKinds> ShowProfileKind(
cl::desc("Profile kind supported by show:"), cl::sub(ShowSubcommand),
cl::init(instr),
cl::values(clEnumVal(instr, "Instrumentation profile (default)"),
clEnumVal(sample, "Sample profile"),
clEnumVal(memory, "MemProf memory access profile")));
-cl::opt<uint32_t> TopNFunctions(
+static cl::opt<uint32_t> TopNFunctions(
"topn", cl::init(0),
cl::desc("Show the list of functions with the largest internal counts"),
cl::sub(ShowSubcommand));
-cl::opt<uint32_t> ShowValueCutoff(
+static cl::opt<uint32_t> ShowValueCutoff(
"value-cutoff", cl::init(0),
cl::desc("Set the count value cutoff. Functions with the maximum count "
"less than this value will not be printed out. (Default is 0)"),
cl::sub(ShowSubcommand));
-cl::opt<bool> OnlyListBelow(
+static cl::opt<bool> OnlyListBelow(
"list-below-cutoff", cl::init(false),
cl::desc("Only output names of functions whose max count values are "
"below the cutoff value"),
cl::sub(ShowSubcommand));
-cl::opt<bool> ShowProfileSymbolList(
+static cl::opt<bool> ShowProfileSymbolList(
"show-prof-sym-list", cl::init(false),
cl::desc("Show profile symbol list if it exists in the profile. "),
cl::sub(ShowSubcommand));
-cl::opt<bool> ShowSectionInfoOnly(
+static cl::opt<bool> ShowSectionInfoOnly(
"show-sec-info-only", cl::init(false),
cl::desc("Show the information of each section in the sample profile. "
"The flag is only usable when the sample profile is in "
"extbinary format"),
cl::sub(ShowSubcommand));
-cl::opt<bool> ShowBinaryIds("binary-ids", cl::init(false),
- cl::desc("Show binary ids in the profile. "),
- cl::sub(ShowSubcommand));
-cl::opt<bool> ShowTemporalProfTraces(
+static cl::opt<bool> ShowBinaryIds("binary-ids", cl::init(false),
+ cl::desc("Show binary ids in the profile. "),
+ cl::sub(ShowSubcommand));
+static cl::opt<bool> ShowTemporalProfTraces(
"temporal-profile-traces",
cl::desc("Show temporal profile traces in the profile."),
cl::sub(ShowSubcommand));
-cl::opt<bool>
+static cl::opt<bool>
ShowCovered("covered", cl::init(false),
cl::desc("Show only the functions that have been executed."),
cl::sub(ShowSubcommand));
-cl::opt<bool> ShowProfileVersion("profile-version", cl::init(false),
- cl::desc("Show profile version. "),
- cl::sub(ShowSubcommand));
+static cl::opt<bool> ShowProfileVersion("profile-version", cl::init(false),
+ cl::desc("Show profile version. "),
+ cl::sub(ShowSubcommand));
// Options specific to order subcommand.
-cl::opt<unsigned>
+static cl::opt<unsigned>
NumTestTraces("num-test-traces", cl::init(0),
cl::desc("Keep aside the last <num-test-traces> traces in "
"the profile when computing the function order and "
diff --git a/llvm/tools/llvm-undname/llvm-undname.cpp b/llvm/tools/llvm-undname/llvm-undname.cpp
index d2d76def7ae0f64..9a24eff2ae641bc 100644
--- a/llvm/tools/llvm-undname/llvm-undname.cpp
+++ b/llvm/tools/llvm-undname/llvm-undname.cpp
@@ -28,33 +28,36 @@
using namespace llvm;
-cl::OptionCategory UndNameCategory("UndName Options");
+static cl::OptionCategory UndNameCategory("UndName Options");
-cl::opt<bool> DumpBackReferences("backrefs", cl::Optional,
- cl::desc("dump backreferences"), cl::Hidden,
- 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::cat(UndNameCategory));
-cl::opt<bool> NoCallingConvention("no-calling-convention", cl::Optional,
- cl::desc("skip calling convention"),
+static cl::opt<bool> DumpBackReferences("backrefs", cl::Optional,
+ cl::desc("dump backreferences"),
+ cl::Hidden, cl::init(false),
+ cl::cat(UndNameCategory));
+static cl::opt<bool> NoAccessSpecifier("no-access-specifier", cl::Optional,
+ cl::desc("skip access specifiers"),
+ cl::Hidden, cl::init(false),
+ cl::cat(UndNameCategory));
+static cl::opt<bool> NoCallingConvention("no-calling-convention", cl::Optional,
+ cl::desc("skip calling convention"),
+ cl::Hidden, cl::init(false),
+ cl::cat(UndNameCategory));
+static cl::opt<bool> NoReturnType("no-return-type", cl::Optional,
+ cl::desc("skip return types"), cl::Hidden,
+ cl::init(false), cl::cat(UndNameCategory));
+static cl::opt<bool> NoMemberType("no-member-type", cl::Optional,
+ cl::desc("skip member types"), cl::Hidden,
+ cl::init(false), cl::cat(UndNameCategory));
+static cl::opt<bool> NoVariableType("no-variable-type", cl::Optional,
+ cl::desc("skip variable types"), cl::Hidden,
+ cl::init(false), cl::cat(UndNameCategory));
+static cl::opt<std::string> RawFile("raw-file", cl::Optional,
+ cl::desc("for fuzzer data"), cl::Hidden,
+ cl::cat(UndNameCategory));
+static cl::opt<bool> WarnTrailing("warn-trailing", cl::Optional,
+ cl::desc("warn on trailing characters"),
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::cat(UndNameCategory));
-cl::opt<bool> NoMemberType("no-member-type", cl::Optional,
- cl::desc("skip member types"), cl::Hidden,
- cl::init(false), cl::cat(UndNameCategory));
-cl::opt<bool> NoVariableType("no-variable-type", cl::Optional,
- cl::desc("skip variable types"), cl::Hidden,
- cl::init(false), cl::cat(UndNameCategory));
-cl::opt<std::string> RawFile("raw-file", cl::Optional,
- 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::cat(UndNameCategory));
cl::list<std::string> Symbols(cl::Positional, cl::desc("<input symbols>"),
cl::cat(UndNameCategory));
diff --git a/llvm/tools/reduce-chunk-list/reduce-chunk-list.cpp b/llvm/tools/reduce-chunk-list/reduce-chunk-list.cpp
index a819af6e5f1a056..dc99859b516dbf7 100644
--- a/llvm/tools/reduce-chunk-list/reduce-chunk-list.cpp
+++ b/llvm/tools/reduce-chunk-list/reduce-chunk-list.cpp
@@ -18,11 +18,11 @@
using namespace llvm;
-cl::opt<std::string> ReproductionCmd(cl::Positional, cl::Required);
+static cl::opt<std::string> ReproductionCmd(cl::Positional, cl::Required);
-cl::opt<std::string> StartChunks(cl::Positional, cl::Required);
+static cl::opt<std::string> StartChunks(cl::Positional, cl::Required);
-cl::opt<bool> Pessimist("pessimist", cl::init(false));
+static cl::opt<bool> Pessimist("pessimist", cl::init(false));
using Chunk = DebugCounter::Chunk;
diff --git a/llvm/tools/yaml2obj/yaml2obj.cpp b/llvm/tools/yaml2obj/yaml2obj.cpp
index 4a060e1aad427f4..022e9564001bf50 100644
--- a/llvm/tools/yaml2obj/yaml2obj.cpp
+++ b/llvm/tools/yaml2obj/yaml2obj.cpp
@@ -30,10 +30,10 @@
using namespace llvm;
namespace {
-cl::OptionCategory Cat("yaml2obj Options");
+static cl::OptionCategory Cat("yaml2obj Options");
-cl::opt<std::string> Input(cl::Positional, cl::desc("<input file>"),
- cl::init("-"), cl::cat(Cat));
+static cl::opt<std::string> Input(cl::Positional, cl::desc("<input file>"),
+ cl::init("-"), cl::cat(Cat));
cl::list<std::string>
D("D", cl::Prefix,
@@ -41,10 +41,11 @@ cl::list<std::string>
"definition. The syntax is <macro>=<definition>"),
cl::cat(Cat));
-cl::opt<bool> PreprocessOnly("E", cl::desc("Just print the preprocessed file"),
- cl::cat(Cat));
+static cl::opt<bool>
+ PreprocessOnly("E", cl::desc("Just print the preprocessed file"),
+ cl::cat(Cat));
-cl::opt<unsigned>
+static cl::opt<unsigned>
DocNum("docnum", cl::init(1),
cl::desc("Read specified document from input (default = 1)"),
cl::cat(Cat));
@@ -55,9 +56,10 @@ static cl::opt<uint64_t> MaxSize(
"Sets the maximum allowed output size (0 means no limit) [ELF only]"),
cl::cat(Cat));
-cl::opt<std::string> OutputFilename("o", cl::desc("Output filename"),
- cl::value_desc("filename"), cl::init("-"),
- cl::Prefix, cl::cat(Cat));
+static cl::opt<std::string> OutputFilename("o", cl::desc("Output filename"),
+ cl::value_desc("filename"),
+ cl::init("-"), cl::Prefix,
+ cl::cat(Cat));
} // namespace
static std::optional<std::string> preprocess(StringRef Buf,
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp
index 3df4107ebf43998..3817cb6aa4de1fd 100644
--- a/llvm/unittests/Support/CommandLineTest.cpp
+++ b/llvm/unittests/Support/CommandLineTest.cpp
@@ -88,8 +88,7 @@ class StackSubCommand : public cl::SubCommand {
~StackSubCommand() { unregisterSubCommand(); }
};
-
-cl::OptionCategory TestCategory("Test Options", "Description");
+static cl::OptionCategory TestCategory("Test Options", "Description");
TEST(CommandLineTest, ModifyExisitingOption) {
StackOption<int> TestOption("test-option", cl::desc("old description"));
@@ -169,7 +168,8 @@ TEST(CommandLineTest, UseMultipleCategories) {
}))
<< "Failed to assign General Category.";
- cl::OptionCategory AnotherCategory("Additional test Options", "Description");
+ static cl::OptionCategory AnotherCategory("Additional test Options",
+ "Description");
StackOption<int> TestOption("test-option", cl::cat(TestCategory),
cl::cat(AnotherCategory));
ASSERT_EQ(TestOption.Categories.end(),
@@ -425,7 +425,7 @@ TEST(CommandLineTest, HideUnrelatedOptions) {
<< "Hid default option that should be visable.";
}
-cl::OptionCategory TestCategory2("Test Options set 2", "Description");
+static cl::OptionCategory TestCategory2("Test Options set 2", "Description");
TEST(CommandLineTest, HideUnrelatedOptionsMulti) {
StackOption<int> TestOption1("multi-hide-option-1");
@@ -2296,8 +2296,8 @@ TEST(CommandLineTest, SubCommandGroups) {
TEST(CommandLineTest, HelpWithEmptyCategory) {
cl::ResetCommandLineParser();
- cl::OptionCategory Category1("First Category");
- cl::OptionCategory Category2("Second Category");
+ static cl::OptionCategory Category1("First Category");
+ static cl::OptionCategory Category2("Second Category");
StackOption<int> Opt1("opt1", cl::cat(Category1));
StackOption<int> Opt2("opt2", cl::cat(Category2));
cl::HideUnrelatedOptions(Category2);
diff --git a/llvm/utils/KillTheDoctor/KillTheDoctor.cpp b/llvm/utils/KillTheDoctor/KillTheDoctor.cpp
index 4f642f8886df582..59cd4b9a4360bd9 100644
--- a/llvm/utils/KillTheDoctor/KillTheDoctor.cpp
+++ b/llvm/utils/KillTheDoctor/KillTheDoctor.cpp
@@ -61,52 +61,45 @@ using namespace llvm;
#undef max
namespace {
- cl::opt<std::string> ProgramToRun(cl::Positional,
- cl::desc("<program to run>"));
- cl::list<std::string> Argv(cl::ConsumeAfter,
- cl::desc("<program arguments>..."));
- cl::opt<bool> TraceExecution("x",
- cl::desc("Print detailed output about what is being run to stderr."));
- cl::opt<unsigned> Timeout("t", cl::init(0),
- cl::desc("Set maximum runtime in seconds. Defaults to infinite."));
- cl::opt<bool> NoUser32("no-user32",
- cl::desc("Terminate process if it loads user32.dll."));
+static cl::opt<std::string> ProgramToRun(cl::Positional,
+ cl::desc("<program to run>"));
+cl::list<std::string> Argv(cl::ConsumeAfter,
+ cl::desc("<program arguments>..."));
+static cl::opt<bool> TraceExecution(
+ "x", cl::desc("Print detailed output about what is being run to stderr."));
+static cl::opt<unsigned>
+ Timeout("t", cl::init(0),
+ cl::desc("Set maximum runtime in seconds. Defaults to infinite."));
+static cl::opt<bool>
+ NoUser32("no-user32",
+ cl::desc("Terminate process if it loads user32.dll."));
- StringRef ToolName;
+StringRef ToolName;
- template <typename HandleType>
- class ScopedHandle {
- typedef typename HandleType::handle_type handle_type;
+template <typename HandleType> class ScopedHandle {
+ typedef typename HandleType::handle_type handle_type;
- handle_type Handle;
+ handle_type Handle;
- public:
- ScopedHandle()
- : Handle(HandleType::GetInvalidHandle()) {}
+public:
+ ScopedHandle() : Handle(HandleType::GetInvalidHandle()) {}
- explicit ScopedHandle(handle_type handle)
- : Handle(handle) {}
+ explicit ScopedHandle(handle_type handle) : Handle(handle) {}
- ~ScopedHandle() {
- HandleType::Destruct(Handle);
- }
+ ~ScopedHandle() { HandleType::Destruct(Handle); }
- ScopedHandle& operator=(handle_type handle) {
- // Cleanup current handle.
- if (!HandleType::isValid(Handle))
- HandleType::Destruct(Handle);
- Handle = handle;
- return *this;
- }
+ ScopedHandle &operator=(handle_type handle) {
+ // Cleanup current handle.
+ if (!HandleType::isValid(Handle))
+ HandleType::Destruct(Handle);
+ Handle = handle;
+ return *this;
+ }
- operator bool() const {
- return HandleType::isValid(Handle);
- }
+ operator bool() const { return HandleType::isValid(Handle); }
- operator handle_type() {
- return Handle;
- }
- };
+ operator handle_type() { return Handle; }
+};
// This implements the most common handle in the Windows API.
struct CommonHandle {
diff --git a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
index f056306b2f8571d..57997a6b0e4e050 100644
--- a/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
+++ b/llvm/utils/TableGen/DAGISelMatcherEmitter.cpp
@@ -34,7 +34,7 @@ enum {
HistOpcWidth = 40,
};
-cl::OptionCategory DAGISelCat("Options for -gen-dag-isel");
+static cl::OptionCategory DAGISelCat("Options for -gen-dag-isel");
// To reduce generated source code size.
static cl::opt<bool> OmitComments("omit-comments",
diff --git a/llvm/utils/TableGen/DecoderEmitter.cpp b/llvm/utils/TableGen/DecoderEmitter.cpp
index b847031fdc00ae1..e432ed46b609f7e 100644
--- a/llvm/utils/TableGen/DecoderEmitter.cpp
+++ b/llvm/utils/TableGen/DecoderEmitter.cpp
@@ -60,7 +60,7 @@ enum SuppressLevel {
SUPPRESSION_LEVEL2
};
-cl::opt<SuppressLevel> DecoderEmitterSuppressDuplicates(
+static cl::opt<SuppressLevel> DecoderEmitterSuppressDuplicates(
"suppress-per-hwmode-duplicates",
cl::desc("Suppress duplication of instrs into per-HwMode decoder tables"),
cl::values(
diff --git a/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp b/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp
index 770494405810ddc..516140da2362827 100644
--- a/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp
@@ -61,22 +61,22 @@ using namespace llvm::gi;
#define DEBUG_TYPE "gicombiner-emitter"
namespace {
-cl::OptionCategory
+static cl::OptionCategory
GICombinerEmitterCat("Options for -gen-global-isel-combiner");
-cl::opt<bool> StopAfterParse(
+static cl::opt<bool> StopAfterParse(
"gicombiner-stop-after-parse",
cl::desc("Stop processing after parsing rules and dump state"),
cl::cat(GICombinerEmitterCat));
cl::list<std::string>
SelectedCombiners("combiners", cl::desc("Emit the specified combiners"),
cl::cat(GICombinerEmitterCat), cl::CommaSeparated);
-cl::opt<bool> DebugCXXPreds(
+static cl::opt<bool> DebugCXXPreds(
"gicombiner-debug-cxxpreds",
cl::desc("Add Contextual/Debug comments to all C++ predicates"),
cl::cat(GICombinerEmitterCat));
-cl::opt<bool> DebugTypeInfer("gicombiner-debug-typeinfer",
- cl::desc("Print type inference debug logs"),
- cl::cat(GICombinerEmitterCat));
+static cl::opt<bool> DebugTypeInfer("gicombiner-debug-typeinfer",
+ cl::desc("Print type inference debug logs"),
+ cl::cat(GICombinerEmitterCat));
constexpr StringLiteral CXXCustomActionPrefix = "GICXXCustomAction_";
constexpr StringLiteral CXXPredPrefix = "GICXXPred_MI_Predicate_";
diff --git a/llvm/utils/TableGen/GlobalISelEmitter.cpp b/llvm/utils/TableGen/GlobalISelEmitter.cpp
index 2969dd9156ccbf8..ccc4c00fca0472f 100644
--- a/llvm/utils/TableGen/GlobalISelEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelEmitter.cpp
@@ -63,7 +63,7 @@ STATISTIC(NumPatternImportsSkipped, "Number of SelectionDAG imports skipped");
STATISTIC(NumPatternsTested,
"Number of patterns executed according to coverage information");
-cl::OptionCategory GlobalISelEmitterCat("Options for -gen-global-isel");
+static cl::OptionCategory GlobalISelEmitterCat("Options for -gen-global-isel");
static cl::opt<bool> WarnOnSkippedPatterns(
"warn-on-skipped-patterns",
diff --git a/llvm/utils/TableGen/RegisterInfoEmitter.cpp b/llvm/utils/TableGen/RegisterInfoEmitter.cpp
index 01e83f4d9d41d44..963ce3cb057e33d 100644
--- a/llvm/utils/TableGen/RegisterInfoEmitter.cpp
+++ b/llvm/utils/TableGen/RegisterInfoEmitter.cpp
@@ -47,7 +47,7 @@
using namespace llvm;
-cl::OptionCategory RegisterInfoCat("Options for -gen-register-info");
+static cl::OptionCategory RegisterInfoCat("Options for -gen-register-info");
static cl::opt<bool>
RegisterInfoDebug("register-info-debug", cl::init(false),
diff --git a/llvm/utils/fpcmp/fpcmp.cpp b/llvm/utils/fpcmp/fpcmp.cpp
index 52bddeedc759706..ee4e57316817c90 100644
--- a/llvm/utils/fpcmp/fpcmp.cpp
+++ b/llvm/utils/fpcmp/fpcmp.cpp
@@ -17,15 +17,15 @@
using namespace llvm;
namespace {
- cl::opt<std::string>
- File1(cl::Positional, cl::desc("<input file #1>"), cl::Required);
- cl::opt<std::string>
- File2(cl::Positional, cl::desc("<input file #2>"), cl::Required);
+static cl::opt<std::string> File1(cl::Positional, cl::desc("<input file #1>"),
+ cl::Required);
+static cl::opt<std::string> File2(cl::Positional, cl::desc("<input file #2>"),
+ cl::Required);
- cl::opt<double>
- RelTolerance("r", cl::desc("Relative error tolerated"), cl::init(0));
- cl::opt<double>
- AbsTolerance("a", cl::desc("Absolute error tolerated"), cl::init(0));
+static cl::opt<double> RelTolerance("r", cl::desc("Relative error tolerated"),
+ cl::init(0));
+static cl::opt<double> AbsTolerance("a", cl::desc("Absolute error tolerated"),
+ cl::init(0));
}
int main(int argc, char **argv) {
diff --git a/llvm/utils/yaml-bench/YAMLBench.cpp b/llvm/utils/yaml-bench/YAMLBench.cpp
index 4dc6caeb6fdbfc0..81304fe0ee4a0c7 100644
--- a/llvm/utils/yaml-bench/YAMLBench.cpp
+++ b/llvm/utils/yaml-bench/YAMLBench.cpp
@@ -52,7 +52,7 @@ static cl::opt<unsigned>
"Do not use more megabytes of memory"),
cl::init(1000));
-cl::opt<cl::boolOrDefault>
+static cl::opt<cl::boolOrDefault>
UseColor("use-color", cl::desc("Emit colored output (default=autodetect)"),
cl::init(cl::BOU_UNSET));
diff --git a/mlir/lib/Tools/mlir-lsp-server/MlirLspServerMain.cpp b/mlir/lib/Tools/mlir-lsp-server/MlirLspServerMain.cpp
index 259bd2613a6ccdd..05dc392c60eab5b 100644
--- a/mlir/lib/Tools/mlir-lsp-server/MlirLspServerMain.cpp
+++ b/mlir/lib/Tools/mlir-lsp-server/MlirLspServerMain.cpp
@@ -20,7 +20,7 @@ using namespace mlir::lsp;
LogicalResult mlir::MlirLspServerMain(int argc, char **argv,
DialectRegistry ®istry) {
- llvm::cl::opt<JSONStreamStyle> inputStyle{
+ static llvm::cl::opt<JSONStreamStyle> inputStyle{
"input-style",
llvm::cl::desc("Input JSON stream encoding"),
llvm::cl::values(clEnumValN(JSONStreamStyle::Standard, "standard",
@@ -31,14 +31,14 @@ LogicalResult mlir::MlirLspServerMain(int argc, char **argv,
llvm::cl::init(JSONStreamStyle::Standard),
llvm::cl::Hidden,
};
- llvm::cl::opt<bool> litTest{
+ static llvm::cl::opt<bool> litTest{
"lit-test",
llvm::cl::desc(
"Abbreviation for -input-style=delimited -pretty -log=verbose. "
"Intended to simplify lit tests"),
llvm::cl::init(false),
};
- llvm::cl::opt<Logger::Level> logLevel{
+ static llvm::cl::opt<Logger::Level> logLevel{
"log",
llvm::cl::desc("Verbosity of log messages written to stderr"),
llvm::cl::values(
@@ -48,7 +48,7 @@ LogicalResult mlir::MlirLspServerMain(int argc, char **argv,
clEnumValN(Logger::Level::Debug, "verbose", "Low level details")),
llvm::cl::init(Logger::Level::Info),
};
- llvm::cl::opt<bool> prettyPrint{
+ static llvm::cl::opt<bool> prettyPrint{
"pretty",
llvm::cl::desc("Pretty-print JSON output"),
llvm::cl::init(false),
diff --git a/mlir/lib/Tools/mlir-pdll-lsp-server/MlirPdllLspServerMain.cpp b/mlir/lib/Tools/mlir-pdll-lsp-server/MlirPdllLspServerMain.cpp
index 287a131ecd17d44..da16df3cbeccfba 100644
--- a/mlir/lib/Tools/mlir-pdll-lsp-server/MlirPdllLspServerMain.cpp
+++ b/mlir/lib/Tools/mlir-pdll-lsp-server/MlirPdllLspServerMain.cpp
@@ -18,7 +18,7 @@ using namespace mlir;
using namespace mlir::lsp;
LogicalResult mlir::MlirPdllLspServerMain(int argc, char **argv) {
- llvm::cl::opt<JSONStreamStyle> inputStyle{
+ static llvm::cl::opt<JSONStreamStyle> inputStyle{
"input-style",
llvm::cl::desc("Input JSON stream encoding"),
llvm::cl::values(clEnumValN(JSONStreamStyle::Standard, "standard",
@@ -29,14 +29,14 @@ LogicalResult mlir::MlirPdllLspServerMain(int argc, char **argv) {
llvm::cl::init(JSONStreamStyle::Standard),
llvm::cl::Hidden,
};
- llvm::cl::opt<bool> litTest{
+ static llvm::cl::opt<bool> litTest{
"lit-test",
llvm::cl::desc(
"Abbreviation for -input-style=delimited -pretty -log=verbose. "
"Intended to simplify lit tests"),
llvm::cl::init(false),
};
- llvm::cl::opt<Logger::Level> logLevel{
+ static llvm::cl::opt<Logger::Level> logLevel{
"log",
llvm::cl::desc("Verbosity of log messages written to stderr"),
llvm::cl::values(
@@ -46,7 +46,7 @@ LogicalResult mlir::MlirPdllLspServerMain(int argc, char **argv) {
clEnumValN(Logger::Level::Debug, "verbose", "Low level details")),
llvm::cl::init(Logger::Level::Info),
};
- llvm::cl::opt<bool> prettyPrint{
+ static llvm::cl::opt<bool> prettyPrint{
"pretty",
llvm::cl::desc("Pretty-print JSON output"),
llvm::cl::init(false),
diff --git a/mlir/lib/Tools/mlir-tblgen/MlirTblgenMain.cpp b/mlir/lib/Tools/mlir-tblgen/MlirTblgenMain.cpp
index 20ad4292a548bfd..beb162ff68a7870 100644
--- a/mlir/lib/Tools/mlir-tblgen/MlirTblgenMain.cpp
+++ b/mlir/lib/Tools/mlir-tblgen/MlirTblgenMain.cpp
@@ -141,7 +141,7 @@ int mlir::MlirTblgenMain(int argc, char **argv) {
llvm::InitLLVM y(argc, argv);
- llvm::cl::opt<DeprecatedAction, true> actionOnDeprecated(
+ static llvm::cl::opt<DeprecatedAction, true> actionOnDeprecated(
"on-deprecated", llvm::cl::desc("Action to perform on deprecated def"),
llvm::cl::values(
clEnumValN(DeprecatedAction::None, "none", "No action"),
@@ -149,8 +149,9 @@ int mlir::MlirTblgenMain(int argc, char **argv) {
clEnumValN(DeprecatedAction::Error, "error", "Error on use")),
cl::location(actionOnDeprecatedValue), llvm::cl::init(Warn));
- llvm::cl::opt<const mlir::GenInfo *, true, mlir::GenNameParser> generator(
- "", llvm::cl::desc("Generator to run"), cl::location(::generator));
+ static llvm::cl::opt<const mlir::GenInfo *, true, mlir::GenNameParser>
+ generator("", llvm::cl::desc("Generator to run"),
+ cl::location(::generator));
cl::ParseCommandLineOptions(argc, argv);
diff --git a/mlir/lib/Tools/tblgen-lsp-server/TableGenLspServerMain.cpp b/mlir/lib/Tools/tblgen-lsp-server/TableGenLspServerMain.cpp
index 21af78c9a506c2e..accb54ada7daf7d 100644
--- a/mlir/lib/Tools/tblgen-lsp-server/TableGenLspServerMain.cpp
+++ b/mlir/lib/Tools/tblgen-lsp-server/TableGenLspServerMain.cpp
@@ -18,7 +18,7 @@ using namespace mlir;
using namespace mlir::lsp;
LogicalResult mlir::TableGenLspServerMain(int argc, char **argv) {
- llvm::cl::opt<JSONStreamStyle> inputStyle{
+ static llvm::cl::opt<JSONStreamStyle> inputStyle{
"input-style",
llvm::cl::desc("Input JSON stream encoding"),
llvm::cl::values(clEnumValN(JSONStreamStyle::Standard, "standard",
@@ -29,14 +29,14 @@ LogicalResult mlir::TableGenLspServerMain(int argc, char **argv) {
llvm::cl::init(JSONStreamStyle::Standard),
llvm::cl::Hidden,
};
- llvm::cl::opt<bool> litTest{
+ static llvm::cl::opt<bool> litTest{
"lit-test",
llvm::cl::desc(
"Abbreviation for -input-style=delimited -pretty -log=verbose. "
"Intended to simplify lit tests"),
llvm::cl::init(false),
};
- llvm::cl::opt<Logger::Level> logLevel{
+ static llvm::cl::opt<Logger::Level> logLevel{
"log",
llvm::cl::desc("Verbosity of log messages written to stderr"),
llvm::cl::values(
@@ -46,7 +46,7 @@ LogicalResult mlir::TableGenLspServerMain(int argc, char **argv) {
clEnumValN(Logger::Level::Debug, "verbose", "Low level details")),
llvm::cl::init(Logger::Level::Info),
};
- llvm::cl::opt<bool> prettyPrint{
+ static llvm::cl::opt<bool> prettyPrint{
"pretty",
llvm::cl::desc("Pretty-print JSON output"),
llvm::cl::init(false),
diff --git a/mlir/tools/mlir-pdll/mlir-pdll.cpp b/mlir/tools/mlir-pdll/mlir-pdll.cpp
index 88a5f3639c9625e..3ab2addd314ae22 100644
--- a/mlir/tools/mlir-pdll/mlir-pdll.cpp
+++ b/mlir/tools/mlir-pdll/mlir-pdll.cpp
@@ -119,11 +119,11 @@ int main(int argc, char **argv) {
// options as static variables.. some of which overlap with our options.
llvm::cl::ResetCommandLineParser();
- llvm::cl::opt<std::string> inputFilename(
+ static llvm::cl::opt<std::string> inputFilename(
llvm::cl::Positional, llvm::cl::desc("<input file>"), llvm::cl::init("-"),
llvm::cl::value_desc("filename"));
- llvm::cl::opt<std::string> outputFilename(
+ static llvm::cl::opt<std::string> outputFilename(
"o", llvm::cl::desc("Output filename"), llvm::cl::value_desc("filename"),
llvm::cl::init("-"));
@@ -131,12 +131,12 @@ int main(int argc, char **argv) {
"I", llvm::cl::desc("Directory of include files"),
llvm::cl::value_desc("directory"), llvm::cl::Prefix);
- llvm::cl::opt<bool> dumpODS(
+ static llvm::cl::opt<bool> dumpODS(
"dump-ods",
llvm::cl::desc(
"Print out the parsed ODS information from the input file"),
llvm::cl::init(false));
- llvm::cl::opt<std::string> inputSplitMarker{
+ static llvm::cl::opt<std::string> inputSplitMarker{
"split-input-file", llvm::cl::ValueOptional,
llvm::cl::callback([&](const std::string &str) {
// Implicit value: use default marker if flag was used without value.
@@ -146,11 +146,11 @@ int main(int argc, char **argv) {
llvm::cl::desc("Split the input file into chunks using the given or "
"default marker and process each chunk independently"),
llvm::cl::init("")};
- llvm::cl::opt<std::string> outputSplitMarker(
+ static llvm::cl::opt<std::string> outputSplitMarker(
"output-split-marker",
llvm::cl::desc("Split marker to use for merging the ouput"),
llvm::cl::init(kDefaultSplitMarker));
- llvm::cl::opt<enum OutputType> outputType(
+ static llvm::cl::opt<enum OutputType> outputType(
"x", llvm::cl::init(OutputType::AST),
llvm::cl::desc("The type of output desired"),
llvm::cl::values(clEnumValN(OutputType::AST, "ast",
@@ -160,10 +160,10 @@ int main(int argc, char **argv) {
clEnumValN(OutputType::CPP, "cpp",
"generate a C++ source file containing the "
"patterns for the input file")));
- llvm::cl::opt<std::string> dependencyFilename(
+ static llvm::cl::opt<std::string> dependencyFilename(
"d", llvm::cl::desc("Dependency filename"),
llvm::cl::value_desc("filename"), llvm::cl::init(""));
- llvm::cl::opt<bool> writeIfChanged(
+ static llvm::cl::opt<bool> writeIfChanged(
"write-if-changed",
llvm::cl::desc("Only write to the output file if it changed"));
diff --git a/mlir/tools/mlir-rewrite/mlir-rewrite.cpp b/mlir/tools/mlir-rewrite/mlir-rewrite.cpp
index bbb6bd6617a13c5..cca6f4932b4e0c8 100644
--- a/mlir/tools/mlir-rewrite/mlir-rewrite.cpp
+++ b/mlir/tools/mlir-rewrite/mlir-rewrite.cpp
@@ -356,7 +356,8 @@ int main(int argc, char **argv) {
"o", llvm::cl::desc("Output filename"), llvm::cl::value_desc("filename"),
llvm::cl::init("-"));
- llvm::cl::opt<const mlir::RewriterInfo *, false, mlir::RewriterNameParser>
+ static llvm::cl::opt<const mlir::RewriterInfo *, false,
+ mlir::RewriterNameParser>
rewriter("", llvm::cl::desc("Rewriter to run"));
std::string helpHeader = "mlir-rewrite";
diff --git a/mlir/tools/mlir-runner/mlir-runner.cpp b/mlir/tools/mlir-runner/mlir-runner.cpp
index 7e8793de03ead90..932c9f6cc9fdce4 100644
--- a/mlir/tools/mlir-runner/mlir-runner.cpp
+++ b/mlir/tools/mlir-runner/mlir-runner.cpp
@@ -32,7 +32,7 @@ using namespace mlir;
// TODO: Consider removing this linking functionality from the SPIR-V CPU Runner
// flow in favour of a more proper host/device split like other runners.
// https://github.com/llvm/llvm-project/issues/115348
-llvm::cl::opt<bool> LinkNestedModules(
+static llvm::cl::opt<bool> LinkNestedModules(
"link-nested-modules",
llvm::cl::desc("Link two nested MLIR modules into a single LLVM IR module. "
"Useful if both the host and device code can be run on the "
diff --git a/mlir/tools/mlir-src-sharder/mlir-src-sharder.cpp b/mlir/tools/mlir-src-sharder/mlir-src-sharder.cpp
index 9ec9b7215020767..55db986ee5caadd 100644
--- a/mlir/tools/mlir-src-sharder/mlir-src-sharder.cpp
+++ b/mlir/tools/mlir-src-sharder/mlir-src-sharder.cpp
@@ -44,21 +44,21 @@ int main(int argc, char **argv) {
// options as static variables.. some of which overlap with our options.
llvm::cl::ResetCommandLineParser();
- llvm::cl::opt<unsigned> opShardIndex(
+ static llvm::cl::opt<unsigned> opShardIndex(
"op-shard-index", llvm::cl::desc("The current shard index"));
- llvm::cl::opt<std::string> inputFilename(llvm::cl::Positional,
- llvm::cl::desc("<input file>"),
- llvm::cl::init("-"));
- llvm::cl::opt<std::string> outputFilename(
+ static llvm::cl::opt<std::string> inputFilename(
+ llvm::cl::Positional, llvm::cl::desc("<input file>"),
+ llvm::cl::init("-"));
+ static llvm::cl::opt<std::string> outputFilename(
"o", llvm::cl::desc("Output filename"), llvm::cl::value_desc("filename"),
llvm::cl::init("-"));
llvm::cl::list<std::string> includeDirs(
"I", llvm::cl::desc("Directory of include files"),
llvm::cl::value_desc("directory"), llvm::cl::Prefix);
- llvm::cl::opt<std::string> dependencyFilename(
+ static llvm::cl::opt<std::string> dependencyFilename(
"d", llvm::cl::desc("Dependency filename"),
llvm::cl::value_desc("filename"), llvm::cl::init(""));
- llvm::cl::opt<bool> writeIfChanged(
+ static llvm::cl::opt<bool> writeIfChanged(
"write-if-changed",
llvm::cl::desc("Only write to the output file if it changed"));
diff --git a/mlir/tools/mlir-tblgen/DialectGen.cpp b/mlir/tools/mlir-tblgen/DialectGen.cpp
index 414cad5e1dcc2e7..6cf71d2bb017414 100644
--- a/mlir/tools/mlir-tblgen/DialectGen.cpp
+++ b/mlir/tools/mlir-tblgen/DialectGen.cpp
@@ -34,7 +34,7 @@ using llvm::Record;
using llvm::RecordKeeper;
static llvm::cl::OptionCategory dialectGenCat("Options for -gen-dialect-*");
-llvm::cl::opt<std::string>
+static llvm::cl::opt<std::string>
selectedDialect("dialect", llvm::cl::desc("The dialect to gen for"),
llvm::cl::cat(dialectGenCat), llvm::cl::CommaSeparated);
diff --git a/mlir/tools/mlir-tblgen/OpDocGen.cpp b/mlir/tools/mlir-tblgen/OpDocGen.cpp
index 1c394f5680a5c9b..119be06de0df213 100644
--- a/mlir/tools/mlir-tblgen/OpDocGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDocGen.cpp
@@ -44,11 +44,11 @@ using mlir::tblgen::Operator;
//===----------------------------------------------------------------------===//
static cl::OptionCategory
docCat("Options for -gen-(attrdef|typedef|enum|op|dialect)-doc");
-cl::opt<std::string>
+static cl::opt<std::string>
stripPrefix("strip-prefix",
cl::desc("Strip prefix of the fully qualified names"),
cl::init("::mlir::"), cl::cat(docCat));
-cl::opt<bool> allowHugoSpecificFeatures(
+static cl::opt<bool> allowHugoSpecificFeatures(
"allow-hugo-specific-features",
cl::desc("Allows using features specific to Hugo"), cl::init(false),
cl::cat(docCat));
diff --git a/mlir/tools/mlir-tblgen/OpGenHelpers.cpp b/mlir/tools/mlir-tblgen/OpGenHelpers.cpp
index 44dbacf19fffd4f..d4d23d4dd68afd7 100644
--- a/mlir/tools/mlir-tblgen/OpGenHelpers.cpp
+++ b/mlir/tools/mlir-tblgen/OpGenHelpers.cpp
@@ -21,7 +21,7 @@ using namespace llvm;
using namespace mlir;
using namespace mlir::tblgen;
-cl::OptionCategory opDefGenCat("Options for op definition generators");
+static cl::OptionCategory opDefGenCat("Options for op definition generators");
static cl::opt<std::string> opIncFilter(
"op-include-regex",
diff --git a/mlir/tools/tblgen-to-irdl/OpDefinitionsGen.cpp b/mlir/tools/tblgen-to-irdl/OpDefinitionsGen.cpp
index c9f6dd35de44e96..c2ad09ffaaed5b7 100644
--- a/mlir/tools/tblgen-to-irdl/OpDefinitionsGen.cpp
+++ b/mlir/tools/tblgen-to-irdl/OpDefinitionsGen.cpp
@@ -36,7 +36,7 @@ using namespace mlir;
using tblgen::NamedTypeConstraint;
static llvm::cl::OptionCategory dialectGenCat("Options for -gen-irdl-dialect");
-llvm::cl::opt<std::string>
+static llvm::cl::opt<std::string>
selectedDialect("dialect", llvm::cl::desc("The dialect to gen for"),
llvm::cl::cat(dialectGenCat), llvm::cl::Required);
diff --git a/offload/tools/kernelreplay/llvm-omp-kernel-replay.cpp b/offload/tools/kernelreplay/llvm-omp-kernel-replay.cpp
index 47a299f0ab55705..ccd514be71c74d7 100644
--- a/offload/tools/kernelreplay/llvm-omp-kernel-replay.cpp
+++ b/offload/tools/kernelreplay/llvm-omp-kernel-replay.cpp
@@ -23,7 +23,7 @@
using namespace llvm;
-cl::OptionCategory ReplayOptions("llvm-omp-kernel-replay Options");
+static cl::OptionCategory ReplayOptions("llvm-omp-kernel-replay Options");
// InputFilename - The filename to read the json description of the kernel.
static cl::opt<std::string> InputFilename(cl::Positional,
diff --git a/offload/tools/offload-tblgen/offload-tblgen.cpp b/offload/tools/offload-tblgen/offload-tblgen.cpp
index 1912abf5265c7cb..647db3c430264fb 100644
--- a/offload/tools/offload-tblgen/offload-tblgen.cpp
+++ b/offload/tools/offload-tblgen/offload-tblgen.cpp
@@ -34,7 +34,7 @@ enum ActionType {
};
namespace {
-cl::opt<ActionType> Action(
+static cl::opt<ActionType> Action(
cl::desc("Action to perform:"),
cl::values(
clEnumValN(PrintRecords, "print-records",
diff --git a/polly/lib/CodeGen/LoopGenerators.cpp b/polly/lib/CodeGen/LoopGenerators.cpp
index f3975ccee44fa3d..172e1a6129be453 100644
--- a/polly/lib/CodeGen/LoopGenerators.cpp
+++ b/polly/lib/CodeGen/LoopGenerators.cpp
@@ -35,7 +35,7 @@ static cl::opt<int, true>
cl::Hidden, cl::location(polly::PollyNumThreads),
cl::init(0), cl::cat(PollyCategory));
-cl::opt<bool> PollyVectorizeMetadata(
+static cl::opt<bool> PollyVectorizeMetadata(
"polly-annotate-metadata-vectorize",
cl::desc("Append vectorize enable/disable metadata from polly"),
cl::init(false), cl::ZeroOrMore, cl::cat(PollyCategory));
diff --git a/polly/lib/Transform/DeLICM.cpp b/polly/lib/Transform/DeLICM.cpp
index 9a9768afe113e97..22937e79ca22b98 100644
--- a/polly/lib/Transform/DeLICM.cpp
+++ b/polly/lib/Transform/DeLICM.cpp
@@ -35,24 +35,24 @@ using namespace llvm;
namespace {
-cl::opt<int>
+static cl::opt<int>
DelicmMaxOps("polly-delicm-max-ops",
cl::desc("Maximum number of isl operations to invest for "
"lifetime analysis; 0=no limit"),
cl::init(1000000), cl::cat(PollyCategory));
-cl::opt<bool> DelicmOverapproximateWrites(
+static cl::opt<bool> DelicmOverapproximateWrites(
"polly-delicm-overapproximate-writes",
cl::desc(
"Do more PHI writes than necessary in order to avoid partial accesses"),
cl::init(false), cl::Hidden, cl::cat(PollyCategory));
-cl::opt<bool> DelicmPartialWrites("polly-delicm-partial-writes",
- cl::desc("Allow partial writes"),
- cl::init(true), cl::Hidden,
- cl::cat(PollyCategory));
+static cl::opt<bool> DelicmPartialWrites("polly-delicm-partial-writes",
+ cl::desc("Allow partial writes"),
+ cl::init(true), cl::Hidden,
+ cl::cat(PollyCategory));
-cl::opt<bool>
+static cl::opt<bool>
DelicmComputeKnown("polly-delicm-compute-known",
cl::desc("Compute known content of array elements"),
cl::init(true), cl::Hidden, cl::cat(PollyCategory));
diff --git a/polly/lib/Transform/DeadCodeElimination.cpp b/polly/lib/Transform/DeadCodeElimination.cpp
index 5cb89fec09fe83b..04508a170b7ed37 100644
--- a/polly/lib/Transform/DeadCodeElimination.cpp
+++ b/polly/lib/Transform/DeadCodeElimination.cpp
@@ -44,7 +44,7 @@ using namespace polly;
namespace {
-cl::opt<int> DCEPreciseSteps(
+static cl::opt<int> DCEPreciseSteps(
"polly-dce-precise-steps",
cl::desc("The number of precise steps between two approximating "
"iterations. (A value of -1 schedules another approximation stage "
More information about the lldb-commits
mailing list