diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index f887372060b..ee634505581 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -7519,7 +7519,7 @@ bool LLParser::ParseArgs(std::vector &Args) { return false; } -auto FwdVIRef = (GlobalValueSummaryMapTy::value_type *)-8; +static const auto FwdVIRef = (GlobalValueSummaryMapTy::value_type *)-8; static void resolveFwdRef(ValueInfo *Fwd, ValueInfo &Resolved) { bool ReadOnly = Fwd->isReadOnly(); diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index 151cf3c4247..1de2ffb6cfa 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2376,8 +2376,8 @@ static void emitRangeList(DwarfDebug &DD, AsmPrinter *Asm, } } -void emitDebugRangesImpl(DwarfDebug &DD, AsmPrinter *Asm, - const DwarfFile &Holder, MCSymbol *TableEnd) { +static void emitDebugRangesImpl(DwarfDebug &DD, AsmPrinter *Asm, + const DwarfFile &Holder, MCSymbol *TableEnd) { for (const RangeSpanList &List : Holder.getRangeLists()) emitRangeList(DD, Asm, List); diff --git a/lib/CodeGen/GlobalISel/IRTranslator.cpp b/lib/CodeGen/GlobalISel/IRTranslator.cpp index 4feb624673d..4db5d1c2ea1 100644 --- a/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -105,6 +105,7 @@ IRTranslator::IRTranslator() : MachineFunctionPass(ID) { } #ifndef NDEBUG +namespace { /// Verify that every instruction created has the same DILocation as the /// instruction being translated. class DILocationVerifier : MachineFunction::Delegate { @@ -131,6 +132,7 @@ public: } void MF_HandleRemoval(const MachineInstr &MI) override {} }; +} // namespace #endif // ifndef NDEBUG diff --git a/lib/CodeGen/GlobalISel/Legalizer.cpp b/lib/CodeGen/GlobalISel/Legalizer.cpp index df2dcace421..8f8280a21da 100644 --- a/lib/CodeGen/GlobalISel/Legalizer.cpp +++ b/lib/CodeGen/GlobalISel/Legalizer.cpp @@ -73,6 +73,7 @@ static bool isArtifact(const MachineInstr &MI) { using InstListTy = GISelWorkList<256>; using ArtifactListTy = GISelWorkList<128>; +namespace { class LegalizerWorkListManager : public GISelChangeObserver { InstListTy &InstList; ArtifactListTy &ArtifactList; @@ -111,6 +112,7 @@ public: createdInstr(MI); } }; +} // namespace bool Legalizer::runOnMachineFunction(MachineFunction &MF) { // If the ISel pipeline failed, do not bother running that pass. diff --git a/lib/Transforms/IPO/HotColdSplitting.cpp b/lib/Transforms/IPO/HotColdSplitting.cpp index 5d989a40f65..924a7d5fbd9 100644 --- a/lib/Transforms/IPO/HotColdSplitting.cpp +++ b/lib/Transforms/IPO/HotColdSplitting.cpp @@ -295,6 +295,7 @@ Function *HotColdSplitting::extractColdRegion(const BlockSequence &Region, /// A pair of (basic block, score). using BlockTy = std::pair; +namespace { /// A maximal outlining region. This contains all blocks post-dominated by a /// sink block, the sink block itself, and all blocks dominated by the sink. class OutliningRegion { @@ -458,6 +459,7 @@ public: return SubRegion; } }; +} // namespace bool HotColdSplitting::outlineColdRegions(Function &F, ProfileSummaryInfo &PSI, BlockFrequencyInfo *BFI, diff --git a/lib/Transforms/Instrumentation/GCOVProfiling.cpp b/lib/Transforms/Instrumentation/GCOVProfiling.cpp index 829123911c6..9af64ed332c 100644 --- a/lib/Transforms/Instrumentation/GCOVProfiling.cpp +++ b/lib/Transforms/Instrumentation/GCOVProfiling.cpp @@ -185,7 +185,7 @@ static StringRef getFunctionName(const DISubprogram *SP) { /// Prefer relative paths in the coverage notes. Clang also may split /// up absolute paths into a directory and filename component. When /// the relative path doesn't exist, reconstruct the absolute path. -SmallString<128> getFilename(const DISubprogram *SP) { +static SmallString<128> getFilename(const DISubprogram *SP) { SmallString<128> Path; StringRef RelPath = SP->getFilename(); if (sys::fs::exists(RelPath)) diff --git a/lib/Transforms/Scalar/LICM.cpp b/lib/Transforms/Scalar/LICM.cpp index 44ef6ea73ff..d204654c391 100644 --- a/lib/Transforms/Scalar/LICM.cpp +++ b/lib/Transforms/Scalar/LICM.cpp @@ -480,6 +480,7 @@ bool llvm::sinkRegion(DomTreeNode *N, AliasAnalysis *AA, LoopInfo *LI, return Changed; } +namespace { // This is a helper class for hoistRegion to make it able to hoist control flow // in order to be able to hoist phis. The way this works is that we initially // start hoisting to the loop preheader, and when we see a loop invariant branch @@ -706,6 +707,7 @@ public: return HoistDestinationMap[BB]; } }; +} // namespace /// Walk the specified region of the CFG (defined by all blocks dominated by /// the specified block, and that are in the current loop) in depth first diff --git a/lib/Transforms/Scalar/LoopSimplifyCFG.cpp b/lib/Transforms/Scalar/LoopSimplifyCFG.cpp index c8461655770..2e5927f9a06 100644 --- a/lib/Transforms/Scalar/LoopSimplifyCFG.cpp +++ b/lib/Transforms/Scalar/LoopSimplifyCFG.cpp @@ -80,6 +80,7 @@ static BasicBlock *getOnlyLiveSuccessor(BasicBlock *BB) { return nullptr; } +namespace { /// Helper class that can turn branches and switches with constant conditions /// into unconditional branches. class ConstantTerminatorFoldingImpl { @@ -538,6 +539,7 @@ public: return true; } }; +} // namespace /// Turn branches and switches with known constant conditions into unconditional /// branches.