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
This commit is contained in:
Ehsan Akhgari 2014-07-15 02:21:41 +00:00
parent ca3976f7ae
commit 833ed943d6
2 changed files with 4 additions and 2 deletions

View File

@ -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;

View File

@ -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}}