[lld] Use range-based for loops (NFC) (#144251)

This commit is contained in:
Kazu Hirata
2025-06-15 10:32:45 -07:00
committed by GitHub
parent fef5df9d84
commit d78eec864c
4 changed files with 10 additions and 13 deletions

View File

@@ -1317,11 +1317,11 @@ void elf::processArmCmseSymbols(Ctx &ctx) {
// with its corresponding special symbol __acle_se_<sym>.
parallelForEach(ctx.objectFiles, [&](InputFile *file) {
MutableArrayRef<Symbol *> syms = file->getMutableSymbols();
for (size_t i = 0, e = syms.size(); i != e; ++i) {
StringRef symName = syms[i]->getName();
for (Symbol *&sym : syms) {
StringRef symName = sym->getName();
auto it = ctx.symtab->cmseSymMap.find(symName);
if (it != ctx.symtab->cmseSymMap.end())
syms[i] = it->second.acleSeSym;
sym = it->second.acleSeSym;
}
});
}

View File

@@ -4026,10 +4026,9 @@ void MergeNoTailSection::finalizeContents() {
// So far, section pieces have offsets from beginning of shards, but
// we want offsets from beginning of the whole section. Fix them.
parallelForEach(sections, [&](MergeInputSection *sec) {
for (size_t i = 0, e = sec->pieces.size(); i != e; ++i)
if (sec->pieces[i].live)
sec->pieces[i].outputOff +=
shardOffsets[getShardId(sec->pieces[i].hash)];
for (SectionPiece &piece : sec->pieces)
if (piece.live)
piece.outputOff += shardOffsets[getShardId(piece.hash)];
});
}

View File

@@ -947,9 +947,7 @@ uint64_t ObjCStubsSection::getSize() const {
void ObjCStubsSection::writeTo(uint8_t *buf) const {
uint64_t stubOffset = 0;
for (size_t i = 0, n = symbols.size(); i < n; ++i) {
Defined *sym = symbols[i];
for (Defined *sym : symbols) {
auto methname = getMethname(sym);
InputSection *selRef = ObjCSelRefsHelper::getSelRef(methname);
assert(selRef != nullptr && "no selref for methname");

View File

@@ -1226,9 +1226,9 @@ static void wrapSymbols(ArrayRef<WrappedSymbol> wrapped) {
// Update pointers in input files.
parallelForEach(ctx.objectFiles, [&](InputFile *file) {
MutableArrayRef<Symbol *> syms = file->getMutableSymbols();
for (size_t i = 0, e = syms.size(); i != e; ++i)
if (Symbol *s = map.lookup(syms[i]))
syms[i] = s;
for (Symbol *&sym : syms)
if (Symbol *s = map.lookup(sym))
sym = s;
});
// Update pointers in the symbol table.