diff --git a/clang-tools-extra/clang-doc/MDGenerator.cpp b/clang-tools-extra/clang-doc/MDGenerator.cpp --- a/clang-tools-extra/clang-doc/MDGenerator.cpp +++ b/clang-tools-extra/clang-doc/MDGenerator.cpp @@ -215,7 +215,7 @@ if (!I.Members.empty()) { writeHeader("Members", 2, OS); - for (const auto Member : I.Members) { + for (const auto &Member : I.Members) { std::string Access = getAccess(Member.Access); if (Access != "") writeLine(Access + " " + Member.Type.Name + " " + Member.Name, OS); diff --git a/clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.cpp b/clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.cpp --- a/clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.cpp +++ b/clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.cpp @@ -75,7 +75,7 @@ const CXXRecordDecl &BaseDecl) { if (DerivedDecl.getCanonicalDecl() == BaseDecl.getCanonicalDecl()) return; - for (const auto &Method : DerivedDecl.methods()) { + for (const auto *Method : DerivedDecl.methods()) { // Virtual destructors are OK. We're ignoring constructors since they are // tagged as overrides. if (isa(Method) || isa(Method)) diff --git a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp --- a/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp @@ -792,7 +792,7 @@ } if (const auto *Decl = Result.Nodes.getNodeAs("using")) { - for (const auto &Shadow : Decl->shadows()) { + for (const auto *Shadow : Decl->shadows()) { addUsage(NamingCheckFailures, Shadow->getTargetDecl(), Decl->getNameInfo().getSourceRange()); } diff --git a/clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp b/clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp --- a/clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp +++ b/clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp @@ -23,7 +23,7 @@ namespace { template bool isSetDifferenceEmpty(const S &S1, const S &S2) { - for (const auto &E : S1) + for (auto E : S1) if (S2.count(E) == 0) return false; return true; diff --git a/clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp b/clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp --- a/clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp +++ b/clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp @@ -125,7 +125,7 @@ auto Result = ExceptionInfo::createUnknown(); if (const auto *FPT = Func->getType()->getAs()) { - for (const QualType Ex : FPT->exceptions()) + for (const QualType &Ex : FPT->exceptions()) Result.registerException(Ex.getTypePtr()); } return Result; diff --git a/clang-tools-extra/clangd/index/MemIndex.cpp b/clang-tools-extra/clangd/index/MemIndex.cpp --- a/clang-tools-extra/clangd/index/MemIndex.cpp +++ b/clang-tools-extra/clangd/index/MemIndex.cpp @@ -36,7 +36,7 @@ Req.Limit ? *Req.Limit : std::numeric_limits::max()); FuzzyMatcher Filter(Req.Query); bool More = false; - for (const auto Pair : Index) { + for (const auto &Pair : Index) { const Symbol *Sym = Pair.second; // Exact match against all possible scopes. diff --git a/clang/lib/CodeGen/CodeGenPGO.cpp b/clang/lib/CodeGen/CodeGenPGO.cpp --- a/clang/lib/CodeGen/CodeGenPGO.cpp +++ b/clang/lib/CodeGen/CodeGenPGO.cpp @@ -167,7 +167,7 @@ bool TraverseBlockExpr(BlockExpr *BE) { return true; } bool TraverseLambdaExpr(LambdaExpr *LE) { // Traverse the captures, but not the body. - for (const auto &C : zip(LE->captures(), LE->capture_inits())) + for (auto C : zip(LE->captures(), LE->capture_inits())) TraverseLambdaCapture(LE, &std::get<0>(C), std::get<1>(C)); return true; } diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp --- a/clang/lib/CodeGen/ItaniumCXXABI.cpp +++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp @@ -2423,7 +2423,7 @@ } void CodeGenModule::registerGlobalDtorsWithAtExit() { - for (const auto I : DtorsUsingAtExit) { + for (const auto &I : DtorsUsingAtExit) { int Priority = I.first; const llvm::TinyPtrVector &Dtors = I.second; diff --git a/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp --- a/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp +++ b/clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp @@ -686,7 +686,7 @@ CheckerContext &C) const { ProgramStateRef State = C.getState(); TrackedRegionMapTy TrackedRegions = State->get(); - for (const auto &E : TrackedRegions) { + for (auto E : TrackedRegions) { const MemRegion *Region = E.first; bool IsRegDead = !SymReaper.isLiveRegion(Region); diff --git a/clang/lib/Tooling/ASTDiff/ASTDiff.cpp b/clang/lib/Tooling/ASTDiff/ASTDiff.cpp --- a/clang/lib/Tooling/ASTDiff/ASTDiff.cpp +++ b/clang/lib/Tooling/ASTDiff/ASTDiff.cpp @@ -787,7 +787,7 @@ return; ZhangShashaMatcher Matcher(*this, T1, T2, Id1, Id2); std::vector> R = Matcher.getMatchingNodes(); - for (const auto Tuple : R) { + for (const auto &Tuple : R) { NodeId Src = Tuple.first; NodeId Dst = Tuple.second; if (!M.hasSrc(Src) && !M.hasDst(Dst)) diff --git a/clang/tools/clang-refactor/TestSupport.cpp b/clang/tools/clang-refactor/TestSupport.cpp --- a/clang/tools/clang-refactor/TestSupport.cpp +++ b/clang/tools/clang-refactor/TestSupport.cpp @@ -74,7 +74,7 @@ const tooling::AtomicChanges &RHS) { if (LHS.size() != RHS.size()) return false; - for (const auto &I : llvm::zip(LHS, RHS)) { + for (auto I : llvm::zip(LHS, RHS)) { if (!(std::get<0>(I) == std::get<1>(I))) return false; } diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp --- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp +++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp @@ -72,7 +72,7 @@ (void)module; if (!call_inst->hasByValArgument()) return false; - for (const auto ¶m : call_inst->operand_values()) + for (const auto *param : call_inst->operand_values()) if (isRSAllocationPtrTy(param->getType())) return true; return false; diff --git a/lldb/source/Plugins/Platform/Android/AdbClient.cpp b/lldb/source/Plugins/Platform/Android/AdbClient.cpp --- a/lldb/source/Plugins/Platform/Android/AdbClient.cpp +++ b/lldb/source/Plugins/Platform/Android/AdbClient.cpp @@ -165,7 +165,7 @@ llvm::SmallVector devices; response.split(devices, "\n", -1, false); - for (const auto device : devices) + for (const auto &device : devices) device_list.push_back(device.split('\t').first); // Force disconnect since ADB closes connection after host:devices response diff --git a/lldb/source/Target/StackFrameRecognizer.cpp b/lldb/source/Target/StackFrameRecognizer.cpp --- a/lldb/source/Target/StackFrameRecognizer.cpp +++ b/lldb/source/Target/StackFrameRecognizer.cpp @@ -39,7 +39,7 @@ ValueObjectListSP args = m_interpreter->GetRecognizedArguments(m_python_object_sp, frame); auto args_synthesized = ValueObjectListSP(new ValueObjectList()); - for (const auto o : args->GetObjects()) { + for (const auto &o : args->GetObjects()) { args_synthesized->Append(ValueObjectRecognizerSynthesizedValue::Create( *o, eValueTypeVariableArgument)); } diff --git a/llvm/include/llvm/Analysis/LoopInfo.h b/llvm/include/llvm/Analysis/LoopInfo.h --- a/llvm/include/llvm/Analysis/LoopInfo.h +++ b/llvm/include/llvm/Analysis/LoopInfo.h @@ -208,7 +208,7 @@ bool isLoopExiting(const BlockT *BB) const { assert(!isInvalid() && "Loop not in a valid state!"); assert(contains(BB) && "Exiting block must be part of the loop"); - for (const auto &Succ : children(BB)) { + for (const auto *Succ : children(BB)) { if (!contains(Succ)) return true; } diff --git a/llvm/include/llvm/Analysis/LoopInfoImpl.h b/llvm/include/llvm/Analysis/LoopInfoImpl.h --- a/llvm/include/llvm/Analysis/LoopInfoImpl.h +++ b/llvm/include/llvm/Analysis/LoopInfoImpl.h @@ -35,7 +35,7 @@ SmallVectorImpl &ExitingBlocks) const { assert(!isInvalid() && "Loop not in a valid state!"); for (const auto BB : blocks()) - for (const auto &Succ : children(BB)) + for (auto *Succ : children(BB)) if (!contains(Succ)) { // Not in current loop? It must be an exit block. ExitingBlocks.push_back(BB); @@ -63,7 +63,7 @@ SmallVectorImpl &ExitBlocks) const { assert(!isInvalid() && "Loop not in a valid state!"); for (const auto BB : blocks()) - for (const auto &Succ : children(BB)) + for (auto *Succ : children(BB)) if (!contains(Succ)) // Not in current loop? It must be an exit block. ExitBlocks.push_back(Succ); @@ -142,7 +142,7 @@ SmallVectorImpl &ExitEdges) const { assert(!isInvalid() && "Loop not in a valid state!"); for (const auto BB : blocks()) - for (const auto &Succ : children(BB)) + for (auto *Succ : children(BB)) if (!contains(Succ)) // Not in current loop? It must be an exit block. ExitEdges.emplace_back(BB, Succ); diff --git a/llvm/include/llvm/Support/GenericDomTree.h b/llvm/include/llvm/Support/GenericDomTree.h --- a/llvm/include/llvm/Support/GenericDomTree.h +++ b/llvm/include/llvm/Support/GenericDomTree.h @@ -778,13 +778,13 @@ NodeRef NewBBSucc = *GraphT::child_begin(NewBB); std::vector PredBlocks; - for (const auto &Pred : children>(NewBB)) + for (auto Pred : children>(NewBB)) PredBlocks.push_back(Pred); assert(!PredBlocks.empty() && "No predblocks?"); bool NewBBDominatesNewBBSucc = true; - for (const auto &Pred : children>(NewBBSucc)) { + for (auto Pred : children>(NewBBSucc)) { if (Pred != NewBB && !dominates(NewBBSucc, Pred) && isReachableFromEntry(Pred)) { NewBBDominatesNewBBSucc = false; diff --git a/llvm/lib/Analysis/DomTreeUpdater.cpp b/llvm/lib/Analysis/DomTreeUpdater.cpp --- a/llvm/lib/Analysis/DomTreeUpdater.cpp +++ b/llvm/lib/Analysis/DomTreeUpdater.cpp @@ -233,7 +233,7 @@ return; if (Strategy == UpdateStrategy::Lazy) { - for (const auto U : Updates) + for (const auto &U : Updates) if (!isSelfDominance(U)) PendUpdates.push_back(U); @@ -253,7 +253,7 @@ SmallSet, 8> Seen; SmallVector DeduplicatedUpdates; - for (const auto U : Updates) { + for (const auto &U : Updates) { auto Edge = std::make_pair(U.getFrom(), U.getTo()); // Because it is illegal to submit updates that have already been applied // and updates to an edge need to be strictly ordered, diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp --- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -1494,7 +1494,7 @@ if (auto *I = dyn_cast(P.getPointer())) { auto toRemoveIt = ReverseNonLocalDefsCache.find(I); if (toRemoveIt != ReverseNonLocalDefsCache.end()) { - for (const auto &entry : toRemoveIt->second) + for (const auto *entry : toRemoveIt->second) NonLocalDefsCache.erase(entry); ReverseNonLocalDefsCache.erase(toRemoveIt); } diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -12527,7 +12527,7 @@ const PredicatedScalarEvolution &Init) : RewriteMap(Init.RewriteMap), SE(Init.SE), L(Init.L), Preds(Init.Preds), Generation(Init.Generation), BackedgeCount(Init.BackedgeCount) { - for (const auto &I : Init.FlagsMap) + for (auto I : Init.FlagsMap) FlagsMap.insert(I); } diff --git a/llvm/lib/CodeGen/InlineSpiller.cpp b/llvm/lib/CodeGen/InlineSpiller.cpp --- a/llvm/lib/CodeGen/InlineSpiller.cpp +++ b/llvm/lib/CodeGen/InlineSpiller.cpp @@ -1427,7 +1427,7 @@ } // For spills in SpillsToKeep with LiveReg set (i.e., not original spill), // save them to SpillsToIns. - for (const auto Ent : SpillsToKeep) { + for (const auto &Ent : SpillsToKeep) { if (Ent.second) SpillsToIns[Ent.first->getBlock()] = Ent.second; } @@ -1486,7 +1486,7 @@ LLVM_DEBUG({ dbgs() << "Finally inserted spills in BB: "; - for (const auto Ispill : SpillsToIns) + for (const auto &Ispill : SpillsToIns) dbgs() << Ispill.first->getNumber() << " "; dbgs() << "\nFinally removed spills in BB: "; for (const auto Rspill : SpillsToRm) @@ -1501,7 +1501,7 @@ StackIntvl.getValNumInfo(0)); // Insert hoisted spills. - for (auto const Insert : SpillsToIns) { + for (auto const &Insert : SpillsToIns) { MachineBasicBlock *BB = Insert.first; unsigned LiveReg = Insert.second; MachineBasicBlock::iterator MI = IPA.getLastInsertPointIter(OrigLI, *BB); diff --git a/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp b/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp --- a/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp +++ b/llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp @@ -1168,7 +1168,7 @@ // If there are users outside the set to be eliminated, we abort the // transformation. No gain can be expected. - for (const auto &U : I->users()) { + for (auto *U : I->users()) { if (Is.find(dyn_cast(U)) == Is.end()) return false; } diff --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp --- a/llvm/lib/CodeGen/RegAllocFast.cpp +++ b/llvm/lib/CodeGen/RegAllocFast.cpp @@ -1253,7 +1253,7 @@ MachineBasicBlock::iterator MII = MBB.begin(); // Add live-in registers as live. - for (const MachineBasicBlock::RegisterMaskPair LI : MBB.liveins()) + for (const MachineBasicBlock::RegisterMaskPair &LI : MBB.liveins()) if (MRI->isAllocatable(LI.PhysReg)) definePhysReg(MII, LI.PhysReg, regReserved); diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -3038,7 +3038,7 @@ if (!Visited.insert(User).second) continue; - for (const auto &U : User->users()) { + for (const auto *U : User->users()) { auto Inst = dyn_cast(U); if (!Inst) return false; diff --git a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp --- a/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp +++ b/llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp @@ -273,7 +273,7 @@ Streamer.SwitchSection(S); - for (const auto &Operand : LinkerOptions->operands()) { + for (const auto *Operand : LinkerOptions->operands()) { if (cast(Operand)->getNumOperands() != 2) report_fatal_error("invalid llvm.linker.options"); for (const auto &Option : cast(Operand)->operands()) { @@ -289,7 +289,7 @@ Streamer.SwitchSection(S); - for (const auto &Operand : DependentLibraries->operands()) { + for (const auto *Operand : DependentLibraries->operands()) { Streamer.EmitBytes( cast(cast(Operand)->getOperand(0))->getString()); Streamer.EmitIntValue(0, 1); @@ -885,7 +885,7 @@ Module &M) const { // Emit the linker options if present. if (auto *LinkerOptions = M.getNamedMetadata("llvm.linker.options")) { - for (const auto &Option : LinkerOptions->operands()) { + for (const auto *Option : LinkerOptions->operands()) { SmallVector StrOptions; for (const auto &Piece : cast(Option)->operands()) StrOptions.push_back(cast(Piece)->getString()); @@ -1449,7 +1449,7 @@ // linker. MCSection *Sec = getDrectveSection(); Streamer.SwitchSection(Sec); - for (const auto &Option : LinkerOptions->operands()) { + for (const auto *Option : LinkerOptions->operands()) { for (const auto &Piece : cast(Option)->operands()) { // Lead with a space for consistency with our dllexport implementation. std::string Directive(" "); diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp @@ -277,7 +277,7 @@ AppleAcceleratorTable::Entry::lookup(HeaderData::AtomType Atom) const { assert(HdrData && "Dereferencing end iterator?"); assert(HdrData->Atoms.size() == Values.size()); - for (const auto &Tuple : zip_first(HdrData->Atoms, Values)) { + for (auto Tuple : zip_first(HdrData->Atoms, Values)) { if (std::get<0>(Tuple).first == Atom) return std::get<1>(Tuple); } @@ -531,7 +531,7 @@ Optional DWARFDebugNames::Entry::lookup(dwarf::Index Index) const { assert(Abbr->Attributes.size() == Values.size()); - for (const auto &Tuple : zip_first(Abbr->Attributes, Values)) { + for (auto Tuple : zip_first(Abbr->Attributes, Values)) { if (std::get<0>(Tuple).Index == Index) return std::get<1>(Tuple); } @@ -565,7 +565,7 @@ W.printHex("Abbrev", Abbr->Code); W.startLine() << formatv("Tag: {0}\n", Abbr->Tag); assert(Abbr->Attributes.size() == Values.size()); - for (const auto &Tuple : zip_first(Abbr->Attributes, Values)) { + for (auto Tuple : zip_first(Abbr->Attributes, Values)) { W.startLine() << formatv("{0}: ", std::get<0>(Tuple).Index); std::get<1>(Tuple).dump(W.getOStream()); W.getOStream() << '\n'; diff --git a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp --- a/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp +++ b/llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp @@ -642,7 +642,7 @@ // getting the DIE by offset and emitting an error OS << "Verifying .debug_info references...\n"; unsigned NumErrors = 0; - for (const std::pair> &Pair : + for (const std::pair> &Pair : ReferenceToDIEOffsets) { if (DCtx.getDIEForOffset(Pair.first)) continue; diff --git a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp --- a/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp +++ b/llvm/lib/DebugInfo/Symbolize/Symbolize.cpp @@ -297,7 +297,7 @@ if (P.p_type != ELF::PT_NOTE) continue; Error Err = Error::success(); - for (const auto &N : Obj->notes(P, Err)) + for (auto N : Obj->notes(P, Err)) if (N.getType() == ELF::NT_GNU_BUILD_ID && N.getName() == ELF::ELF_NOTE_GNU) return N.getDesc(); } diff --git a/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp b/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp --- a/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp +++ b/llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp @@ -121,7 +121,7 @@ JD.getExecutionSession(), (*CtorDtors.begin()).Func->getParent()->getDataLayout()); - for (const auto &CtorDtor : CtorDtors) { + for (auto CtorDtor : CtorDtors) { assert(CtorDtor.Func && CtorDtor.Func->hasName() && "Ctor/Dtor function must be named to be runnable under the JIT"); diff --git a/llvm/lib/IR/TypeFinder.cpp b/llvm/lib/IR/TypeFinder.cpp --- a/llvm/lib/IR/TypeFinder.cpp +++ b/llvm/lib/IR/TypeFinder.cpp @@ -77,7 +77,7 @@ } for (const auto &NMD : M.named_metadata()) - for (const auto &MDOp : NMD.operands()) + for (const auto *MDOp : NMD.operands()) incorporateMDNode(MDOp); } diff --git a/llvm/lib/Linker/IRMover.cpp b/llvm/lib/Linker/IRMover.cpp --- a/llvm/lib/Linker/IRMover.cpp +++ b/llvm/lib/Linker/IRMover.cpp @@ -1099,7 +1099,7 @@ } void IRLinker::flushRAUWWorklist() { - for (const auto Elem : RAUWWorklist) { + for (const auto &Elem : RAUWWorklist) { GlobalValue *Old; Value *New; std::tie(Old, New) = Elem; diff --git a/llvm/lib/MC/XCOFFObjectWriter.cpp b/llvm/lib/MC/XCOFFObjectWriter.cpp --- a/llvm/lib/MC/XCOFFObjectWriter.cpp +++ b/llvm/lib/MC/XCOFFObjectWriter.cpp @@ -570,7 +570,7 @@ writeSymbolTableEntryForControlSection( Csect, SectionIndex, Csect.MCCsect->getStorageClass()); - for (const auto Sym : Csect.Syms) + for (const auto &Sym : Csect.Syms) writeSymbolTableEntryForCsectMemberLabel( Sym, Csect, SectionIndex, Layout.getSymbolOffset(*(Sym.MCSym))); } diff --git a/llvm/lib/MCA/HardwareUnits/ResourceManager.cpp b/llvm/lib/MCA/HardwareUnits/ResourceManager.cpp --- a/llvm/lib/MCA/HardwareUnits/ResourceManager.cpp +++ b/llvm/lib/MCA/HardwareUnits/ResourceManager.cpp @@ -281,7 +281,7 @@ uint64_t ResourceManager::checkAvailability(const InstrDesc &Desc) const { uint64_t BusyResourceMask = 0; - for (const std::pair &E : Desc.Resources) { + for (const std::pair &E : Desc.Resources) { unsigned NumUnits = E.second.isReserved() ? 0U : E.second.NumUnits; unsigned Index = getResourceStateIndex(E.first); if (!Resources[Index]->isReady(NumUnits)) diff --git a/llvm/lib/MCA/Stages/InstructionTables.cpp b/llvm/lib/MCA/Stages/InstructionTables.cpp --- a/llvm/lib/MCA/Stages/InstructionTables.cpp +++ b/llvm/lib/MCA/Stages/InstructionTables.cpp @@ -24,7 +24,8 @@ UsedResources.clear(); // Identify the resources consumed by this instruction. - for (const std::pair Resource : Desc.Resources) { + for (const std::pair Resource : + Desc.Resources) { // Skip zero-cycle resources (i.e., unused resources). if (!Resource.second.size()) continue; diff --git a/llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp b/llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp --- a/llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp +++ b/llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp @@ -421,7 +421,7 @@ for (const auto &LC : Lines.Blocks) { Result->createBlock(LC.FileName); if (Result->hasColumnInfo()) { - for (const auto &Item : zip(LC.Lines, LC.Columns)) { + for (auto Item : zip(LC.Lines, LC.Columns)) { auto &L = std::get<0>(Item); auto &C = std::get<1>(Item); uint32_t LE = L.LineStart + L.EndDelta; diff --git a/llvm/lib/Support/CommandLine.cpp b/llvm/lib/Support/CommandLine.cpp --- a/llvm/lib/Support/CommandLine.cpp +++ b/llvm/lib/Support/CommandLine.cpp @@ -187,7 +187,7 @@ // If we're adding this to all sub-commands, add it to the ones that have // already been registered. if (SC == &*AllSubCommands) { - for (const auto &Sub : RegisteredSubCommands) { + for (auto *Sub : RegisteredSubCommands) { if (SC == Sub) continue; addLiteralOption(Opt, Sub, Name); @@ -243,7 +243,7 @@ // If we're adding this to all sub-commands, add it to the ones that have // already been registered. if (SC == &*AllSubCommands) { - for (const auto &Sub : RegisteredSubCommands) { + for (auto *Sub : RegisteredSubCommands) { if (SC == Sub) continue; addOption(O, Sub); @@ -318,7 +318,7 @@ } bool hasOptions() const { - for (const auto &S : RegisteredSubCommands) { + for (const auto *S : RegisteredSubCommands) { if (hasOptions(*S)) return true; } @@ -2112,7 +2112,7 @@ static void sortSubCommands(const SmallPtrSetImpl &SubMap, SmallVectorImpl> &Subs) { - for (const auto &S : SubMap) { + for (auto *S : SubMap) { if (S->getName().empty()) continue; Subs.push_back(std::make_pair(S->getName().data(), S)); diff --git a/llvm/lib/Support/TargetParser.cpp b/llvm/lib/Support/TargetParser.cpp --- a/llvm/lib/Support/TargetParser.cpp +++ b/llvm/lib/Support/TargetParser.cpp @@ -132,7 +132,7 @@ } AMDGPU::GPUKind llvm::AMDGPU::parseArchAMDGCN(StringRef CPU) { - for (const auto C : AMDGCNGPUs) { + for (const auto &C : AMDGCNGPUs) { if (CPU == C.Name) return C.Kind; } @@ -141,7 +141,7 @@ } AMDGPU::GPUKind llvm::AMDGPU::parseArchR600(StringRef CPU) { - for (const auto C : R600GPUs) { + for (const auto &C : R600GPUs) { if (CPU == C.Name) return C.Kind; } @@ -163,12 +163,12 @@ void AMDGPU::fillValidArchListAMDGCN(SmallVectorImpl &Values) { // XXX: Should this only report unique canonical names? - for (const auto C : AMDGCNGPUs) + for (const auto &C : AMDGCNGPUs) Values.push_back(C.Name); } void AMDGPU::fillValidArchListR600(SmallVectorImpl &Values) { - for (const auto C : R600GPUs) + for (const auto &C : R600GPUs) Values.push_back(C.Name); }