diff options
-rw-r--r-- | llvm/include/llvm/MC/MCParser/AsmParser.h | 2 | ||||
-rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp | 3 | ||||
-rw-r--r-- | llvm/lib/MC/MCParser/AsmParser.cpp | 6 |
3 files changed, 7 insertions, 4 deletions
diff --git a/llvm/include/llvm/MC/MCParser/AsmParser.h b/llvm/include/llvm/MC/MCParser/AsmParser.h index 06e0920950d..23f4a1fb72a 100644 --- a/llvm/include/llvm/MC/MCParser/AsmParser.h +++ b/llvm/include/llvm/MC/MCParser/AsmParser.h @@ -64,7 +64,7 @@ public: const MCAsmInfo &MAI); ~AsmParser(); - bool Run(bool NoInitialTextSection); + bool Run(bool NoInitialTextSection, bool NoFinalize = false); void AddDirectiveHandler(StringRef Directive, diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp index 090bd9b2bff..ab55b6b1c96 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp @@ -66,7 +66,8 @@ void AsmPrinter::EmitInlineAsm(StringRef Str) const { Parser.setTargetParser(*TAP.get()); // Don't implicitly switch to the text section before the asm. - int Res = Parser.Run(/*NoInitialTextSection*/ true); + int Res = Parser.Run(/*NoInitialTextSection*/ true, + /*NoFinalize*/ true); if (Res) llvm_report_error("Error parsing inline asm\n"); } diff --git a/llvm/lib/MC/MCParser/AsmParser.cpp b/llvm/lib/MC/MCParser/AsmParser.cpp index 24616b40b8e..4e62689c51e 100644 --- a/llvm/lib/MC/MCParser/AsmParser.cpp +++ b/llvm/lib/MC/MCParser/AsmParser.cpp @@ -138,7 +138,7 @@ const AsmToken &AsmParser::Lex() { return *tok; } -bool AsmParser::Run(bool NoInitialTextSection) { +bool AsmParser::Run(bool NoInitialTextSection, bool NoFinalize) { // Create the initial section, if requested. // // FIXME: Target hook & command line option for initial section. @@ -190,7 +190,9 @@ bool AsmParser::Run(bool NoInitialTextSection) { TheCondState.Ignore != StartingCondState.Ignore) return TokError("unmatched .ifs or .elses"); - if (!HadError) + // Finalize the output stream if there are no errors and if the client wants + // us to. + if (!HadError && !NoFinalize) Out.Finish(); return HadError; |