summaryrefslogtreecommitdiff
path: root/tools/yaml2obj
diff options
context:
space:
mode:
authorSean Silva <silvas@purdue.edu>2013-06-20 19:11:41 +0000
committerSean Silva <silvas@purdue.edu>2013-06-20 19:11:41 +0000
commitb14f972ed6865a978402fb1c788ee7939b58680d (patch)
tree33af145e6b2050591346f178b1694cc954df10a5 /tools/yaml2obj
parent201c66c9b06e509d0a02972e7947a8e97aa17a2e (diff)
downloadllvm-b14f972ed6865a978402fb1c788ee7939b58680d.tar.gz
llvm-b14f972ed6865a978402fb1c788ee7939b58680d.tar.bz2
llvm-b14f972ed6865a978402fb1c788ee7939b58680d.tar.xz
[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
Diffstat (limited to 'tools/yaml2obj')
-rw-r--r--tools/yaml2obj/yaml2elf.cpp8
1 files changed, 4 insertions, 4 deletions
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<char, 128> Buf;
raw_svector_ostream OS;
public:
- ContiguousBlobAccumulator(uint64_t InitialOffset_, SmallVectorImpl<char> &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<char, 128> 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<Elf_Shdr> SHeaders;
{
// Ensure SHN_UNDEF entry is present. An all-zero section header is a