[PATCH] D17496: [ms-inline-asm] Fix bug in single asm statement support

Marina Yatsina via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 23 00:58:20 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL261618: [ms-inline-asm] Fixing bug in single asm statement support (authored by myatsina).

Changed prior to commit:
  http://reviews.llvm.org/D17496?vs=48651&id=48790#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17496

Files:
  cfe/trunk/lib/Parse/ParseStmtAsm.cpp
  cfe/trunk/test/CodeGen/ms-inline-asm.c
  cfe/trunk/test/Parser/ms-inline-asm.c

Index: cfe/trunk/test/CodeGen/ms-inline-asm.c
===================================================================
--- cfe/trunk/test/CodeGen/ms-inline-asm.c
+++ cfe/trunk/test/CodeGen/ms-inline-asm.c
@@ -63,10 +63,19 @@
 int t8() {
   __asm int 4 ; } comments for single-line asm
   __asm {}
-  __asm int 4
+  __asm { int 5}
+  __asm int 6
+  __asm int 7
+  __asm { 
+    int 8
+  }
   return 10;
 // CHECK: t8
-// CHECK: call i32 asm sideeffect inteldialect "int $$4\0A\09int $$4", "={eax},~{dirflag},~{fpsr},~{flags}"()
+// CHECK: call i32 asm sideeffect inteldialect "int $$4", "={eax},~{dirflag},~{fpsr},~{flags}"()
+// CHECK: call i32 asm sideeffect inteldialect "", "={eax},~{dirflag},~{fpsr},~{flags}"()
+// CHECK: call i32 asm sideeffect inteldialect "int $$5", "={eax},~{dirflag},~{fpsr},~{flags}"()
+// CHECK: call i32 asm sideeffect inteldialect "int $$6\0A\09int $$7", "={eax},~{dirflag},~{fpsr},~{flags}"()
+// CHECK: call i32 asm sideeffect inteldialect "int $$8", "={eax},~{dirflag},~{fpsr},~{flags}"()
 // CHECK: ret i32 10
 }
 
Index: cfe/trunk/test/Parser/ms-inline-asm.c
===================================================================
--- cfe/trunk/test/Parser/ms-inline-asm.c
+++ cfe/trunk/test/Parser/ms-inline-asm.c
@@ -55,4 +55,4 @@
 }
 int t_fail() { // expected-note {{to match this}}
   __asm 
-  __asm { // expected-error 2 {{expected}} expected-note {{to match this}}
+  __asm { // expected-error 3 {{expected}} expected-note {{to match this}}
Index: cfe/trunk/lib/Parse/ParseStmtAsm.cpp
===================================================================
--- cfe/trunk/lib/Parse/ParseStmtAsm.cpp
+++ cfe/trunk/lib/Parse/ParseStmtAsm.cpp
@@ -423,6 +423,10 @@
         // We're no longer in a comment.
         InAsmComment = false;
         if (isAsm) {
+          // If this is a new __asm {} block we want to process it seperately
+          // from the single-line __asm statements
+          if (PP.LookAhead(0).is(tok::l_brace))
+            break;
           LineNo = SrcMgr.getLineNumber(ExpLoc.first, ExpLoc.second);
           SkippedStartOfLine = Tok.isAtStartOfLine();
         }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17496.48790.patch
Type: text/x-patch
Size: 2123 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160223/0bf62fd1/attachment.bin>


More information about the llvm-commits mailing list