Skip to content

Commit 8dc7b98

Browse files
committed
[NFC] Fixes -Wrange-loop-analysis warnings
This avoids new warnings due to D68912 adds -Wrange-loop-analysis to -Wall. Differential Revision: https://reviews.llvm.org/D71857
1 parent 9b24dad commit 8dc7b98

37 files changed

+55
-54
lines changed

clang-tools-extra/clang-doc/MDGenerator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ static void genMarkdown(const RecordInfo &I, llvm::raw_ostream &OS) {
215215

216216
if (!I.Members.empty()) {
217217
writeHeader("Members", 2, OS);
218-
for (const auto Member : I.Members) {
218+
for (const auto &Member : I.Members) {
219219
std::string Access = getAccess(Member.Access);
220220
if (Access != "")
221221
writeLine(Access + " " + Member.Type.Name + " " + Member.Name, OS);

clang-tools-extra/clang-tidy/cppcoreguidelines/SlicingCheck.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ void SlicingCheck::DiagnoseSlicedOverriddenMethods(
7575
const CXXRecordDecl &BaseDecl) {
7676
if (DerivedDecl.getCanonicalDecl() == BaseDecl.getCanonicalDecl())
7777
return;
78-
for (const auto &Method : DerivedDecl.methods()) {
78+
for (const auto *Method : DerivedDecl.methods()) {
7979
// Virtual destructors are OK. We're ignoring constructors since they are
8080
// tagged as overrides.
8181
if (isa<CXXConstructorDecl>(Method) || isa<CXXDestructorDecl>(Method))

clang-tools-extra/clang-tidy/readability/IdentifierNamingCheck.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ void IdentifierNamingCheck::check(const MatchFinder::MatchResult &Result) {
792792
}
793793

794794
if (const auto *Decl = Result.Nodes.getNodeAs<UsingDecl>("using")) {
795-
for (const auto &Shadow : Decl->shadows()) {
795+
for (const auto *Shadow : Decl->shadows()) {
796796
addUsage(NamingCheckFailures, Shadow->getTargetDecl(),
797797
Decl->getNameInfo().getSourceRange());
798798
}

clang-tools-extra/clang-tidy/utils/DeclRefExprUtils.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ using llvm::SmallPtrSet;
2323
namespace {
2424

2525
template <typename S> bool isSetDifferenceEmpty(const S &S1, const S &S2) {
26-
for (const auto &E : S1)
26+
for (auto E : S1)
2727
if (S2.count(E) == 0)
2828
return false;
2929
return true;

clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ ExceptionAnalyzer::ExceptionInfo ExceptionAnalyzer::throwsException(
125125

126126
auto Result = ExceptionInfo::createUnknown();
127127
if (const auto *FPT = Func->getType()->getAs<FunctionProtoType>()) {
128-
for (const QualType Ex : FPT->exceptions())
128+
for (const QualType &Ex : FPT->exceptions())
129129
Result.registerException(Ex.getTypePtr());
130130
}
131131
return Result;

clang-tools-extra/clangd/index/MemIndex.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ bool MemIndex::fuzzyFind(
3636
Req.Limit ? *Req.Limit : std::numeric_limits<size_t>::max());
3737
FuzzyMatcher Filter(Req.Query);
3838
bool More = false;
39-
for (const auto Pair : Index) {
39+
for (const auto &Pair : Index) {
4040
const Symbol *Sym = Pair.second;
4141

4242
// Exact match against all possible scopes.

clang/lib/CodeGen/CodeGenPGO.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ struct MapRegionCounters : public RecursiveASTVisitor<MapRegionCounters> {
167167
bool TraverseBlockExpr(BlockExpr *BE) { return true; }
168168
bool TraverseLambdaExpr(LambdaExpr *LE) {
169169
// Traverse the captures, but not the body.
170-
for (const auto &C : zip(LE->captures(), LE->capture_inits()))
170+
for (auto C : zip(LE->captures(), LE->capture_inits()))
171171
TraverseLambdaCapture(LE, &std::get<0>(C), std::get<1>(C));
172172
return true;
173173
}

clang/lib/CodeGen/ItaniumCXXABI.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2423,7 +2423,7 @@ static void emitGlobalDtorWithCXAAtExit(CodeGenFunction &CGF,
24232423
}
24242424

24252425
void CodeGenModule::registerGlobalDtorsWithAtExit() {
2426-
for (const auto I : DtorsUsingAtExit) {
2426+
for (const auto &I : DtorsUsingAtExit) {
24272427
int Priority = I.first;
24282428
const llvm::TinyPtrVector<llvm::Function *> &Dtors = I.second;
24292429

clang/lib/StaticAnalyzer/Checkers/MoveChecker.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ void MoveChecker::checkDeadSymbols(SymbolReaper &SymReaper,
686686
CheckerContext &C) const {
687687
ProgramStateRef State = C.getState();
688688
TrackedRegionMapTy TrackedRegions = State->get<TrackedRegionMap>();
689-
for (const auto &E : TrackedRegions) {
689+
for (auto E : TrackedRegions) {
690690
const MemRegion *Region = E.first;
691691
bool IsRegDead = !SymReaper.isLiveRegion(Region);
692692

clang/lib/Tooling/ASTDiff/ASTDiff.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ void ASTDiff::Impl::addOptimalMapping(Mapping &M, NodeId Id1,
787787
return;
788788
ZhangShashaMatcher Matcher(*this, T1, T2, Id1, Id2);
789789
std::vector<std::pair<NodeId, NodeId>> R = Matcher.getMatchingNodes();
790-
for (const auto Tuple : R) {
790+
for (const auto &Tuple : R) {
791791
NodeId Src = Tuple.first;
792792
NodeId Dst = Tuple.second;
793793
if (!M.hasSrc(Src) && !M.hasDst(Dst))

clang/tools/clang-refactor/TestSupport.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ bool areChangesSame(const tooling::AtomicChanges &LHS,
7474
const tooling::AtomicChanges &RHS) {
7575
if (LHS.size() != RHS.size())
7676
return false;
77-
for (const auto &I : llvm::zip(LHS, RHS)) {
77+
for (auto I : llvm::zip(LHS, RHS)) {
7878
if (!(std::get<0>(I) == std::get<1>(I)))
7979
return false;
8080
}

lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ bool isRSAllocationTyCallSite(llvm::Module &module, llvm::CallInst *call_inst) {
7272
(void)module;
7373
if (!call_inst->hasByValArgument())
7474
return false;
75-
for (const auto &param : call_inst->operand_values())
75+
for (const auto *param : call_inst->operand_values())
7676
if (isRSAllocationPtrTy(param->getType()))
7777
return true;
7878
return false;

lldb/source/Plugins/Platform/Android/AdbClient.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ Status AdbClient::GetDevices(DeviceIDList &device_list) {
165165
llvm::SmallVector<llvm::StringRef, 4> devices;
166166
response.split(devices, "\n", -1, false);
167167

168-
for (const auto device : devices)
168+
for (const auto &device : devices)
169169
device_list.push_back(device.split('\t').first);
170170

171171
// Force disconnect since ADB closes connection after host:devices response

lldb/source/Target/StackFrameRecognizer.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ ScriptedStackFrameRecognizer::RecognizeFrame(lldb::StackFrameSP frame) {
3939
ValueObjectListSP args =
4040
m_interpreter->GetRecognizedArguments(m_python_object_sp, frame);
4141
auto args_synthesized = ValueObjectListSP(new ValueObjectList());
42-
for (const auto o : args->GetObjects()) {
42+
for (const auto &o : args->GetObjects()) {
4343
args_synthesized->Append(ValueObjectRecognizerSynthesizedValue::Create(
4444
*o, eValueTypeVariableArgument));
4545
}

llvm/include/llvm/Analysis/LoopInfo.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ template <class BlockT, class LoopT> class LoopBase {
208208
bool isLoopExiting(const BlockT *BB) const {
209209
assert(!isInvalid() && "Loop not in a valid state!");
210210
assert(contains(BB) && "Exiting block must be part of the loop");
211-
for (const auto &Succ : children<const BlockT *>(BB)) {
211+
for (const auto *Succ : children<const BlockT *>(BB)) {
212212
if (!contains(Succ))
213213
return true;
214214
}

llvm/include/llvm/Analysis/LoopInfoImpl.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ void LoopBase<BlockT, LoopT>::getExitingBlocks(
3535
SmallVectorImpl<BlockT *> &ExitingBlocks) const {
3636
assert(!isInvalid() && "Loop not in a valid state!");
3737
for (const auto BB : blocks())
38-
for (const auto &Succ : children<BlockT *>(BB))
38+
for (auto *Succ : children<BlockT *>(BB))
3939
if (!contains(Succ)) {
4040
// Not in current loop? It must be an exit block.
4141
ExitingBlocks.push_back(BB);
@@ -63,7 +63,7 @@ void LoopBase<BlockT, LoopT>::getExitBlocks(
6363
SmallVectorImpl<BlockT *> &ExitBlocks) const {
6464
assert(!isInvalid() && "Loop not in a valid state!");
6565
for (const auto BB : blocks())
66-
for (const auto &Succ : children<BlockT *>(BB))
66+
for (auto *Succ : children<BlockT *>(BB))
6767
if (!contains(Succ))
6868
// Not in current loop? It must be an exit block.
6969
ExitBlocks.push_back(Succ);
@@ -142,7 +142,7 @@ void LoopBase<BlockT, LoopT>::getExitEdges(
142142
SmallVectorImpl<Edge> &ExitEdges) const {
143143
assert(!isInvalid() && "Loop not in a valid state!");
144144
for (const auto BB : blocks())
145-
for (const auto &Succ : children<BlockT *>(BB))
145+
for (auto *Succ : children<BlockT *>(BB))
146146
if (!contains(Succ))
147147
// Not in current loop? It must be an exit block.
148148
ExitEdges.emplace_back(BB, Succ);

llvm/include/llvm/Support/GenericDomTree.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -778,13 +778,13 @@ class DominatorTreeBase {
778778
NodeRef NewBBSucc = *GraphT::child_begin(NewBB);
779779

780780
std::vector<NodeRef> PredBlocks;
781-
for (const auto &Pred : children<Inverse<N>>(NewBB))
781+
for (auto Pred : children<Inverse<N>>(NewBB))
782782
PredBlocks.push_back(Pred);
783783

784784
assert(!PredBlocks.empty() && "No predblocks?");
785785

786786
bool NewBBDominatesNewBBSucc = true;
787-
for (const auto &Pred : children<Inverse<N>>(NewBBSucc)) {
787+
for (auto Pred : children<Inverse<N>>(NewBBSucc)) {
788788
if (Pred != NewBB && !dominates(NewBBSucc, Pred) &&
789789
isReachableFromEntry(Pred)) {
790790
NewBBDominatesNewBBSucc = false;

llvm/lib/Analysis/DomTreeUpdater.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ void DomTreeUpdater::applyUpdates(ArrayRef<DominatorTree::UpdateType> Updates) {
233233
return;
234234

235235
if (Strategy == UpdateStrategy::Lazy) {
236-
for (const auto U : Updates)
236+
for (const auto &U : Updates)
237237
if (!isSelfDominance(U))
238238
PendUpdates.push_back(U);
239239

@@ -253,7 +253,7 @@ void DomTreeUpdater::applyUpdatesPermissive(
253253

254254
SmallSet<std::pair<BasicBlock *, BasicBlock *>, 8> Seen;
255255
SmallVector<DominatorTree::UpdateType, 8> DeduplicatedUpdates;
256-
for (const auto U : Updates) {
256+
for (const auto &U : Updates) {
257257
auto Edge = std::make_pair(U.getFrom(), U.getTo());
258258
// Because it is illegal to submit updates that have already been applied
259259
// and updates to an edge need to be strictly ordered,

llvm/lib/Analysis/MemoryDependenceAnalysis.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1494,7 +1494,7 @@ void MemoryDependenceResults::RemoveCachedNonLocalPointerDependencies(
14941494
if (auto *I = dyn_cast<Instruction>(P.getPointer())) {
14951495
auto toRemoveIt = ReverseNonLocalDefsCache.find(I);
14961496
if (toRemoveIt != ReverseNonLocalDefsCache.end()) {
1497-
for (const auto &entry : toRemoveIt->second)
1497+
for (const auto *entry : toRemoveIt->second)
14981498
NonLocalDefsCache.erase(entry);
14991499
ReverseNonLocalDefsCache.erase(toRemoveIt);
15001500
}

llvm/lib/Analysis/ScalarEvolution.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -12527,7 +12527,7 @@ PredicatedScalarEvolution::PredicatedScalarEvolution(
1252712527
const PredicatedScalarEvolution &Init)
1252812528
: RewriteMap(Init.RewriteMap), SE(Init.SE), L(Init.L), Preds(Init.Preds),
1252912529
Generation(Init.Generation), BackedgeCount(Init.BackedgeCount) {
12530-
for (const auto &I : Init.FlagsMap)
12530+
for (auto I : Init.FlagsMap)
1253112531
FlagsMap.insert(I);
1253212532
}
1253312533

llvm/lib/CodeGen/InlineSpiller.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -1427,7 +1427,7 @@ void HoistSpillHelper::runHoistSpills(
14271427
}
14281428
// For spills in SpillsToKeep with LiveReg set (i.e., not original spill),
14291429
// save them to SpillsToIns.
1430-
for (const auto Ent : SpillsToKeep) {
1430+
for (const auto &Ent : SpillsToKeep) {
14311431
if (Ent.second)
14321432
SpillsToIns[Ent.first->getBlock()] = Ent.second;
14331433
}
@@ -1486,7 +1486,7 @@ void HoistSpillHelper::hoistAllSpills() {
14861486

14871487
LLVM_DEBUG({
14881488
dbgs() << "Finally inserted spills in BB: ";
1489-
for (const auto Ispill : SpillsToIns)
1489+
for (const auto &Ispill : SpillsToIns)
14901490
dbgs() << Ispill.first->getNumber() << " ";
14911491
dbgs() << "\nFinally removed spills in BB: ";
14921492
for (const auto Rspill : SpillsToRm)
@@ -1501,7 +1501,7 @@ void HoistSpillHelper::hoistAllSpills() {
15011501
StackIntvl.getValNumInfo(0));
15021502

15031503
// Insert hoisted spills.
1504-
for (auto const Insert : SpillsToIns) {
1504+
for (auto const &Insert : SpillsToIns) {
15051505
MachineBasicBlock *BB = Insert.first;
15061506
unsigned LiveReg = Insert.second;
15071507
MachineBasicBlock::iterator MI = IPA.getLastInsertPointIter(OrigLI, *BB);

llvm/lib/CodeGen/InterleavedLoadCombinePass.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1168,7 +1168,7 @@ bool InterleavedLoadCombineImpl::combine(std::list<VectorInfo> &InterleavedLoad,
11681168

11691169
// If there are users outside the set to be eliminated, we abort the
11701170
// transformation. No gain can be expected.
1171-
for (const auto &U : I->users()) {
1171+
for (auto *U : I->users()) {
11721172
if (Is.find(dyn_cast<Instruction>(U)) == Is.end())
11731173
return false;
11741174
}

llvm/lib/CodeGen/RegAllocFast.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,7 @@ void RegAllocFast::allocateBasicBlock(MachineBasicBlock &MBB) {
12531253
MachineBasicBlock::iterator MII = MBB.begin();
12541254

12551255
// Add live-in registers as live.
1256-
for (const MachineBasicBlock::RegisterMaskPair LI : MBB.liveins())
1256+
for (const MachineBasicBlock::RegisterMaskPair &LI : MBB.liveins())
12571257
if (MRI->isAllocatable(LI.PhysReg))
12581258
definePhysReg(MII, LI.PhysReg, regReserved);
12591259

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -3038,7 +3038,7 @@ static bool isVectorReductionOp(const User *I) {
30383038
if (!Visited.insert(User).second)
30393039
continue;
30403040

3041-
for (const auto &U : User->users()) {
3041+
for (const auto *U : User->users()) {
30423042
auto Inst = dyn_cast<Instruction>(U);
30433043
if (!Inst)
30443044
return false;

llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ void TargetLoweringObjectFileELF::emitModuleMetadata(MCStreamer &Streamer,
273273

274274
Streamer.SwitchSection(S);
275275

276-
for (const auto &Operand : LinkerOptions->operands()) {
276+
for (const auto *Operand : LinkerOptions->operands()) {
277277
if (cast<MDNode>(Operand)->getNumOperands() != 2)
278278
report_fatal_error("invalid llvm.linker.options");
279279
for (const auto &Option : cast<MDNode>(Operand)->operands()) {
@@ -289,7 +289,7 @@ void TargetLoweringObjectFileELF::emitModuleMetadata(MCStreamer &Streamer,
289289

290290
Streamer.SwitchSection(S);
291291

292-
for (const auto &Operand : DependentLibraries->operands()) {
292+
for (const auto *Operand : DependentLibraries->operands()) {
293293
Streamer.EmitBytes(
294294
cast<MDString>(cast<MDNode>(Operand)->getOperand(0))->getString());
295295
Streamer.EmitIntValue(0, 1);
@@ -885,7 +885,7 @@ void TargetLoweringObjectFileMachO::emitModuleMetadata(MCStreamer &Streamer,
885885
Module &M) const {
886886
// Emit the linker options if present.
887887
if (auto *LinkerOptions = M.getNamedMetadata("llvm.linker.options")) {
888-
for (const auto &Option : LinkerOptions->operands()) {
888+
for (const auto *Option : LinkerOptions->operands()) {
889889
SmallVector<std::string, 4> StrOptions;
890890
for (const auto &Piece : cast<MDNode>(Option)->operands())
891891
StrOptions.push_back(cast<MDString>(Piece)->getString());
@@ -1449,7 +1449,7 @@ void TargetLoweringObjectFileCOFF::emitModuleMetadata(MCStreamer &Streamer,
14491449
// linker.
14501450
MCSection *Sec = getDrectveSection();
14511451
Streamer.SwitchSection(Sec);
1452-
for (const auto &Option : LinkerOptions->operands()) {
1452+
for (const auto *Option : LinkerOptions->operands()) {
14531453
for (const auto &Piece : cast<MDNode>(Option)->operands()) {
14541454
// Lead with a space for consistency with our dllexport implementation.
14551455
std::string Directive(" ");

llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ Optional<DWARFFormValue>
277277
AppleAcceleratorTable::Entry::lookup(HeaderData::AtomType Atom) const {
278278
assert(HdrData && "Dereferencing end iterator?");
279279
assert(HdrData->Atoms.size() == Values.size());
280-
for (const auto &Tuple : zip_first(HdrData->Atoms, Values)) {
280+
for (auto Tuple : zip_first(HdrData->Atoms, Values)) {
281281
if (std::get<0>(Tuple).first == Atom)
282282
return std::get<1>(Tuple);
283283
}
@@ -531,7 +531,7 @@ DWARFDebugNames::Entry::Entry(const NameIndex &NameIdx, const Abbrev &Abbr)
531531
Optional<DWARFFormValue>
532532
DWARFDebugNames::Entry::lookup(dwarf::Index Index) const {
533533
assert(Abbr->Attributes.size() == Values.size());
534-
for (const auto &Tuple : zip_first(Abbr->Attributes, Values)) {
534+
for (auto Tuple : zip_first(Abbr->Attributes, Values)) {
535535
if (std::get<0>(Tuple).Index == Index)
536536
return std::get<1>(Tuple);
537537
}
@@ -565,7 +565,7 @@ void DWARFDebugNames::Entry::dump(ScopedPrinter &W) const {
565565
W.printHex("Abbrev", Abbr->Code);
566566
W.startLine() << formatv("Tag: {0}\n", Abbr->Tag);
567567
assert(Abbr->Attributes.size() == Values.size());
568-
for (const auto &Tuple : zip_first(Abbr->Attributes, Values)) {
568+
for (auto Tuple : zip_first(Abbr->Attributes, Values)) {
569569
W.startLine() << formatv("{0}: ", std::get<0>(Tuple).Index);
570570
std::get<1>(Tuple).dump(W.getOStream());
571571
W.getOStream() << '\n';

llvm/lib/DebugInfo/DWARF/DWARFVerifier.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ unsigned DWARFVerifier::verifyDebugInfoReferences() {
642642
// getting the DIE by offset and emitting an error
643643
OS << "Verifying .debug_info references...\n";
644644
unsigned NumErrors = 0;
645-
for (const std::pair<uint64_t, std::set<uint64_t>> &Pair :
645+
for (const std::pair<const uint64_t, std::set<uint64_t>> &Pair :
646646
ReferenceToDIEOffsets) {
647647
if (DCtx.getDIEForOffset(Pair.first))
648648
continue;

llvm/lib/DebugInfo/Symbolize/Symbolize.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ Optional<ArrayRef<uint8_t>> getBuildID(const ELFFile<ELFT> *Obj) {
297297
if (P.p_type != ELF::PT_NOTE)
298298
continue;
299299
Error Err = Error::success();
300-
for (const auto &N : Obj->notes(P, Err))
300+
for (auto N : Obj->notes(P, Err))
301301
if (N.getType() == ELF::NT_GNU_BUILD_ID && N.getName() == ELF::ELF_NOTE_GNU)
302302
return N.getDesc();
303303
}

llvm/lib/ExecutionEngine/Orc/ExecutionUtils.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ void CtorDtorRunner::add(iterator_range<CtorDtorIterator> CtorDtors) {
121121
JD.getExecutionSession(),
122122
(*CtorDtors.begin()).Func->getParent()->getDataLayout());
123123

124-
for (const auto &CtorDtor : CtorDtors) {
124+
for (auto CtorDtor : CtorDtors) {
125125
assert(CtorDtor.Func && CtorDtor.Func->hasName() &&
126126
"Ctor/Dtor function must be named to be runnable under the JIT");
127127

llvm/lib/IR/TypeFinder.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void TypeFinder::run(const Module &M, bool onlyNamed) {
7777
}
7878

7979
for (const auto &NMD : M.named_metadata())
80-
for (const auto &MDOp : NMD.operands())
80+
for (const auto *MDOp : NMD.operands())
8181
incorporateMDNode(MDOp);
8282
}
8383

llvm/lib/Linker/IRMover.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ Error IRLinker::linkGlobalValueBody(GlobalValue &Dst, GlobalValue &Src) {
10991099
}
11001100

11011101
void IRLinker::flushRAUWWorklist() {
1102-
for (const auto Elem : RAUWWorklist) {
1102+
for (const auto &Elem : RAUWWorklist) {
11031103
GlobalValue *Old;
11041104
Value *New;
11051105
std::tie(Old, New) = Elem;

llvm/lib/MC/XCOFFObjectWriter.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ void XCOFFObjectWriter::writeSymbolTable(const MCAsmLayout &Layout) {
570570
writeSymbolTableEntryForControlSection(
571571
Csect, SectionIndex, Csect.MCCsect->getStorageClass());
572572

573-
for (const auto Sym : Csect.Syms)
573+
for (const auto &Sym : Csect.Syms)
574574
writeSymbolTableEntryForCsectMemberLabel(
575575
Sym, Csect, SectionIndex, Layout.getSymbolOffset(*(Sym.MCSym)));
576576
}

llvm/lib/MCA/HardwareUnits/ResourceManager.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ void ResourceManager::releaseBuffers(uint64_t ConsumedBuffers) {
281281

282282
uint64_t ResourceManager::checkAvailability(const InstrDesc &Desc) const {
283283
uint64_t BusyResourceMask = 0;
284-
for (const std::pair<uint64_t, const ResourceUsage> &E : Desc.Resources) {
284+
for (const std::pair<uint64_t, ResourceUsage> &E : Desc.Resources) {
285285
unsigned NumUnits = E.second.isReserved() ? 0U : E.second.NumUnits;
286286
unsigned Index = getResourceStateIndex(E.first);
287287
if (!Resources[Index]->isReady(NumUnits))

0 commit comments

Comments
 (0)