[lld] 4b5c6c5 - [lld-macho][nfc] Fix uninitialized members warning from Coverity

Jez Ng via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 10 12:09:14 PDT 2021


Author: Jez Ng
Date: 2021-06-10T15:09:07-04:00
New Revision: 4b5c6c5c4b9293557ec8e76d6500527e5d8f9611

URL: https://github.com/llvm/llvm-project/commit/4b5c6c5c4b9293557ec8e76d6500527e5d8f9611
DIFF: https://github.com/llvm/llvm-project/commit/4b5c6c5c4b9293557ec8e76d6500527e5d8f9611.diff

LOG: [lld-macho][nfc] Fix uninitialized members warning from Coverity

We were always assigning to this member before using it, but just to be
safe...

See https://lists.llvm.org/pipermail/llvm-dev/2021-June/151029.html

Added: 
    

Modified: 
    lld/MachO/InputSection.h

Removed: 
    


################################################################################
diff  --git a/lld/MachO/InputSection.h b/lld/MachO/InputSection.h
index 8590d729e3ab..d8f283c83a87 100644
--- a/lld/MachO/InputSection.h
+++ b/lld/MachO/InputSection.h
@@ -104,7 +104,7 @@ struct StringPiece {
   uint32_t inSecOff;
   uint32_t hash;
   // Offset from the start of the containing output section.
-  uint64_t outSecOff;
+  uint64_t outSecOff = 0;
 
   StringPiece(uint64_t off, uint32_t hash) : inSecOff(off), hash(hash) {}
 };


        


More information about the llvm-commits mailing list