[lld] Use range-based for loops (NFC) (#144251)
This commit is contained in:
@@ -1317,11 +1317,11 @@ void elf::processArmCmseSymbols(Ctx &ctx) {
|
|||||||
// with its corresponding special symbol __acle_se_<sym>.
|
// with its corresponding special symbol __acle_se_<sym>.
|
||||||
parallelForEach(ctx.objectFiles, [&](InputFile *file) {
|
parallelForEach(ctx.objectFiles, [&](InputFile *file) {
|
||||||
MutableArrayRef<Symbol *> syms = file->getMutableSymbols();
|
MutableArrayRef<Symbol *> syms = file->getMutableSymbols();
|
||||||
for (size_t i = 0, e = syms.size(); i != e; ++i) {
|
for (Symbol *&sym : syms) {
|
||||||
StringRef symName = syms[i]->getName();
|
StringRef symName = sym->getName();
|
||||||
auto it = ctx.symtab->cmseSymMap.find(symName);
|
auto it = ctx.symtab->cmseSymMap.find(symName);
|
||||||
if (it != ctx.symtab->cmseSymMap.end())
|
if (it != ctx.symtab->cmseSymMap.end())
|
||||||
syms[i] = it->second.acleSeSym;
|
sym = it->second.acleSeSym;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4026,10 +4026,9 @@ void MergeNoTailSection::finalizeContents() {
|
|||||||
// So far, section pieces have offsets from beginning of shards, but
|
// So far, section pieces have offsets from beginning of shards, but
|
||||||
// we want offsets from beginning of the whole section. Fix them.
|
// we want offsets from beginning of the whole section. Fix them.
|
||||||
parallelForEach(sections, [&](MergeInputSection *sec) {
|
parallelForEach(sections, [&](MergeInputSection *sec) {
|
||||||
for (size_t i = 0, e = sec->pieces.size(); i != e; ++i)
|
for (SectionPiece &piece : sec->pieces)
|
||||||
if (sec->pieces[i].live)
|
if (piece.live)
|
||||||
sec->pieces[i].outputOff +=
|
piece.outputOff += shardOffsets[getShardId(piece.hash)];
|
||||||
shardOffsets[getShardId(sec->pieces[i].hash)];
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -947,9 +947,7 @@ uint64_t ObjCStubsSection::getSize() const {
|
|||||||
|
|
||||||
void ObjCStubsSection::writeTo(uint8_t *buf) const {
|
void ObjCStubsSection::writeTo(uint8_t *buf) const {
|
||||||
uint64_t stubOffset = 0;
|
uint64_t stubOffset = 0;
|
||||||
for (size_t i = 0, n = symbols.size(); i < n; ++i) {
|
for (Defined *sym : symbols) {
|
||||||
Defined *sym = symbols[i];
|
|
||||||
|
|
||||||
auto methname = getMethname(sym);
|
auto methname = getMethname(sym);
|
||||||
InputSection *selRef = ObjCSelRefsHelper::getSelRef(methname);
|
InputSection *selRef = ObjCSelRefsHelper::getSelRef(methname);
|
||||||
assert(selRef != nullptr && "no selref for methname");
|
assert(selRef != nullptr && "no selref for methname");
|
||||||
|
|||||||
@@ -1226,9 +1226,9 @@ static void wrapSymbols(ArrayRef<WrappedSymbol> wrapped) {
|
|||||||
// Update pointers in input files.
|
// Update pointers in input files.
|
||||||
parallelForEach(ctx.objectFiles, [&](InputFile *file) {
|
parallelForEach(ctx.objectFiles, [&](InputFile *file) {
|
||||||
MutableArrayRef<Symbol *> syms = file->getMutableSymbols();
|
MutableArrayRef<Symbol *> syms = file->getMutableSymbols();
|
||||||
for (size_t i = 0, e = syms.size(); i != e; ++i)
|
for (Symbol *&sym : syms)
|
||||||
if (Symbol *s = map.lookup(syms[i]))
|
if (Symbol *s = map.lookup(sym))
|
||||||
syms[i] = s;
|
sym = s;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update pointers in the symbol table.
|
// Update pointers in the symbol table.
|
||||||
|
|||||||
Reference in New Issue
Block a user