summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorEhsan Akhgari <ehsan.akhgari@gmail.com>2014-07-15 02:21:41 +0000
committerEhsan Akhgari <ehsan.akhgari@gmail.com>2014-07-15 02:21:41 +0000
commit833ed943d643b8c5a889a8fe1a3486a41201458c (patch)
tree33547a15e314e3f9c303c139d006efa03cf3c335 /clang
parentca3976f7aef49af78926ff542809e28c2eac22f1 (diff)
downloadbcm5719-llvm-833ed943d643b8c5a889a8fe1a3486a41201458c.tar.gz
bcm5719-llvm-833ed943d643b8c5a889a8fe1a3486a41201458c.zip
Don't get confused on the number of braces when braces start after the first __asm
Summary: Without this, we would not consume the closing brace which would cause the parser to start consuming C++ and bad things would happen. Reviewers: majnemer Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D4505 llvm-svn: 213032
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Parse/ParseStmtAsm.cpp3
-rw-r--r--clang/test/Parser/ms-inline-asm.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Parse/ParseStmtAsm.cpp b/clang/lib/Parse/ParseStmtAsm.cpp
index de299fd5c4a..f66121b1ec7 100644
--- a/clang/lib/Parse/ParseStmtAsm.cpp
+++ b/clang/lib/Parse/ParseStmtAsm.cpp
@@ -323,7 +323,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
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 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
if (Tok.is(tok::l_brace)) {
// Braced inline asm: consume the opening brace.
BraceNesting = 1;
- savedBraceCount = BraceCount;
EndLoc = ConsumeBrace();
LBraceLocs.push_back(EndLoc);
++NumTokensRead;
diff --git a/clang/test/Parser/ms-inline-asm.c b/clang/test/Parser/ms-inline-asm.c
index 564f0081d38..00508f5cf09 100644
--- a/clang/test/Parser/ms-inline-asm.c
+++ b/clang/test/Parser/ms-inline-asm.c
@@ -45,6 +45,9 @@ void t10() {
}
}
}
+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}}
OpenPOWER on IntegriCloud