diff options
author | Roman Divacky <rdivacky@FreeBSD.org> | 2010-05-04 16:12:48 +0000 |
---|---|---|
committer | Roman Divacky <rdivacky@FreeBSD.org> | 2010-05-04 16:12:48 +0000 |
commit | 0883ccd9eac3b974df00e6548ee319a7dd3646f4 (patch) | |
tree | d6a70c3518b8dea8be7062438d7e8676820ed17f /lib/Parse/ParseStmt.cpp | |
parent | 60bfabcd8ce617297c0d231f77d14ab507e98796 (diff) | |
download | src-0883ccd9eac3b974df00e6548ee319a7dd3646f4.tar.gz src-0883ccd9eac3b974df00e6548ee319a7dd3646f4.zip |
Update clang to r103004.
Notes
Notes:
svn path=/vendor/clang/dist/; revision=207619
Diffstat (limited to 'lib/Parse/ParseStmt.cpp')
-rw-r--r-- | lib/Parse/ParseStmt.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index b208c50c81bc..9b2227002f1b 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -643,6 +643,7 @@ Parser::OwningStmtResult Parser::ParseIfStatement(AttributeList *Attr) { if (Tok.is(tok::kw_else)) { ElseLoc = ConsumeToken(); + ElseStmtLoc = Tok.getLocation(); // C99 6.8.4p3 - In C99, the body of the if statement is a scope, even if // there is no compound stmt. C90 does not have this clause. We only do @@ -656,12 +657,14 @@ Parser::OwningStmtResult Parser::ParseIfStatement(AttributeList *Attr) { ParseScope InnerScope(this, Scope::DeclScope, C99orCXX && Tok.isNot(tok::l_brace)); - bool WithinElse = CurScope->isWithinElse(); - CurScope->setWithinElse(true); - ElseStmtLoc = Tok.getLocation(); + // Regardless of whether or not InnerScope actually pushed a scope, set the + // ElseScope flag for the innermost scope so we can diagnose use of the if + // condition variable in C++. + unsigned OldFlags = CurScope->getFlags(); + CurScope->setFlags(OldFlags | Scope::ElseScope); ElseStmt = ParseStatement(); - CurScope->setWithinElse(WithinElse); - + CurScope->setFlags(OldFlags); + // Pop the 'else' scope if needed. InnerScope.Exit(); } |