From f3ce009fcb0a04a245c437d86657e9bd61ecc18f Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Mon, 17 Aug 2009 04:23:44 +0000 Subject: give MCAsmStreamer a TargetAsmInfo. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79222 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/llvm-mc/llvm-mc.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'tools') diff --git a/tools/llvm-mc/llvm-mc.cpp b/tools/llvm-mc/llvm-mc.cpp index 7c57f35..a9ba8bd 100644 --- a/tools/llvm-mc/llvm-mc.cpp +++ b/tools/llvm-mc/llvm-mc.cpp @@ -211,21 +211,21 @@ static int AssembleInput(const char *ProgName) { if (!Out) return 1; - // See if we can get an asm printer. - OwningPtr AP(0); // FIXME: We shouldn't need to do this (and link in codegen). OwningPtr TM(TheTarget->createTargetMachine(TripleName, "")); - const TargetAsmInfo *TAI = 0; - if (TM) { - TAI = TheTarget->createAsmInfo(TripleName); - assert(TAI && "Unable to create target asm info!"); - - AP.reset(TheTarget->createAsmPrinter(*Out, *TM, TAI, true)); + if (!TM) { + errs() << ProgName << ": error: could not create target for triple '" + << TripleName << "'.\n"; + return 1; } - OwningPtr Str(createAsmStreamer(Ctx, *Out, AP.get())); + const TargetAsmInfo *TAI = TheTarget->createAsmInfo(TripleName); + assert(TAI && "Unable to create target asm info!"); + + OwningPtr AP(TheTarget->createAsmPrinter(*Out, *TM, TAI, true)); + OwningPtr Str(createAsmStreamer(Ctx, *Out, *TAI, AP.get())); // FIXME: Target hook & command line option for initial section. Str.get()->SwitchSection(MCSectionMachO::Create("__TEXT","__text", -- cgit v1.1