Use initializer instead of memset to zero out.
authorRui Ueyama <ruiu@google.com>
Sat, 30 May 2015 19:28:58 +0000 (19:28 +0000)
committerRui Ueyama <ruiu@google.com>
Sat, 30 May 2015 19:28:58 +0000 (19:28 +0000)
llvm-svn: 238662

lld/COFF/Writer.cpp
lld/COFF/Writer.h

index 9b24368..e38f65a 100644 (file)
@@ -41,11 +41,6 @@ static const int HeaderSize =
 namespace lld {
 namespace coff {
 
-OutputSection::OutputSection(StringRef N, uint32_t SI)
-    : Name(N), SectionIndex(SI) {
-  memset(&Header, 0, sizeof(Header));
-}
-
 void OutputSection::setRVA(uint64_t RVA) {
   Header.VirtualAddress = RVA;
   for (Chunk *C : Chunks)
index 429eb68..b6d1360 100644 (file)
@@ -30,7 +30,8 @@ const uint32_t PermMask = 0xF00000F0;
 // non-overlapping file offsets and RVAs.
 class OutputSection {
 public:
-  OutputSection(StringRef Name, uint32_t SectionIndex);
+  OutputSection(StringRef N, uint32_t SI)
+      : Name(N), SectionIndex(SI), Header({}) {}
   void setRVA(uint64_t);
   void setFileOffset(uint64_t);
   void addChunk(Chunk *C);
@@ -59,9 +60,9 @@ public:
   void setStringTableOff(uint32_t V) { StringTableOff = V; }
 
 private:
-  coff_section Header;
   StringRef Name;
   uint32_t SectionIndex;
+  coff_section Header;
   uint32_t StringTableOff = 0;
   std::vector<Chunk *> Chunks;
 };