Add support for nested blocks in Microsoft inline assembly
This fixes http://llvm.org/PR20204.
llvm-svn: 212389
diff --git a/clang/test/CodeGen/ms-inline-asm-64.c b/clang/test/CodeGen/ms-inline-asm-64.c
index 69066aa..d6f6e2e 100644
--- a/clang/test/CodeGen/ms-inline-asm-64.c
+++ b/clang/test/CodeGen/ms-inline-asm-64.c
@@ -37,7 +37,9 @@
foo.b = 2;
__asm {
lea ebx, foo
- mov eax, [ebx].foo.a
+ {
+ mov eax, [ebx].foo.a
+ }
mov [ebx].foo.b, ecx
}
return foo.b;
diff --git a/clang/test/CodeGen/ms-inline-asm.c b/clang/test/CodeGen/ms-inline-asm.c
index 3836ddd..3b55b50 100644
--- a/clang/test/CodeGen/ms-inline-asm.c
+++ b/clang/test/CodeGen/ms-inline-asm.c
@@ -52,6 +52,11 @@
__asm {
int 0x2c ; } asm comments are fun! }{
}
+ __asm {
+ {
+ int 0x2c ; } asm comments are fun! }{
+ }
+ }
__asm {}
// CHECK: t7
// CHECK: call void asm sideeffect inteldialect "int $$0x2c", "~{dirflag},~{fpsr},~{flags}"()
@@ -73,8 +78,8 @@
void t9() {
__asm {
push ebx
- mov ebx, 0x07
- pop ebx
+ { mov ebx, 0x07 }
+ __asm { pop ebx }
}
// CHECK: t9
// CHECK: call void asm sideeffect inteldialect "push ebx\0A\09mov ebx, $$0x07\0A\09pop ebx", "~{ebx},~{esp},~{dirflag},~{fpsr},~{flags}"()
@@ -129,7 +134,7 @@
unsigned i = 1, j = 2;
__asm {
.if 1
- mov eax, i
+ { mov eax, i }
.else
mov ebx, j
.endif
diff --git a/clang/test/Parser/ms-inline-asm-nested-braces.c b/clang/test/Parser/ms-inline-asm-nested-braces.c
new file mode 100644
index 0000000..58b055b
--- /dev/null
+++ b/clang/test/Parser/ms-inline-asm-nested-braces.c
@@ -0,0 +1,9 @@
+// REQUIRES: x86-registered-target
+// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -verify -fasm-blocks
+
+int t_fail() { // expected-note {{to match this}}
+ __asm
+ { // expected-note {{to match this}}
+ { // expected-note {{to match this}}
+ {
+ } // expected-error 3 {{expected}}
diff --git a/clang/test/Parser/ms-inline-asm.c b/clang/test/Parser/ms-inline-asm.c
index a9c15cf..564f008 100644
--- a/clang/test/Parser/ms-inline-asm.c
+++ b/clang/test/Parser/ms-inline-asm.c
@@ -34,6 +34,17 @@
void t9() {
__asm nop __asm nop ; __asm nop
}
+void t10() {
+ __asm {
+ mov eax, 0
+ __asm {
+ mov eax, 1
+ {
+ mov eax, 2
+ }
+ }
+ }
+}
int t_fail() { // expected-note {{to match this}}
__asm
__asm { // expected-error 3 {{expected}} expected-note {{to match this}}