[llvm] [NFC]Make file-local cl::opt global variables static (PR #126486)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 10 02:37:34 PST 2025
https://github.com/chrisPyr updated https://github.com/llvm/llvm-project/pull/126486
>From 7c825b1cf6b2e1a75c2c0703a0930069032e0dea Mon Sep 17 00:00:00 2001
From: chrisPyr <smile51293 at gmail.com>
Date: Mon, 10 Feb 2025 16:41:13 +0800
Subject: [PATCH 1/2] [NFC]Make file-local cl::opt global variables static
---
.../Kaleidoscope/MCJIT/cached/toy-jit.cpp | 8 +-
.../Kaleidoscope/MCJIT/cached/toy.cpp | 18 +-
.../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 | 8 +-
llvm/lib/CodeGen/WindowScheduler.cpp | 2 +-
llvm/lib/LTO/LTOCodeGenerator.cpp | 13 +-
.../AArch64LowerHomogeneousPrologEpilog.cpp | 2 +-
.../AArch64/AArch64StackTaggingPreRA.cpp | 5 +-
.../AArch64/AArch64TargetTransformInfo.cpp | 2 +-
llvm/lib/Target/ARM/ARMSelectionDAGInfo.cpp | 2 +-
.../Target/ARM/MVELaneInterleavingPass.cpp | 2 +-
.../MCTargetDesc/HexagonMCTargetDesc.cpp | 2 +-
.../WebAssembly/WebAssemblyMCInstLower.cpp | 2 +-
llvm/lib/Transforms/IPO/ElimAvailExtern.cpp | 2 +-
.../IPO/MemProfContextDisambiguation.cpp | 2 +-
llvm/lib/Transforms/IPO/ModuleInliner.cpp | 2 +-
llvm/lib/Transforms/Scalar/LICM.cpp | 2 +-
.../Vectorize/LoopVectorizationLegality.cpp | 2 +-
.../SandboxVectorizer/SeedCollector.cpp | 6 +-
llvm/tools/bugpoint/ExecutionDriver.cpp | 4 +-
llvm/tools/bugpoint/OptimizerDriver.cpp | 2 +-
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-cxxdump/llvm-cxxdump.cpp | 2 +-
llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp | 33 +--
llvm/tools/llvm-diff/llvm-diff.cpp | 2 +-
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/utils/TableGen/DAGISelMatcherEmitter.cpp | 2 +-
llvm/utils/TableGen/DecoderEmitter.cpp | 2 +-
llvm/utils/TableGen/GlobalISelEmitter.cpp | 2 +-
llvm/utils/TableGen/RegisterInfoEmitter.cpp | 2 +-
llvm/utils/yaml-bench/YAMLBench.cpp | 2 +-
50 files changed, 251 insertions(+), 242 deletions(-)
diff --git a/llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp b/llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp
index ed1262b59064bf4..c02edb23ef40c82 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"));
+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/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 3f72e8486c06ef8..443dc1c315e8f42 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,9 +102,9 @@ 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,
diff --git a/llvm/lib/CodeGen/WindowScheduler.cpp b/llvm/lib/CodeGen/WindowScheduler.cpp
index 379740cae78d5c6..78af6314e7b2d17 100644
--- a/llvm/lib/CodeGen/WindowScheduler.cpp
+++ b/llvm/lib/CodeGen/WindowScheduler.cpp
@@ -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/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/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/MCTargetDesc/HexagonMCTargetDesc.cpp b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
index baa208816786dc7..eda1ef9230ef63b 100644
--- a/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
+++ b/llvm/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp
@@ -97,7 +97,7 @@ 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/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/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/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/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/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/ExecutionDriver.cpp b/llvm/tools/bugpoint/ExecutionDriver.cpp
index 18187ad97ddddcf..fc8de58d5b4d5e8 100644
--- a/llvm/tools/bugpoint/ExecutionDriver.cpp
+++ b/llvm/tools/bugpoint/ExecutionDriver.cpp
@@ -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/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/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-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-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/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/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/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));
>From e201ae30740dc00fea9de77201bd40237606e080 Mon Sep 17 00:00:00 2001
From: chrisPyr <smile51293 at gmail.com>
Date: Mon, 10 Feb 2025 18:24:22 +0800
Subject: [PATCH 2/2] [NFC]Make file-local cl::opt global variables static
---
.../Kaleidoscope/MCJIT/cached/toy-jit.cpp | 8 ++--
.../LLJITWithExecutorProcessControl.cpp | 4 +-
.../LLJITWithLazyReexports.cpp | 4 +-
llvm/tools/bugpoint/ExecutionDriver.cpp | 26 +++++------
llvm/tools/lli/lli.cpp | 38 ++++++++--------
llvm/tools/llvm-cov/CodeCoverage.cpp | 30 ++++++-------
llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp | 8 ++--
llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp | 44 +++++++++++--------
llvm/tools/llvm-profdata/llvm-profdata.cpp | 31 ++++++-------
llvm/tools/llvm-undname/llvm-undname.cpp | 5 ++-
llvm/tools/yaml2obj/yaml2obj.cpp | 2 +-
llvm/utils/KillTheDoctor/KillTheDoctor.cpp | 4 +-
.../TableGen/GlobalISelCombinerEmitter.cpp | 2 +-
13 files changed, 106 insertions(+), 100 deletions(-)
diff --git a/llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp b/llvm/examples/Kaleidoscope/MCJIT/cached/toy-jit.cpp
index c02edb23ef40c82..ed1262b59064bf4 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"));
+ 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/OrcV2Examples/LLJITWithExecutorProcessControl/LLJITWithExecutorProcessControl.cpp b/llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/LLJITWithExecutorProcessControl.cpp
index a219cab6e2f773b..043150f47d926d3 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/LLJITWithExecutorProcessControl.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITWithExecutorProcessControl/LLJITWithExecutorProcessControl.cpp
@@ -117,8 +117,8 @@ static void reportErrorAndExit() {
exit(1);
}
-cl::list<std::string> InputArgv(cl::Positional,
- cl::desc("<program arguments>..."));
+static cl::list<std::string> InputArgv(cl::Positional,
+ cl::desc("<program arguments>..."));
int main(int argc, char *argv[]) {
// Initialize LLVM.
diff --git a/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp b/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp
index 4b987cdd37cc56c..dc1edb16a560cff 100644
--- a/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp
+++ b/llvm/examples/OrcV2Examples/LLJITWithLazyReexports/LLJITWithLazyReexports.cpp
@@ -86,8 +86,8 @@ const llvm::StringRef MainMod =
declare i32 @bar()
)";
-cl::list<std::string> InputArgv(cl::Positional,
- cl::desc("<program arguments>..."));
+static cl::list<std::string> InputArgv(cl::Positional,
+ cl::desc("<program arguments>..."));
int main(int argc, char *argv[]) {
// Initialize LLVM.
diff --git a/llvm/tools/bugpoint/ExecutionDriver.cpp b/llvm/tools/bugpoint/ExecutionDriver.cpp
index fc8de58d5b4d5e8..f863e6b94c819b1 100644
--- a/llvm/tools/bugpoint/ExecutionDriver.cpp
+++ b/llvm/tools/bugpoint/ExecutionDriver.cpp
@@ -82,11 +82,11 @@ cl::opt<std::string>
InputFile("input", cl::init("/dev/null"),
cl::desc("Filename to pipe in as stdin (default: /dev/null)"));
-cl::list<std::string>
+static cl::list<std::string>
AdditionalSOs("additional-so", cl::desc("Additional shared objects to load "
"into executing programs"));
-cl::list<std::string> AdditionalLinkerArgs(
+static cl::list<std::string> AdditionalLinkerArgs(
"Xlinker", cl::desc("Additional arguments to pass to the linker"));
cl::opt<std::string> CustomCompileCommand(
@@ -113,20 +113,20 @@ cl::opt<std::string>
}
namespace {
-cl::list<std::string> ToolArgv("tool-args", cl::Positional,
- cl::desc("<tool arguments>..."),
- cl::PositionalEatsArgs);
+static cl::list<std::string> ToolArgv("tool-args", cl::Positional,
+ cl::desc("<tool arguments>..."),
+ cl::PositionalEatsArgs);
-cl::list<std::string> SafeToolArgv("safe-tool-args", cl::Positional,
- cl::desc("<safe-tool arguments>..."),
- cl::PositionalEatsArgs);
+static cl::list<std::string> SafeToolArgv("safe-tool-args", cl::Positional,
+ cl::desc("<safe-tool arguments>..."),
+ cl::PositionalEatsArgs);
-static cl::opt<std::string> CCBinary("gcc", cl::init(""),
- cl::desc("The gcc binary to use."));
+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>..."),
- cl::PositionalEatsArgs);
+static cl::list<std::string> CCToolArgv("gcc-tool-args", cl::Positional,
+ cl::desc("<gcc-tool arguments>..."),
+ cl::PositionalEatsArgs);
}
//===----------------------------------------------------------------------===//
diff --git a/llvm/tools/lli/lli.cpp b/llvm/tools/lli/lli.cpp
index 19246f03941673d..015e399dd7e3a7a 100644
--- a/llvm/tools/lli/lli.cpp
+++ b/llvm/tools/lli/lli.cpp
@@ -98,8 +98,8 @@ namespace {
cl::opt<std::string>
InputFile(cl::desc("<input bitcode>"), cl::Positional, cl::init("-"));
- cl::list<std::string>
- InputArgv(cl::ConsumeAfter, cl::desc("<program arguments>..."));
+ static cl::list<std::string> InputArgv(cl::ConsumeAfter,
+ cl::desc("<program arguments>..."));
cl::opt<bool> ForceInterpreter("force-interpreter",
cl::desc("Force interpretation: disable JIT"),
@@ -132,10 +132,10 @@ namespace {
"(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)"));
+ static 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(
"per-module-lazy",
@@ -143,12 +143,12 @@ namespace {
"rather than individual functions"),
cl::init(false));
- cl::list<std::string>
+ static cl::list<std::string>
JITDylibs("jd",
cl::desc("Specifies the JITDylib to be used for any subsequent "
"-extra-module arguments."));
- cl::list<std::string>
+ static cl::list<std::string>
Dylibs("dlopen", cl::desc("Dynamic libraries to load before linking"));
// The MCJIT supports building for a target address space separate from
@@ -185,20 +185,18 @@ namespace {
cl::value_desc("function"),
cl::init("main"));
- cl::list<std::string>
- ExtraModules("extra-module",
- cl::desc("Extra modules to be loaded"),
- cl::value_desc("input bitcode"));
+ static cl::list<std::string>
+ ExtraModules("extra-module", cl::desc("Extra modules to be loaded"),
+ cl::value_desc("input bitcode"));
- cl::list<std::string>
- ExtraObjects("extra-object",
- cl::desc("Extra object files to be loaded"),
- cl::value_desc("input object"));
+ static cl::list<std::string>
+ ExtraObjects("extra-object", cl::desc("Extra object files to be loaded"),
+ cl::value_desc("input object"));
- cl::list<std::string>
- ExtraArchives("extra-archive",
- cl::desc("Extra archive files to be loaded"),
- cl::value_desc("input archive"));
+ static cl::list<std::string>
+ ExtraArchives("extra-archive",
+ cl::desc("Extra archive files to be loaded"),
+ cl::value_desc("input archive"));
cl::opt<bool>
EnableCacheManager("enable-cache-manager",
diff --git a/llvm/tools/llvm-cov/CodeCoverage.cpp b/llvm/tools/llvm-cov/CodeCoverage.cpp
index 921f283deedc737..aceefa1ff7a06c0 100644
--- a/llvm/tools/llvm-cov/CodeCoverage.cpp
+++ b/llvm/tools/llvm-cov/CodeCoverage.cpp
@@ -655,15 +655,15 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
cl::opt<std::string> CovFilename(
cl::Positional, cl::desc("Covered executable or object file."));
- cl::list<std::string> CovFilenames(
+ static cl::list<std::string> CovFilenames(
"object", cl::desc("Coverage executable or object file"));
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>"));
+ static cl::list<std::string> InputSourceFiles("sources", cl::Positional,
+ cl::desc("<Source files>"));
cl::opt<bool> DebugDumpCollectedPaths(
"dump-collected-paths", cl::Optional, cl::Hidden,
@@ -674,13 +674,13 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
cl::desc(
"File with the profile data obtained after an instrumented run"));
- cl::list<std::string> Arches(
+ static 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"));
- cl::list<std::string> DebugFileDirectory(
+ static cl::list<std::string> DebugFileDirectory(
"debug-file-directory",
cl::desc("Directories to search for object files by build ID"));
cl::opt<bool> Debuginfod(
@@ -698,31 +698,31 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
"lcov tracefile output")),
cl::init(CoverageViewOptions::OutputFormat::Text));
- cl::list<std::string> PathRemaps(
+ static cl::list<std::string> PathRemaps(
"path-equivalence", cl::Optional,
cl::desc("<from>,<to> Map coverage data paths to local source file "
"paths"));
cl::OptionCategory FilteringCategory("Function filtering options");
- cl::list<std::string> NameFilters(
+ static cl::list<std::string> NameFilters(
"name", cl::Optional,
cl::desc("Show code coverage only for functions with the given name"),
cl::cat(FilteringCategory));
- cl::list<std::string> NameFilterFiles(
+ static cl::list<std::string> NameFilterFiles(
"name-allowlist", cl::Optional,
cl::desc("Show code coverage only for functions listed in the given "
"file"),
cl::cat(FilteringCategory));
- cl::list<std::string> NameRegexFilters(
+ static cl::list<std::string> NameRegexFilters(
"name-regex", cl::Optional,
cl::desc("Show code coverage only for functions that match the given "
"regular expression"),
cl::cat(FilteringCategory));
- cl::list<std::string> IgnoreFilenameRegexFilters(
+ static cl::list<std::string> IgnoreFilenameRegexFilters(
"ignore-filename-regex", cl::Optional,
cl::desc("Skip source code files with file paths that match the given "
"regular expression"),
@@ -756,7 +756,7 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
"use-color", cl::desc("Emit colored output (default=autodetect)"),
cl::init(cl::BOU_UNSET));
- cl::list<std::string> DemanglerOpts(
+ static cl::list<std::string> DemanglerOpts(
"Xdemangler", cl::desc("<demangler-path>|<demangler-option>"));
cl::opt<bool> RegionSummary(
@@ -784,8 +784,8 @@ int CodeCoverageTool::run(Command Cmd, int argc, const char **argv) {
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));
+ static cl::alias NumThreadsA("j", cl::desc("Alias for --num-threads"),
+ cl::aliasopt(NumThreads));
cl::opt<std::string> CompilationDirectory(
"compilation-dir", cl::init(""),
@@ -1020,8 +1020,8 @@ int CodeCoverageTool::doShow(int argc, const char **argv,
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));
+ static cl::alias ShowOutputDirectoryA("o", cl::desc("Alias for --output-dir"),
+ cl::aliasopt(ShowOutputDirectory));
cl::opt<bool> BinaryCounters(
"binary-counters", cl::Optional,
diff --git a/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp b/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp
index 0a148908ef61b7d..6eb193ad5f45c96 100644
--- a/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp
+++ b/llvm/tools/llvm-cxxmap/llvm-cxxmap.cpp
@@ -36,14 +36,14 @@ static cl::opt<std::string> NewSymbolFile(cl::Positional, cl::Required,
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));
+static cl::alias RemappingFileA("r", cl::aliasopt(RemappingFile),
+ 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));
+static cl::alias OutputFilenameA("o", cl::aliasopt(OutputFilename),
+ cl::cat(CXXMapCategory));
static cl::opt<bool> WarnAmbiguous(
"Wambiguous",
diff --git a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
index fc20f9c6787e208..680218e3fc96ce5 100644
--- a/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
+++ b/llvm/tools/llvm-pdbutil/llvm-pdbutil.cpp
@@ -154,9 +154,10 @@ cl::ValuesClass ChunkValues = cl::values(
clEnumValN(ModuleSubsection::All, "all", "All known subsections"));
namespace diadump {
-cl::list<std::string> InputFilenames(cl::Positional,
- cl::desc("<input PDB files>"),
- cl::OneOrMore, cl::sub(DiaDumpSubcommand));
+static cl::list<std::string> InputFilenames(cl::Positional,
+ cl::desc("<input PDB files>"),
+ cl::OneOrMore,
+ cl::sub(DiaDumpSubcommand));
cl::opt<bool> Native("native", cl::desc("Use native PDB reader instead of DIA"),
cl::sub(DiaDumpSubcommand));
@@ -198,9 +199,10 @@ static cl::opt<bool> Typedefs("typedefs", cl::desc("Dump typedefs"),
FilterOptions Filters;
namespace pretty {
-cl::list<std::string> InputFilenames(cl::Positional,
- cl::desc("<input PDB files>"),
- cl::OneOrMore, cl::sub(PrettySubcommand));
+static cl::list<std::string> InputFilenames(cl::Positional,
+ cl::desc("<input PDB files>"),
+ cl::OneOrMore,
+ cl::sub(PrettySubcommand));
cl::opt<bool> InjectedSources("injected-sources",
cl::desc("Display injected sources"),
@@ -224,7 +226,7 @@ cl::opt<bool> Globals("globals", cl::desc("Dump global symbols"),
cl::cat(TypeCategory), cl::sub(PrettySubcommand));
cl::opt<bool> Externals("externals", cl::desc("Dump external symbols"),
cl::cat(TypeCategory), cl::sub(PrettySubcommand));
-cl::list<SymLevel> SymTypes(
+static cl::list<SymLevel> SymTypes(
"sym-types", cl::desc("Type of symbols to dump (default all)"),
cl::cat(TypeCategory), cl::sub(PrettySubcommand),
cl::values(
@@ -438,9 +440,10 @@ cl::opt<bool> SplitChunks(
cl::desc(
"When dumping debug chunks, show a different section for each chunk"),
cl::sub(BytesSubcommand), cl::cat(ModuleCategory));
-cl::list<std::string> InputFilenames(cl::Positional,
- cl::desc("<input PDB files>"),
- cl::OneOrMore, cl::sub(BytesSubcommand));
+static cl::list<std::string> InputFilenames(cl::Positional,
+ cl::desc("<input PDB files>"),
+ cl::OneOrMore,
+ cl::sub(BytesSubcommand));
} // namespace bytes
@@ -640,9 +643,10 @@ cl::opt<bool> DumpSectionHeaders("section-headers",
cl::opt<bool> RawAll("all", cl::desc("Implies most other options."),
cl::cat(MiscOptions), cl::sub(DumpSubcommand));
-cl::list<std::string> InputFilenames(cl::Positional,
- cl::desc("<input PDB files>"),
- cl::OneOrMore, cl::sub(DumpSubcommand));
+static cl::list<std::string> InputFilenames(cl::Positional,
+ cl::desc("<input PDB files>"),
+ cl::OneOrMore,
+ cl::sub(DumpSubcommand));
}
namespace yaml2pdb {
@@ -717,9 +721,10 @@ cl::list<std::string> InputFilename(cl::Positional,
} // namespace pdb2yaml
namespace merge {
-cl::list<std::string> InputFilenames(cl::Positional,
- cl::desc("<input PDB files>"),
- cl::OneOrMore, cl::sub(MergeSubcommand));
+static cl::list<std::string> InputFilenames(cl::Positional,
+ cl::desc("<input PDB files>"),
+ cl::OneOrMore,
+ cl::sub(MergeSubcommand));
cl::opt<std::string>
PdbOutputFile("pdb", cl::desc("the name of the PDB file to write"),
cl::sub(MergeSubcommand));
@@ -749,9 +754,10 @@ cl::opt<InputFileType> InputType(
} // namespace explain
namespace exportstream {
-cl::list<std::string> InputFilename(cl::Positional,
- cl::desc("<input PDB file>"), cl::Required,
- cl::sub(ExportSubcommand));
+static cl::list<std::string> InputFilename(cl::Positional,
+ cl::desc("<input PDB file>"),
+ cl::Required,
+ cl::sub(ExportSubcommand));
cl::opt<std::string> OutputFile("out",
cl::desc("The file to write the stream to"),
cl::Required, cl::sub(ExportSubcommand));
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 5fa1c23355120f1..f0c9a417f3935dc 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -99,8 +99,8 @@ cl::opt<std::string> OutputFilename("output", cl::value_desc("output"),
cl::sub(MergeSubcommand));
// NOTE: cl::alias must not have cl::sub(), since aliased option's cl::sub()
// will be used. llvm::cl::alias::done() method asserts this condition.
-cl::alias OutputFilenameA("o", cl::desc("Alias for --output"),
- cl::aliasopt(OutputFilename));
+static cl::alias OutputFilenameA("o", cl::desc("Alias for --output"),
+ cl::aliasopt(OutputFilename));
// Options common to at least two commands.
static cl::opt<ProfileKinds> ProfileKind(
@@ -133,7 +133,7 @@ static cl::opt<std::string>
cl::desc("For merge, use the provided unstripped bianry to "
"correlate the raw profile."),
cl::sub(MergeSubcommand));
-cl::list<std::string> DebugFileDirectory(
+static cl::list<std::string> DebugFileDirectory(
"debug-file-directory",
cl::desc("Directories to search for object files by build ID"));
static cl::opt<bool> DebugInfod("debuginfod", cl::init(false), cl::Hidden,
@@ -163,11 +163,12 @@ static cl::opt<std::string> FuncNameFilter(
// options.
// Options specific to merge subcommand.
-cl::list<std::string> InputFilenames(cl::Positional, cl::sub(MergeSubcommand),
- cl::desc("<filename...>"));
-cl::list<std::string> WeightedInputFilenames("weighted-input",
- cl::sub(MergeSubcommand),
- cl::desc("<weight>,<filename>"));
+static cl::list<std::string> InputFilenames(cl::Positional,
+ cl::sub(MergeSubcommand),
+ cl::desc("<filename...>"));
+static cl::list<std::string>
+ WeightedInputFilenames("weighted-input", cl::sub(MergeSubcommand),
+ cl::desc("<weight>,<filename>"));
static cl::opt<ProfileFormat> OutputFormat(
cl::desc("Format of output profile"), cl::sub(MergeSubcommand),
cl::init(PF_Ext_Binary),
@@ -182,8 +183,8 @@ 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));
+static cl::alias InputFilenamesFileA("f", cl::desc("Alias for --input-files"),
+ cl::aliasopt(InputFilenamesFile));
static cl::opt<bool> DumpInputFileList(
"dump-input-file-list", cl::init(false), cl::Hidden,
cl::sub(MergeSubcommand),
@@ -192,8 +193,8 @@ 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));
+static cl::alias RemappingFileA("r", cl::desc("Alias for --remapping-file"),
+ cl::aliasopt(RemappingFile));
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 "
@@ -292,8 +293,8 @@ static cl::opt<bool> OutputSparse(
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));
+static cl::alias NumThreadsA("j", cl::desc("Alias for --num-threads"),
+ cl::aliasopt(NumThreads));
static cl::opt<std::string> ProfileSymbolListFile(
"prof-sym-list", cl::init(""), cl::sub(MergeSubcommand),
@@ -418,7 +419,7 @@ static cl::opt<bool>
ShowDetailedSummary("detailed-summary", cl::init(false),
cl::desc("Show detailed profile summary"),
cl::sub(ShowSubcommand));
-cl::list<uint32_t> DetailedSummaryCutoffs(
+static cl::list<uint32_t> DetailedSummaryCutoffs(
cl::CommaSeparated, "detailed-summary-cutoffs",
cl::desc(
"Cutoff percentages (times 10000) for generating detailed summary"),
diff --git a/llvm/tools/llvm-undname/llvm-undname.cpp b/llvm/tools/llvm-undname/llvm-undname.cpp
index 9a24eff2ae641bc..42fffeb9c1e45b7 100644
--- a/llvm/tools/llvm-undname/llvm-undname.cpp
+++ b/llvm/tools/llvm-undname/llvm-undname.cpp
@@ -58,8 +58,9 @@ static 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));
+static cl::list<std::string> Symbols(cl::Positional,
+ cl::desc("<input symbols>"),
+ cl::cat(UndNameCategory));
static bool msDemangle(const std::string &S) {
int Status;
diff --git a/llvm/tools/yaml2obj/yaml2obj.cpp b/llvm/tools/yaml2obj/yaml2obj.cpp
index 4a060e1aad427f4..45aa3828311fe5a 100644
--- a/llvm/tools/yaml2obj/yaml2obj.cpp
+++ b/llvm/tools/yaml2obj/yaml2obj.cpp
@@ -35,7 +35,7 @@ cl::OptionCategory Cat("yaml2obj Options");
cl::opt<std::string> Input(cl::Positional, cl::desc("<input file>"),
cl::init("-"), cl::cat(Cat));
-cl::list<std::string>
+static cl::list<std::string>
D("D", cl::Prefix,
cl::desc("Defined the specified macros to their specified "
"definition. The syntax is <macro>=<definition>"),
diff --git a/llvm/utils/KillTheDoctor/KillTheDoctor.cpp b/llvm/utils/KillTheDoctor/KillTheDoctor.cpp
index 4f642f8886df582..6d6cafe3007122c 100644
--- a/llvm/utils/KillTheDoctor/KillTheDoctor.cpp
+++ b/llvm/utils/KillTheDoctor/KillTheDoctor.cpp
@@ -63,8 +63,8 @@ using namespace llvm;
namespace {
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::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),
diff --git a/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp b/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp
index 770494405810ddc..749f505d8b1820d 100644
--- a/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp
+++ b/llvm/utils/TableGen/GlobalISelCombinerEmitter.cpp
@@ -67,7 +67,7 @@ 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>
+static cl::list<std::string>
SelectedCombiners("combiners", cl::desc("Emit the specified combiners"),
cl::cat(GICombinerEmitterCat), cl::CommaSeparated);
cl::opt<bool> DebugCXXPreds(
More information about the llvm-commits
mailing list