From 651d0bf9dc6165cad9767ef77fdfdb8c169d60a4 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Tue, 15 May 2018 21:26:47 +0000 Subject: [PATCH] Move helper classes into anonymous namespaces. NFCI. llvm-svn: 332400 --- clang/lib/CodeGen/CGOpenMPRuntime.cpp | 7 ++++--- clang/lib/Serialization/ASTReaderDecl.cpp | 4 ++-- llvm/lib/CodeGen/MIRCanonicalizerPass.cpp | 6 +++--- llvm/lib/ObjectYAML/DWARFEmitter.cpp | 2 ++ 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 42f1cea..7373331 100644 --- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@ -1470,9 +1470,10 @@ createConstantGlobalStruct(CodeGenModule &CGM, QualType Ty, } template -void createConstantGlobalStructAndAddToParent(CodeGenModule &CGM, QualType Ty, - ArrayRef Data, - T &Parent) { +static void +createConstantGlobalStructAndAddToParent(CodeGenModule &CGM, QualType Ty, + ArrayRef Data, + T &Parent) { const auto *RD = cast(Ty->getAsTagDecl()); const CGRecordLayout &RL = CGM.getTypes().getCGRecordLayout(RD); ConstantStructBuilder Fields = Parent.beginStruct(RL.getLLVMType()); diff --git a/clang/lib/Serialization/ASTReaderDecl.cpp b/clang/lib/Serialization/ASTReaderDecl.cpp index 79465b5..a1ce26d 100644 --- a/clang/lib/Serialization/ASTReaderDecl.cpp +++ b/clang/lib/Serialization/ASTReaderDecl.cpp @@ -2552,11 +2552,11 @@ void ASTDeclReader::mergeRedeclarable(Redeclarable *DBase, T *Existing, /// 6.1.2.6/1). Although most merging is done in Sema, we need to guarantee /// that some types are mergeable during deserialization, otherwise name /// lookup fails. This is the case for EnumConstantDecl. -bool allowODRLikeMergeInC(NamedDecl *ND) { +static bool allowODRLikeMergeInC(NamedDecl *ND) { if (!ND) return false; // TODO: implement merge for other necessary decls. - if (dyn_cast(ND)) + if (isa(ND)) return true; return false; } diff --git a/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp b/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp index 8f02423..af6fc11 100644 --- a/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp +++ b/llvm/lib/CodeGen/MIRCanonicalizerPass.cpp @@ -318,7 +318,7 @@ static bool rescheduleCanonically(unsigned &PseudoIdempotentInstCount, return Changed; } -bool propagateLocalCopies(MachineBasicBlock *MBB) { +static bool propagateLocalCopies(MachineBasicBlock *MBB) { bool Changed = false; MachineRegisterInfo &MRI = MBB->getParent()->getRegInfo(); @@ -468,9 +468,8 @@ static void doCandidateWalk(std::vector &VRegs, } } +namespace { class NamedVRegCursor { - -private: MachineRegisterInfo &MRI; unsigned virtualVRegNumber; @@ -512,6 +511,7 @@ public: return MRI.createVirtualRegister(RC, OS.str()); } }; +} // namespace static std::map GetVRegRenameMap(const std::vector &VRegs, diff --git a/llvm/lib/ObjectYAML/DWARFEmitter.cpp b/llvm/lib/ObjectYAML/DWARFEmitter.cpp index 6d75897..f23fa12 100644 --- a/llvm/lib/ObjectYAML/DWARFEmitter.cpp +++ b/llvm/lib/ObjectYAML/DWARFEmitter.cpp @@ -307,6 +307,7 @@ EmitDebugSectionImpl(const DWARFYAML::Data &DI, EmitFuncType EmitFunc, OutputBuffers[Sec] = MemoryBuffer::getMemBufferCopy(Data); } +namespace { class DIEFixupVisitor : public DWARFYAML::Visitor { uint64_t Length; @@ -345,6 +346,7 @@ private: Length += MBR.getBufferSize(); } }; +} // namespace Expected>> DWARFYAML::EmitDebugSections(StringRef YAMLString, bool ApplyFixups, -- 2.7.4