diff --git a/lib/Bitcode/Writer/BitcodeWriter.cpp b/lib/Bitcode/Writer/BitcodeWriter.cpp index e69fbe66770..050294da166 100644 --- a/lib/Bitcode/Writer/BitcodeWriter.cpp +++ b/lib/Bitcode/Writer/BitcodeWriter.cpp @@ -37,6 +37,7 @@ #include using namespace llvm; +namespace { /// These are manifest constants used by the bitcode writer. They do not need to /// be kept in sync with the reader, but need to be consistent within this file. enum { @@ -463,6 +464,7 @@ private: } std::map &valueIds() { return GUIDToValueIdMap; } }; +} // end anonymous namespace static unsigned getEncodedCastOpcode(unsigned Opcode) { switch (Opcode) { diff --git a/lib/DebugInfo/PDB/GenericError.cpp b/lib/DebugInfo/PDB/GenericError.cpp index ca2d65d0b59..66b3a7a7fee 100644 --- a/lib/DebugInfo/PDB/GenericError.cpp +++ b/lib/DebugInfo/PDB/GenericError.cpp @@ -14,6 +14,7 @@ using namespace llvm; using namespace llvm::pdb; +namespace { class GenericErrorCategory : public std::error_category { public: const char *name() const LLVM_NOEXCEPT override { return "llvm.pdb"; } @@ -33,6 +34,7 @@ public: llvm_unreachable("Unrecognized generic_error_code"); } }; +} // end anonymous namespace static ManagedStatic Category; diff --git a/lib/DebugInfo/PDB/Raw/RawError.cpp b/lib/DebugInfo/PDB/Raw/RawError.cpp index aa6f15726a6..00eb6e5b24c 100644 --- a/lib/DebugInfo/PDB/Raw/RawError.cpp +++ b/lib/DebugInfo/PDB/Raw/RawError.cpp @@ -5,6 +5,7 @@ using namespace llvm; using namespace llvm::pdb; +namespace { class RawErrorCategory : public std::error_category { public: const char *name() const LLVM_NOEXCEPT override { return "llvm.pdb.raw"; } @@ -24,6 +25,7 @@ public: llvm_unreachable("Unrecognized raw_error_code"); } }; +} // end anonymous namespace static ManagedStatic Category; diff --git a/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp b/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp index d10a9c64104..5e477d39e07 100644 --- a/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp +++ b/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp @@ -589,7 +589,7 @@ bool AArch64ExpandPseudo::expandMOVImm(MachineBasicBlock &MBB, return true; } -void addPostLoopLiveIns(MachineBasicBlock *MBB, LivePhysRegs &LiveRegs) { +static void addPostLoopLiveIns(MachineBasicBlock *MBB, LivePhysRegs &LiveRegs) { for (auto I = LiveRegs.begin(); I != LiveRegs.end(); ++I) MBB->addLiveIn(*I); } diff --git a/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp b/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp index b71cd97ec5f..b68be789721 100644 --- a/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp +++ b/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp @@ -144,6 +144,7 @@ ModulePass *llvm::createPGOIndirectCallPromotionLegacyPass(bool InLTO) { return new PGOIndirectCallPromotionLegacyPass(InLTO); } +namespace { // The class for main data structure to promote indirect calls to conditional // direct calls. class ICallPromotionFunc { @@ -234,6 +235,7 @@ public: } bool processFunction(); }; +} // end anonymous namespace bool ICallPromotionFunc::isPromotionProfitable(uint64_t Count, uint64_t TotalCount) { diff --git a/lib/Transforms/Scalar/DCE.cpp b/lib/Transforms/Scalar/DCE.cpp index 2310ba62e6b..f73809d9f04 100644 --- a/lib/Transforms/Scalar/DCE.cpp +++ b/lib/Transforms/Scalar/DCE.cpp @@ -100,7 +100,7 @@ static bool DCEInstruction(Instruction *I, return false; } -bool eliminateDeadCode(Function &F, TargetLibraryInfo *TLI) { +static bool eliminateDeadCode(Function &F, TargetLibraryInfo *TLI) { bool MadeChange = false; SmallSetVector WorkList; // Iterate over the original function, only adding insts to the worklist