[llvm] 5edf964 - Fix cppcheck shadow variable warning. NFC.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 18 05:59:31 PST 2019


Author: Simon Pilgrim
Date: 2019-11-18T13:57:34Z
New Revision: 5edf964fccfae77353ef944bf749a8e2a1f5380e

URL: https://github.com/llvm/llvm-project/commit/5edf964fccfae77353ef944bf749a8e2a1f5380e
DIFF: https://github.com/llvm/llvm-project/commit/5edf964fccfae77353ef944bf749a8e2a1f5380e.diff

LOG: Fix cppcheck shadow variable warning. NFC.

Added: 
    

Modified: 
    llvm/tools/llvm-objcopy/ELF/Object.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-objcopy/ELF/Object.cpp b/llvm/tools/llvm-objcopy/ELF/Object.cpp
index dc2c7c8fa8b6..a1073fe9dcb8 100644
--- a/llvm/tools/llvm-objcopy/ELF/Object.cpp
+++ b/llvm/tools/llvm-objcopy/ELF/Object.cpp
@@ -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;


        


More information about the llvm-commits mailing list