[lld] r238662 - Use initializer instead of memset to zero out.
Rui Ueyama
ruiu at google.com
Sat May 30 12:28:58 PDT 2015
Author: ruiu
Date: Sat May 30 14:28:58 2015
New Revision: 238662
URL: http://llvm.org/viewvc/llvm-project?rev=238662&view=rev
Log:
Use initializer instead of memset to zero out.
Modified:
lld/trunk/COFF/Writer.cpp
lld/trunk/COFF/Writer.h
Modified: lld/trunk/COFF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.cpp?rev=238662&r1=238661&r2=238662&view=diff
==============================================================================
--- lld/trunk/COFF/Writer.cpp (original)
+++ lld/trunk/COFF/Writer.cpp Sat May 30 14:28:58 2015
@@ -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)
Modified: lld/trunk/COFF/Writer.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Writer.h?rev=238662&r1=238661&r2=238662&view=diff
==============================================================================
--- lld/trunk/COFF/Writer.h (original)
+++ lld/trunk/COFF/Writer.h Sat May 30 14:28:58 2015
@@ -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;
};
More information about the llvm-commits
mailing list