forked from OSchip/llvm-project
fix PR10415, tidying up IR representation of module level inline asm
to avoid extraneous \n's. llvm-svn: 135862
This commit is contained in:
parent
2a843827a2
commit
84037d3d0a
|
@ -2186,6 +2186,8 @@ void CodeGenModule::EmitTopLevelDecl(Decl *D) {
|
|||
const std::string &S = getModule().getModuleInlineAsm();
|
||||
if (S.empty())
|
||||
getModule().setModuleInlineAsm(AsmString);
|
||||
else if (*--S.end() == '\n')
|
||||
getModule().setModuleInlineAsm(S + AsmString.str());
|
||||
else
|
||||
getModule().setModuleInlineAsm(S + '\n' + AsmString.str());
|
||||
break;
|
||||
|
|
|
@ -1,4 +1,13 @@
|
|||
// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s
|
||||
|
||||
// PR10415
|
||||
__asm__ ("foo1");
|
||||
__asm__ ("foo2");
|
||||
__asm__ ("foo3");
|
||||
// CHECK: module asm "foo1"
|
||||
// CHECK-NEXT: module asm "foo2"
|
||||
// CHECK-NEXT: module asm "foo3"
|
||||
|
||||
void t1(int len) {
|
||||
__asm__ volatile("" : "=&r"(len), "+&r"(len));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue