From: Sean Silva Date: Thu, 20 Jun 2013 19:11:41 +0000 (+0000) Subject: [yaml2obj][ELF] Just let this class own its buffer. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bd3bc691b147e1b67a1433144c20a8db44b4338c;p=platform%2Fupstream%2Fllvm.git [yaml2obj][ELF] Just let this class own its buffer. llvm-svn: 184456 --- diff --git a/llvm/tools/yaml2obj/yaml2elf.cpp b/llvm/tools/yaml2obj/yaml2elf.cpp index f62e688..7dc4fbc 100644 --- a/llvm/tools/yaml2obj/yaml2elf.cpp +++ b/llvm/tools/yaml2obj/yaml2elf.cpp @@ -69,11 +69,12 @@ public: namespace { class ContiguousBlobAccumulator { const uint64_t InitialOffset; + SmallVector Buf; raw_svector_ostream OS; public: - ContiguousBlobAccumulator(uint64_t InitialOffset_, SmallVectorImpl &Buf) - : InitialOffset(InitialOffset_), OS(Buf) {} + ContiguousBlobAccumulator(uint64_t InitialOffset_) + : InitialOffset(InitialOffset_), Buf(), OS(Buf) {} raw_ostream &getOS() { return OS; } uint64_t currentOffset() const { return InitialOffset + OS.tell(); } void writeBlobToStream(raw_ostream &Out) { Out << OS.str(); } @@ -230,12 +231,11 @@ static int writeELF(raw_ostream &OS, const ELFYAML::Object &Doc) { } StringTableBuilder SHStrTab; - SmallVector Buf; // XXX: This offset is tightly coupled with the order that we write // things to `OS`. const size_t SectionContentBeginOffset = Header.e_ehsize + Header.e_shentsize * Header.e_shnum; - ContiguousBlobAccumulator CBA(SectionContentBeginOffset, Buf); + ContiguousBlobAccumulator CBA(SectionContentBeginOffset); std::vector SHeaders; { // Ensure SHN_UNDEF entry is present. An all-zero section header is a