On Tue, Apr 14, 2015 at 6:21 PM, Richard Trieu <[email protected]> wrote:
> Author: rtrieu
> Date: Tue Apr 14 20:21:42 2015
> New Revision: 234964
>
> URL: http://llvm.org/viewvc/llvm-project?rev=234964&view=rev
> Log:
> Change range-based for-loops to be -Wrange-loop-analysis clean.
> No functionality change.
>
> Modified:
>     cfe/trunk/lib/AST/MicrosoftMangle.cpp
>     cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>     cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
>     cfe/trunk/lib/Sema/SemaLookup.cpp
>     cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
>
> Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=234964&r1=234963&r2=234964&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
> +++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Tue Apr 14 20:21:42 2015
> @@ -1680,7 +1680,7 @@ void MicrosoftCXXNameMangler::mangleFunc
>      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);
>      // <builtin-type>      ::= Z  # ellipsis
>      if (Proto->isVariadic())
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=234964&r1=234963&r2=234964&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue Apr 14 20:21:42 2015
> @@ -3431,7 +3431,7 @@ void CodeGenModule::ClearUnusedCoverageM
>
>  void CodeGenModule::EmitDeferredUnusedCoverageMappings() {
>    std::vector<const Decl *> DeferredDecls;
> -  for (const auto I : DeferredEmptyCoverageMappingDecls) {
> +  for (const auto &I : DeferredEmptyCoverageMappingDecls) {
>      if (!I.second)
>        continue;
>      DeferredDecls.push_back(I.first);
>
> Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=234964&r1=234963&r2=234964&view=diff
> ==============================================================================
> --- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Tue Apr 14 20:21:42 2015
> @@ -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);
>        }
>
> Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=234964&r1=234963&r2=234964&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaLookup.cpp Tue Apr 14 20:21:42 2015
> @@ -3070,7 +3070,7 @@ static void LookupVisibleDecls(DeclConte
>      Result.getSema().ForceDeclarationOfImplicitMembers(Class);
>
>    // Enumerate all of the results in this context.
> -  for (const auto &R : Ctx->lookups()) {
> +  for (const auto R : Ctx->lookups()) {

Could we put the concrete type in here when we're not using reference,
just to make it clear that that's the right choice? (I realize the
warning will help us not make the "accidentally used auto by value
instead of by reference" mistake, but it's helpful to justify it in
the source for readers)

>      for (auto *D : R) {
>        if (auto *ND = Result.getAcceptableDecl(D)) {
>          Consumer.FoundDecl(ND, Visited.checkHidden(ND), Ctx, InBaseClass);
>
> Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=234964&r1=234963&r2=234964&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Tue Apr 14 20:21:42 2015
> @@ -1747,7 +1747,7 @@ Sema::SubstBaseSpecifiers(CXXRecordDecl
>                            const MultiLevelTemplateArgumentList 
> &TemplateArgs) {
>    bool Invalid = false;
>    SmallVector<CXXBaseSpecifier*, 4> 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())
>
>
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to