diff options
author | Reid Kleckner <reid@kleckner.net> | 2014-06-25 00:28:35 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2014-06-25 00:28:35 +0000 |
commit | e15c5bb0df8f1d7f9a1f4887c893e8517a0465ea (patch) | |
tree | d1a99185f73229e82fd79c54d233a06d7786b38f /lib | |
parent | 450955db5aa414877c6c966660b41472ffd60b52 (diff) | |
download | clang-e15c5bb0df8f1d7f9a1f4887c893e8517a0465ea.tar.gz clang-e15c5bb0df8f1d7f9a1f4887c893e8517a0465ea.tar.bz2 clang-e15c5bb0df8f1d7f9a1f4887c893e8517a0465ea.tar.xz |
Fix parsing nested __if_exists blocks
Rather than having kw___if_exists be a special case of
ParseCompoundStatementBody, we can look for kw___if_exists in the big
switch over for valid statement tokens in ParseStatementOrDeclaration.
Nested __if_exists blocks are used in the DECLARE_REGISTRY_RESOURCEID
macro from atlcom.h.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@211654 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Parse/ParseStmt.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index 536e92c0cc..f27634cb2a 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -273,6 +273,14 @@ Retry: break; } + case tok::kw___if_exists: + case tok::kw___if_not_exists: + ProhibitAttributes(Attrs); + ParseMicrosoftIfExistsStatement(Stmts); + // An __if_exists block is like a compound statement, but it doesn't create + // a new scope. + return StmtEmpty(); + case tok::kw_try: // C++ 15: try-block return ParseCXXTryBlock(); @@ -914,12 +922,6 @@ StmtResult Parser::ParseCompoundStatementBody(bool isStmtExpr) { continue; } - if (getLangOpts().MicrosoftExt && (Tok.is(tok::kw___if_exists) || - Tok.is(tok::kw___if_not_exists))) { - ParseMicrosoftIfExistsStatement(Stmts); - continue; - } - StmtResult R; if (Tok.isNot(tok::kw___extension__)) { R = ParseStatementOrDeclaration(Stmts, false); |