[lld/mac] Make two local variables const
authorNico Weber <thakis@chromium.org>
Thu, 13 Oct 2022 14:36:08 +0000 (10:36 -0400)
committerNico Weber <thakis@chromium.org>
Thu, 13 Oct 2022 16:02:51 +0000 (12:02 -0400)
While reading this code, I was wondering if we change these variables in the
loop. We don't, so make them const to make this easier to see next time.

No behavior change.

Differential Revision: https://reviews.llvm.org/D135877

lld/MachO/InputFiles.cpp

index ee382a5..9c2051e 100644 (file)
@@ -807,7 +807,7 @@ void ObjFile::parseSymbols(ArrayRef<typename LP::section> sectionHeaders,
     // subsection here.
     if (sections[i]->doneSplitting) {
       for (size_t j = 0; j < symbolIndices.size(); ++j) {
-        uint32_t symIndex = symbolIndices[j];
+        const uint32_t symIndex = symbolIndices[j];
         const NList &sym = nList[symIndex];
         StringRef name = strtab + sym.n_strx;
         uint64_t symbolOffset = sym.n_value - sectionAddr;
@@ -833,7 +833,7 @@ void ObjFile::parseSymbols(ArrayRef<typename LP::section> sectionHeaders,
       return nList[lhs].n_value < nList[rhs].n_value;
     });
     for (size_t j = 0; j < symbolIndices.size(); ++j) {
-      uint32_t symIndex = symbolIndices[j];
+      const uint32_t symIndex = symbolIndices[j];
       const NList &sym = nList[symIndex];
       StringRef name = strtab + sym.n_strx;
       Subsection &subsec = subsections.back();