[llvm-branch-commits] [lld] 69e0bc7 - [COFF] Use range for on relocations, NFC

Reid Kleckner via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jan 20 11:07:00 PST 2021


Author: Reid Kleckner
Date: 2021-01-20T11:01:33-08:00
New Revision: 69e0bc77a5d74a5f0e57ad3e7a22ce4fba210b85

URL: https://github.com/llvm/llvm-project/commit/69e0bc77a5d74a5f0e57ad3e7a22ce4fba210b85
DIFF: https://github.com/llvm/llvm-project/commit/69e0bc77a5d74a5f0e57ad3e7a22ce4fba210b85.diff

LOG: [COFF] Use range for on relocations, NFC

Added: 
    

Modified: 
    lld/COFF/Chunks.cpp

Removed: 
    


################################################################################
diff  --git a/lld/COFF/Chunks.cpp b/lld/COFF/Chunks.cpp
index e04ceed505c2..9d60bc746c96 100644
--- a/lld/COFF/Chunks.cpp
+++ b/lld/COFF/Chunks.cpp
@@ -357,9 +357,7 @@ void SectionChunk::writeTo(uint8_t *buf) const {
 
   // Apply relocations.
   size_t inputSize = getSize();
-  for (size_t i = 0, e = relocsSize; i < e; i++) {
-    const coff_relocation &rel = relocsData[i];
-
+  for (const coff_relocation &rel : getRelocs()) {
     // Check for an invalid relocation offset. This check isn't perfect, because
     // we don't have the relocation size, which is only known after checking the
     // machine and relocation type. As a result, a relocation may overwrite the
@@ -451,8 +449,7 @@ static uint8_t getBaserelType(const coff_relocation &rel) {
 // fixed by the loader if load-time relocation is needed.
 // Only called when base relocation is enabled.
 void SectionChunk::getBaserels(std::vector<Baserel> *res) {
-  for (size_t i = 0, e = relocsSize; i < e; i++) {
-    const coff_relocation &rel = relocsData[i];
+  for (const coff_relocation &rel : getRelocs()) {
     uint8_t ty = getBaserelType(rel);
     if (ty == IMAGE_REL_BASED_ABSOLUTE)
       continue;


        


More information about the llvm-branch-commits mailing list