Fix cppcheck shadow variable warning. NFC.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 18 Nov 2019 13:57:20 +0000 (13:57 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Mon, 18 Nov 2019 13:57:34 +0000 (13:57 +0000)
llvm/tools/llvm-objcopy/ELF/Object.cpp

index dc2c7c8fa8b6c6c9709ac41e10381795b9cd90ba..a1073fe9dcb817a2095087c5918564c4c09ad179 100644 (file)
@@ -2003,11 +2003,11 @@ static uint64_t layoutSegmentsForOnlyKeepDebug(std::vector<Segment *> &Segments,
                                                uint64_t HdrEnd) {
   uint64_t MaxOffset = 0;
   for (Segment *Seg : Segments) {
-    const SectionBase *Sec = Seg->firstSection();
-    if (Seg->Type == PT_PHDR || !Sec)
+    const SectionBase *FirstSec = Seg->firstSection();
+    if (Seg->Type == PT_PHDR || !FirstSec)
       continue;
 
-    uint64_t Offset = Sec->Offset;
+    uint64_t Offset = FirstSec->Offset;
     uint64_t FileSize = 0;
     for (const SectionBase *Sec : Seg->Sections) {
       uint64_t Size = Sec->Type == SHT_NOBITS ? 0 : Sec->Size;