Skip to content

Commit 69e0bc7

Browse files
committed
[COFF] Use range for on relocations, NFC
1 parent 16d6e85 commit 69e0bc7

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lld/COFF/Chunks.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,7 @@ void SectionChunk::writeTo(uint8_t *buf) const {
357357

358358
// Apply relocations.
359359
size_t inputSize = getSize();
360-
for (size_t i = 0, e = relocsSize; i < e; i++) {
361-
const coff_relocation &rel = relocsData[i];
362-
360+
for (const coff_relocation &rel : getRelocs()) {
363361
// Check for an invalid relocation offset. This check isn't perfect, because
364362
// we don't have the relocation size, which is only known after checking the
365363
// machine and relocation type. As a result, a relocation may overwrite the
@@ -451,8 +449,7 @@ static uint8_t getBaserelType(const coff_relocation &rel) {
451449
// fixed by the loader if load-time relocation is needed.
452450
// Only called when base relocation is enabled.
453451
void SectionChunk::getBaserels(std::vector<Baserel> *res) {
454-
for (size_t i = 0, e = relocsSize; i < e; i++) {
455-
const coff_relocation &rel = relocsData[i];
452+
for (const coff_relocation &rel : getRelocs()) {
456453
uint8_t ty = getBaserelType(rel);
457454
if (ty == IMAGE_REL_BASED_ABSOLUTE)
458455
continue;

0 commit comments

Comments
 (0)