[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 18:04:27 PDT 2014
Hi majnemer,
Without this, we would not consume the closing brace which would cause
the parser to start consuming C++ and bad things would happen.
http://reviews.llvm.org/D4505
Files:
lib/Parse/ParseStmtAsm.cpp
test/Parser/ms-inline-asm.c
Index: lib/Parse/ParseStmtAsm.cpp
===================================================================
--- lib/Parse/ParseStmtAsm.cpp
+++ 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: test/Parser/ms-inline-asm.c
===================================================================
--- test/Parser/ms-inline-asm.c
+++ 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.11410.patch
Type: text/x-patch
Size: 1074 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140715/d1e76e0c/attachment.bin>
More information about the cfe-commits
mailing list