Index: clang/include/clang/Analysis/FlowSensitive/DataflowWorklist.h =================================================================== --- clang/include/clang/Analysis/FlowSensitive/DataflowWorklist.h +++ clang/include/clang/Analysis/FlowSensitive/DataflowWorklist.h @@ -69,7 +69,7 @@ : ForwardDataflowWorklist(Cfg, Ctx.getAnalysis()) {} void enqueueSuccessors(const CFGBlock *Block) { - for (auto B : Block->succs()) + for (const auto &B : Block->succs()) enqueueBlock(B); } }; @@ -85,7 +85,7 @@ Ctx.getAnalysis()->getComparator()) {} void enqueuePredecessors(const CFGBlock *Block) { - for (auto B : Block->preds()) + for (const auto &B : Block->preds()) enqueueBlock(B); } }; Index: clang/lib/AST/ComputeDependence.cpp =================================================================== --- clang/lib/AST/ComputeDependence.cpp +++ clang/lib/AST/ComputeDependence.cpp @@ -750,7 +750,7 @@ // If we have explicit template arguments, check for dependent // template arguments and whether they contain any unexpanded pack // expansions. - for (auto A : E->template_arguments()) + for (const auto &A : E->template_arguments()) Deps |= toExprDependence(A.getArgument().getDependence()); return Deps; } Index: clang/lib/AST/Type.cpp =================================================================== --- clang/lib/AST/Type.cpp +++ clang/lib/AST/Type.cpp @@ -745,7 +745,7 @@ memcpy(getTypeArgStorage(), typeArgs.data(), typeArgs.size() * sizeof(QualType)); - for (auto typeArg : typeArgs) { + for (const auto &typeArg : typeArgs) { addDependence(typeArg->getDependence() & ~TypeDependence::VariablyModified); } // Initialize the protocol qualifiers. The protocol storage is known Index: clang/lib/Frontend/FrontendActions.cpp =================================================================== --- clang/lib/Frontend/FrontendActions.cpp +++ clang/lib/Frontend/FrontendActions.cpp @@ -882,7 +882,7 @@ } // Now let's print out any modules we did not see as part of the Primary. - for (auto SM : SubModMap) { + for (const auto &SM : SubModMap) { if (!SM.second.Seen && SM.second.Mod) { Out << " " << ModuleKindName(SM.second.Kind) << " '" << SM.first << "' at index #" << SM.second.Idx Index: clang/lib/Sema/SemaCoroutine.cpp =================================================================== --- clang/lib/Sema/SemaCoroutine.cpp +++ clang/lib/Sema/SemaCoroutine.cpp @@ -1146,7 +1146,7 @@ Fn.CoroutinePromise->getType()->isDependentType()) { this->Body = Body; - for (auto KV : Fn.CoroutineParameterMoves) + for (const auto &KV : Fn.CoroutineParameterMoves) this->ParamMovesVector.push_back(KV.second); this->ParamMoves = this->ParamMovesVector; Index: clang/lib/Sema/SemaDeclCXX.cpp =================================================================== --- clang/lib/Sema/SemaDeclCXX.cpp +++ clang/lib/Sema/SemaDeclCXX.cpp @@ -801,7 +801,7 @@ << llvm::join(BadSpecifiers.begin(), BadSpecifiers.end(), " "); // Don't add FixItHints to remove the specifiers; we do still respect // them when building the underlying variable. - for (auto Loc : BadSpecifierLocs) + for (const auto &Loc : BadSpecifierLocs) Err << SourceRange(Loc, Loc); } else if (!CPlusPlus20Specifiers.empty()) { auto &&Warn = Diag(CPlusPlus20SpecifierLocs.front(),