Index: clang/lib/Basic/ParsedAttrInfo.cpp =================================================================== --- clang/lib/Basic/ParsedAttrInfo.cpp +++ clang/lib/Basic/ParsedAttrInfo.cpp @@ -25,7 +25,7 @@ static llvm::ManagedStatic>> PluginAttrInstances; if (PluginAttrInstances->empty()) - for (auto It : ParsedAttrInfoRegistry::entries()) + for (const auto &It : ParsedAttrInfoRegistry::entries()) PluginAttrInstances->emplace_back(It.instantiate()); return *PluginAttrInstances; Index: clang/lib/CodeGen/TargetInfo.cpp =================================================================== --- clang/lib/CodeGen/TargetInfo.cpp +++ clang/lib/CodeGen/TargetInfo.cpp @@ -7916,7 +7916,7 @@ if (isVectorTypeBased(FT->getReturnType().getTypePtr(), /*IsParam*/true)) return true; if (const FunctionProtoType *Proto = Ty->getAs()) - for (auto ParamType : Proto->getParamTypes()) + for (const auto &ParamType : Proto->getParamTypes()) if (isVectorTypeBased(ParamType.getTypePtr(), /*IsParam*/true)) return true; Index: clang/lib/Sema/Sema.cpp =================================================================== --- clang/lib/Sema/Sema.cpp +++ clang/lib/Sema/Sema.cpp @@ -865,7 +865,7 @@ S.getUndefinedButUsed(Undefined); if (Undefined.empty()) return; - for (auto Undef : Undefined) { + for (const auto &Undef : Undefined) { ValueDecl *VD = cast(Undef.first); SourceLocation UseLoc = Undef.second; Index: clang/lib/Sema/SemaRISCVVectorLookup.cpp =================================================================== --- clang/lib/Sema/SemaRISCVVectorLookup.cpp +++ clang/lib/Sema/SemaRISCVVectorLookup.cpp @@ -253,7 +253,7 @@ // Create non-masked policy intrinsic. if (Record.UnMaskedPolicyScheme != PolicyScheme::SchemeNone) { - for (auto P : SupportedUnMaskedPolicies) { + for (const auto &P : SupportedUnMaskedPolicies) { llvm::SmallVector PolicyPrototype = RVVIntrinsic::computeBuiltinTypes( BasicProtoSeq, /*IsMasked=*/false, Index: clang/lib/Sema/SemaStmtAttr.cpp =================================================================== --- clang/lib/Sema/SemaStmtAttr.cpp +++ clang/lib/Sema/SemaStmtAttr.cpp @@ -238,7 +238,7 @@ << A; } - for (auto Tup : + for (const auto &Tup : llvm::zip_longest(OrigCEF.getCallExprs(), CEF.getCallExprs())) { // If the original call expression already had a callee, we already // diagnosed this, so skip it here. We can't skip if there isn't a 1:1