summaryrefslogtreecommitdiff
path: root/tools/llvm-mc
diff options
context:
space:
mode:
authorNirav Dave <niravd@google.com>2018-04-27 15:45:54 +0000
committerNirav Dave <niravd@google.com>2018-04-27 15:45:54 +0000
commit80e97ed58226a95685791bdb05ce13bd7c3cb6fc (patch)
treebc642d947f58e4e00535be57202cf6e2844ad6c1 /tools/llvm-mc
parent92f209bb4f19b885d3f9d47bdf4ed861ce7e8afe (diff)
[MC] Modify MCAsmStreamer to always build MCAssembler. NFCI.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@331048 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-mc')
-rw-r--r--tools/llvm-mc/llvm-mc.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp
index c3ec9d495fa..dd83ac30446 100644
--- a/tools/llvm-mc/llvm-mc.cpp
+++ b/tools/llvm-mc/llvm-mc.cpp
@@ -439,16 +439,17 @@ int main(int argc, char **argv) {
IP->setPrintImmHex(PrintImmHex);
// Set up the AsmStreamer.
- MCCodeEmitter *CE = nullptr;
- MCAsmBackend *MAB = nullptr;
- if (ShowEncoding) {
- CE = TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx);
- MAB = TheTarget->createMCAsmBackend(*STI, *MRI, MCOptions);
- }
+ std::unique_ptr<MCCodeEmitter> CE;
+ if (ShowEncoding)
+ CE.reset(TheTarget->createMCCodeEmitter(*MCII, *MRI, Ctx));
+
+ std::unique_ptr<MCAsmBackend> MAB(
+ TheTarget->createMCAsmBackend(*STI, *MRI, MCOptions));
auto FOut = llvm::make_unique<formatted_raw_ostream>(*OS);
- Str.reset(TheTarget->createAsmStreamer(
- Ctx, std::move(FOut), /*asmverbose*/ true,
- /*useDwarfDirectory*/ true, IP, CE, MAB, ShowInst));
+ Str.reset(
+ TheTarget->createAsmStreamer(Ctx, std::move(FOut), /*asmverbose*/ true,
+ /*useDwarfDirectory*/ true, IP,
+ std::move(CE), std::move(MAB), ShowInst));
} else if (FileType == OFT_Null) {
Str.reset(TheTarget->createNullStreamer(Ctx));