From 83c862ad52fc71a2c3befcc1ebfabb726854831f Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Tue, 1 Sep 2015 23:19:38 +0000 Subject: [PATCH] [MC] Remove MCAssembler's copy of OS We can just ask the ObjectWriter for it's stream instead of caching around our own reference to it. No functionality change is intended. llvm-svn: 246604 --- llvm/include/llvm/MC/MCAssembler.h | 5 +---- llvm/lib/MC/MCAssembler.cpp | 8 ++++---- llvm/lib/MC/MCObjectStreamer.cpp | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/llvm/include/llvm/MC/MCAssembler.h b/llvm/include/llvm/MC/MCAssembler.h index a00b12b9af13..eec9d1ecb1ca 100644 --- a/llvm/include/llvm/MC/MCAssembler.h +++ b/llvm/include/llvm/MC/MCAssembler.h @@ -576,8 +576,6 @@ private: MCObjectWriter &Writer; - raw_ostream &OS; - SectionListType Sections; SymbolDataListType Symbols; @@ -723,8 +721,7 @@ public: // option is to make this abstract, and have targets provide concrete // implementations as we do with AsmParser. MCAssembler(MCContext &Context_, MCAsmBackend &Backend_, - MCCodeEmitter &Emitter_, MCObjectWriter &Writer_, - raw_ostream &OS); + MCCodeEmitter &Emitter_, MCObjectWriter &Writer_); ~MCAssembler(); /// Reuse an assembler instance diff --git a/llvm/lib/MC/MCAssembler.cpp b/llvm/lib/MC/MCAssembler.cpp index 3f419b5b1e44..79854596bc63 100644 --- a/llvm/lib/MC/MCAssembler.cpp +++ b/llvm/lib/MC/MCAssembler.cpp @@ -325,11 +325,10 @@ void MCFragment::destroy() { /* *** */ MCAssembler::MCAssembler(MCContext &Context_, MCAsmBackend &Backend_, - MCCodeEmitter &Emitter_, MCObjectWriter &Writer_, - raw_ostream &OS_) + MCCodeEmitter &Emitter_, MCObjectWriter &Writer_) : Context(Context_), Backend(Backend_), Emitter(Emitter_), Writer(Writer_), - OS(OS_), BundleAlignSize(0), RelaxAll(false), - SubsectionsViaSymbols(false), ELFHeaderEFlags(0) { + BundleAlignSize(0), RelaxAll(false), SubsectionsViaSymbols(false), + ELFHeaderEFlags(0) { VersionMinInfo.Major = 0; // Major version == 0 for "none specified" } @@ -933,6 +932,7 @@ void MCAssembler::Finish() { MCAsmLayout Layout(*this); layout(Layout); + raw_ostream &OS = getWriter().getStream(); uint64_t StartOffset = OS.tell(); // Write the object file. diff --git a/llvm/lib/MC/MCObjectStreamer.cpp b/llvm/lib/MC/MCObjectStreamer.cpp index 49b8358e6e8e..1da182b35595 100644 --- a/llvm/lib/MC/MCObjectStreamer.cpp +++ b/llvm/lib/MC/MCObjectStreamer.cpp @@ -28,7 +28,7 @@ MCObjectStreamer::MCObjectStreamer(MCContext &Context, MCAsmBackend &TAB, MCCodeEmitter *Emitter_) : MCStreamer(Context), Assembler(new MCAssembler(Context, TAB, *Emitter_, - *TAB.createObjectWriter(OS), OS)), + *TAB.createObjectWriter(OS))), EmitEHFrame(true), EmitDebugFrame(false) {} MCObjectStreamer::~MCObjectStreamer() {