[PATCH] Don't get confused on the number of braces when braces start after the first __asm

Ehsan Akhgari ehsan.akhgari at gmail.com
Mon Jul 14 19:30:18 PDT 2014


Closed by commit rL213032 (authored by @ehsan).

REPOSITORY
  rL LLVM

http://reviews.llvm.org/D4505

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

Index: cfe/trunk/lib/Parse/ParseStmtAsm.cpp
===================================================================
--- cfe/trunk/lib/Parse/ParseStmtAsm.cpp
+++ cfe/trunk/lib/Parse/ParseStmtAsm.cpp
@@ -323,7 +323,7 @@
   SmallVector<Token, 4> AsmToks;
 
   unsigned BraceNesting = 0;
-  unsigned short savedBraceCount = 0;
+  unsigned short savedBraceCount = BraceCount;
   bool InAsmComment = false;
   FileID FID;
   unsigned LineNo = 0;
@@ -334,7 +334,6 @@
   if (Tok.is(tok::l_brace)) {
     // Braced inline asm: consume the opening brace.
     BraceNesting = 1;
-    savedBraceCount = BraceCount;
     EndLoc = ConsumeBrace();
     LBraceLocs.push_back(EndLoc);
     ++NumTokensRead;
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
@@ -45,6 +45,9 @@
     }
   }
 }
+void t11() {
+  do { __asm mov eax, 0 __asm { __asm mov edx, 1 } } while(0);
+}
 int t_fail() { // expected-note {{to match this}}
   __asm 
   __asm { // expected-error 3 {{expected}} expected-note {{to match this}}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D4505.11414.patch
Type: text/x-patch
Size: 1134 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140715/d10c6699/attachment.bin>


More information about the cfe-commits mailing list