llvm.org GIT mirror llvm / b14f972
[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 Sean Silva 7 years ago
1 changed file(s) with 4 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
6868 namespace {
6969 class ContiguousBlobAccumulator {
7070 const uint64_t InitialOffset;
71 SmallVector Buf;
7172 raw_svector_ostream OS;
7273
7374 public:
74 ContiguousBlobAccumulator(uint64_t InitialOffset_, SmallVectorImpl &Buf)
75 : InitialOffset(InitialOffset_), OS(Buf) {}
75 ContiguousBlobAccumulator(uint64_t InitialOffset_)
76 : InitialOffset(InitialOffset_), Buf(), OS(Buf) {}
7677 raw_ostream &getOS() { return OS; }
7778 uint64_t currentOffset() const { return InitialOffset + OS.tell(); }
7879 void writeBlobToStream(raw_ostream &Out) { Out << OS.str(); }
229230 }
230231
231232 StringTableBuilder SHStrTab;
232 SmallVector Buf;
233233 // XXX: This offset is tightly coupled with the order that we write
234234 // things to `OS`.
235235 const size_t SectionContentBeginOffset =
236236 Header.e_ehsize + Header.e_shentsize * Header.e_shnum;
237 ContiguousBlobAccumulator CBA(SectionContentBeginOffset, Buf);
237 ContiguousBlobAccumulator CBA(SectionContentBeginOffset);
238238 std::vector SHeaders;
239239 {
240240 // Ensure SHN_UNDEF entry is present. An all-zero section header is a