Index: lib/MC/MCContext.cpp =================================================================== --- lib/MC/MCContext.cpp +++ lib/MC/MCContext.cpp @@ -510,13 +510,15 @@ void MCContext::reportError(SMLoc Loc, const Twine &Msg) { HadError = true; - // If we have a source manager use it. Otherwise just use the generic - // report_fatal_error(). - if (!SrcMgr) + // If we have a source manager use it. Otherwise, try using the inline source + // manager. + // If that fails, use the generic report_fatal_error(). + if (SrcMgr) + SrcMgr->PrintMessage(Loc, SourceMgr::DK_Error, Msg); + else if (InlineSrcMgr) + InlineSrcMgr->PrintMessage(Loc, SourceMgr::DK_Error, Msg); + else report_fatal_error(Msg, false); - - // Use the source manager to print the message. - SrcMgr->PrintMessage(Loc, SourceMgr::DK_Error, Msg); } void MCContext::reportFatalError(SMLoc Loc, const Twine &Msg) { Index: test/Assembler/inline-asm-diags.ll =================================================================== --- /dev/null +++ test/Assembler/inline-asm-diags.ll @@ -0,0 +1,9 @@ +; RUN: not llc -filetype=obj < %s 2>&1 -o /dev/null | FileCheck %s + +module asm ".word 0x10" +module asm ".word -bar" + +; CHECK: :2:7: error: expected relocatable expression + +module asm ".word -foo" +; CHECK: :3:7: error: expected relocatable expression