[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
This commit is contained in:
David Majnemer 2015-09-01 23:19:38 +00:00
parent 78471f0ec1
commit 83c862ad52
3 changed files with 6 additions and 9 deletions

View File

@ -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

View File

@ -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.

View File

@ -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() {