aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseStmt.cpp
diff options
context:
space:
mode:
authorFrancois Pichet <pichet2000@gmail.com>2011-05-07 17:30:27 +0000
committerFrancois Pichet <pichet2000@gmail.com>2011-05-07 17:30:27 +0000
commitf986038beed360c031de8654cfba43a5d3184605 (patch)
tree5b6ae7f387be4cc23ef8f0e026273afe02633707 /lib/Parse/ParseStmt.cpp
parent00c93a10c3504b77dad4467766bfca3248defbfb (diff)
Add support for _if_exists and __if_not_exists at namespace/global scope.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131050 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseStmt.cpp')
-rw-r--r--lib/Parse/ParseStmt.cpp41
1 files changed, 4 insertions, 37 deletions
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp
index 12ab5e2767..6cc8b57b61 100644
--- a/lib/Parse/ParseStmt.cpp
+++ b/lib/Parse/ParseStmt.cpp
@@ -2008,51 +2008,18 @@ StmtResult Parser::ParseCXXCatchBlock() {
}
void Parser::ParseMicrosoftIfExistsStatement(StmtVector &Stmts) {
- assert((Tok.is(tok::kw___if_exists) || Tok.is(tok::kw___if_not_exists)) &&
- "Expected '__if_exists' or '__if_not_exists'");
- Token Condition = Tok;
- SourceLocation IfExistsLoc = ConsumeToken();
-
- SourceLocation LParenLoc = Tok.getLocation();
- if (Tok.isNot(tok::l_paren)) {
- Diag(Tok, diag::err_expected_lparen_after) << IfExistsLoc;
- SkipUntil(tok::semi);
+ bool Result;
+ if (ParseMicrosoftIfExistsCondition(Result))
return;
- }
- ConsumeParen(); // eat the '('.
- // Parse nested-name-specifier.
- CXXScopeSpec SS;
- ParseOptionalCXXScopeSpecifier(SS, ParsedType(), false);
-
- // Check nested-name specifier.
- if (SS.isInvalid()) {
- SkipUntil(tok::semi);
- return;
- }
-
- // Parse the unqualified-id.
- UnqualifiedId Name;
- if (ParseUnqualifiedId(SS, false, true, true, ParsedType(), Name)) {
- SkipUntil(tok::semi);
- return;
- }
-
- if (MatchRHSPunctuation(tok::r_paren, LParenLoc).isInvalid())
- return;
-
if (Tok.isNot(tok::l_brace)) {
Diag(Tok, diag::err_expected_lbrace);
return;
}
ConsumeBrace();
- // Check if the symbol exists.
- bool Exist = Actions.CheckMicrosoftIfExistsSymbol(SS, Name);
-
- // If the condition is false skip the tokens until the '}'
- if ((Condition.is(tok::kw___if_exists) && !Exist) ||
- (Condition.is(tok::kw___if_not_exists) && Exist)) {
+ // Condition is false skip all inside the {}.
+ if (!Result) {
SkipUntil(tok::r_brace, false);
return;
}