From 438390fae1f0f6125b914e5f1bd4ef2e7deb8c05 Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Mon, 21 May 2018 18:23:50 +0000 Subject: MC: Have the object writers return the number of bytes written. NFCI. This removes the last external use of the stream. Part of PR37466. Differential Revision: https://reviews.llvm.org/D47042 llvm-svn: 332863 --- llvm/lib/MC/MachObjectWriter.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'llvm/lib/MC/MachObjectWriter.cpp') diff --git a/llvm/lib/MC/MachObjectWriter.cpp b/llvm/lib/MC/MachObjectWriter.cpp index ba8922c8997..a464af1d42a 100644 --- a/llvm/lib/MC/MachObjectWriter.cpp +++ b/llvm/lib/MC/MachObjectWriter.cpp @@ -735,8 +735,10 @@ static MachO::LoadCommandType getLCFromMCVM(MCVersionMinType Type) { llvm_unreachable("Invalid mc version min type"); } -void MachObjectWriter::writeObject(MCAssembler &Asm, - const MCAsmLayout &Layout) { +uint64_t MachObjectWriter::writeObject(MCAssembler &Asm, + const MCAsmLayout &Layout) { + uint64_t StartOffset = W.OS.tell(); + // Compute symbol table information and bind symbol indices. computeSymbolTable(Asm, LocalSymbolData, ExternalSymbolData, UndefinedSymbolData); @@ -1011,6 +1013,8 @@ void MachObjectWriter::writeObject(MCAssembler &Asm, // Write the string table. StringTable.write(W.OS); } + + return W.OS.tell() - StartOffset; } std::unique_ptr -- cgit v1.2.3