a more graceful fix for test/Other/inline-asm-newline-terminator.ll,

follow on to r103765

llvm-svn: 108390
This commit is contained in:
Chris Lattner 2010-07-15 00:37:34 +00:00
parent a8b4e3732b
commit 28fd6785bc
2 changed files with 1 additions and 15 deletions

View File

@ -178,7 +178,7 @@ bool AsmPrinter::doInitialization(Module &M) {
if (!M.getModuleInlineAsm().empty()) {
OutStreamer.AddComment("Start of file scope inline assembly");
OutStreamer.AddBlankLine();
EmitInlineAsm(M.getModuleInlineAsm(), 0/*no loc cookie*/);
EmitInlineAsm(M.getModuleInlineAsm()+"\n", 0/*no loc cookie*/);
OutStreamer.AddComment("End of file scope inline assembly");
OutStreamer.AddBlankLine();
}

View File

@ -53,17 +53,6 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, unsigned LocCookie) const {
}
SourceMgr SrcMgr;
// Ensure the buffer is newline terminated.
char *TmpString = 0;
if (Str.back() != '\n') {
TmpString = new char[Str.size() + 2];
memcpy(TmpString, Str.data(), Str.size());
TmpString[Str.size()] = '\n';
TmpString[Str.size() + 1] = 0;
isNullTerminated = true;
Str = TmpString;
}
// If the current LLVMContext has an inline asm handler, set it in SourceMgr.
LLVMContext &LLVMCtx = MMI->getModule()->getContext();
@ -95,9 +84,6 @@ void AsmPrinter::EmitInlineAsm(StringRef Str, unsigned LocCookie) const {
/*NoFinalize*/ true);
if (Res && !HasDiagHandler)
report_fatal_error("Error parsing inline asm\n");
if (TmpString)
delete[] TmpString;
}