From b14f972ed6865a978402fb1c788ee7939b58680d Mon Sep 17 00:00:00 2001 From: Sean Silva Date: Thu, 20 Jun 2013 19:11:41 +0000 Subject: [yaml2obj][ELF] Just let this class own its buffer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@184456 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/yaml2obj/yaml2elf.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tools/yaml2obj') diff --git a/tools/yaml2obj/yaml2elf.cpp b/tools/yaml2obj/yaml2elf.cpp index f62e6884e8..7dc4fbc315 100644 --- a/tools/yaml2obj/yaml2elf.cpp +++ b/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 -- cgit v1.2.3