diff options
Diffstat (limited to 'clang/lib/Parse/ParseStmt.cpp')
-rw-r--r-- | clang/lib/Parse/ParseStmt.cpp | 41 |
1 files changed, 4 insertions, 37 deletions
diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp index 12ab5e2767e..6cc8b57b61f 100644 --- a/clang/lib/Parse/ParseStmt.cpp +++ b/clang/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; } |