From: Richard Trieu Date: Wed, 15 Apr 2015 01:21:42 +0000 (+0000) Subject: Change range-based for-loops to be -Wrange-loop-analysis clean. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2142eabc7ca72878fd84cfbd14fd704b69570506;p=clang Change range-based for-loops to be -Wrange-loop-analysis clean. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@234964 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/MicrosoftMangle.cpp b/lib/AST/MicrosoftMangle.cpp index 269fb1c255..3689102114 100644 --- a/lib/AST/MicrosoftMangle.cpp +++ b/lib/AST/MicrosoftMangle.cpp @@ -1680,7 +1680,7 @@ void MicrosoftCXXNameMangler::mangleFunctionType(const FunctionType *T, Out << 'X'; } else { // Happens for function pointer type arguments for example. - for (const QualType Arg : Proto->param_types()) + for (const QualType &Arg : Proto->param_types()) mangleArgumentType(Arg, Range); // ::= Z # ellipsis if (Proto->isVariadic()) diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 8175347f95..4dd965f24a 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -3431,7 +3431,7 @@ void CodeGenModule::ClearUnusedCoverageMapping(const Decl *D) { void CodeGenModule::EmitDeferredUnusedCoverageMappings() { std::vector DeferredDecls; - for (const auto I : DeferredEmptyCoverageMappingDecls) { + for (const auto &I : DeferredEmptyCoverageMappingDecls) { if (!I.second) continue; DeferredDecls.push_back(I.first); diff --git a/lib/CodeGen/CoverageMappingGen.cpp b/lib/CodeGen/CoverageMappingGen.cpp index 07db6c74d1..d26eceded3 100644 --- a/lib/CodeGen/CoverageMappingGen.cpp +++ b/lib/CodeGen/CoverageMappingGen.cpp @@ -748,7 +748,7 @@ struct CounterCoverageMappingBuilder size_t Index = pushRegion(Counter::getZero(), getStart(CS->body_front()), getEnd(CS->body_back())); - for (const auto &Child : CS->children()) + for (const auto *Child : CS->children()) Visit(Child); popRegions(Index); } diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp index 1244829f2b..d471e89b9c 100644 --- a/lib/Sema/SemaLookup.cpp +++ b/lib/Sema/SemaLookup.cpp @@ -3070,7 +3070,7 @@ static void LookupVisibleDecls(DeclContext *Ctx, LookupResult &Result, Result.getSema().ForceDeclarationOfImplicitMembers(Class); // Enumerate all of the results in this context. - for (const auto &R : Ctx->lookups()) { + for (const auto R : Ctx->lookups()) { for (auto *D : R) { if (auto *ND = Result.getAcceptableDecl(D)) { Consumer.FoundDecl(ND, Visited.checkHidden(ND), Ctx, InBaseClass); diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 8e4fe85077..f93a848b74 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -1747,7 +1747,7 @@ Sema::SubstBaseSpecifiers(CXXRecordDecl *Instantiation, const MultiLevelTemplateArgumentList &TemplateArgs) { bool Invalid = false; SmallVector InstantiatedBases; - for (const auto Base : Pattern->bases()) { + for (const auto &Base : Pattern->bases()) { if (!Base.getType()->isDependentType()) { if (const CXXRecordDecl *RD = Base.getType()->getAsCXXRecordDecl()) { if (RD->isInvalidDecl())