diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-04-09 21:06:08 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-04-09 21:06:08 +0000 |
commit | 427c073035b4c64742f3b784a1b6b6ecb41cd601 (patch) | |
tree | 449fd8b30f79e795ea4e70b220e8c0670cd5c989 /tools/llvm-mc | |
parent | 66649e00c91e30fdfc8dd64b43cde2632a831138 (diff) |
Simplify use of formatted_raw_ostream.
formatted_raw_ostream is a wrapper over another stream to add column and line
number tracking.
It is used only for asm printing.
This patch moves the its creation down to where we know we are printing
assembly. This has the following advantages:
* Simpler lifetime management: std::unique_ptr
* We don't compute column and line number of object files :-)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@234535 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-mc')
-rw-r--r-- | tools/llvm-mc/llvm-mc.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index 9944f184ce8..58fe233fce1 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -439,7 +439,6 @@ int main(int argc, char **argv) { if (!Out) return 1; - formatted_raw_ostream FOS(Out->os()); std::unique_ptr<MCStreamer> Str; std::unique_ptr<MCInstrInfo> MCII(TheTarget->createMCInstrInfo()); @@ -461,9 +460,10 @@ int main(int argc, char **argv) { CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx); MAB = TheTarget->createMCAsmBackend(*MRI, TripleName, MCPU); } - Str.reset(TheTarget->createAsmStreamer(Ctx, FOS, /*asmverbose*/ true, - /*useDwarfDirectory*/ true, IP, CE, - MAB, ShowInst)); + auto FOut = llvm::make_unique<formatted_raw_ostream>(Out->os()); + Str.reset(TheTarget->createAsmStreamer( + Ctx, std::move(FOut), /*asmverbose*/ true, + /*useDwarfDirectory*/ true, IP, CE, MAB, ShowInst)); } else if (FileType == OFT_Null) { Str.reset(TheTarget->createNullStreamer(Ctx)); @@ -471,8 +471,8 @@ int main(int argc, char **argv) { assert(FileType == OFT_ObjectFile && "Invalid file type!"); MCCodeEmitter *CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx); MCAsmBackend *MAB = TheTarget->createMCAsmBackend(*MRI, TripleName, MCPU); - Str.reset(TheTarget->createMCObjectStreamer(TheTriple, Ctx, *MAB, FOS, CE, - *STI, RelaxAll, + Str.reset(TheTarget->createMCObjectStreamer(TheTriple, Ctx, *MAB, Out->os(), + CE, *STI, RelaxAll, /*DWARFMustBeAtTheEnd*/ false)); if (NoExecStack) Str->InitSections(true); |