diff options
author | Joao Matos <ripzonetriton@gmail.com> | 2012-09-02 03:45:41 +0000 |
---|---|---|
committer | Joao Matos <ripzonetriton@gmail.com> | 2012-09-02 03:45:41 +0000 |
commit | 5be92de217a1940d0e109abd0f401df4480c1a4b (patch) | |
tree | c2fbd3398756cea5b88a7ddebc6ec17e31af314f /lib/Parse/ParseStmt.cpp | |
parent | 850388527e89b802e2f658484200d8584ed5f238 (diff) |
Implemented parsing and AST support for the MS __leave exception statement. Also a minor fix to __except printing in StmtPrinter.cpp. Thanks to Aaron Ballman for review.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@163083 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseStmt.cpp')
-rw-r--r-- | lib/Parse/ParseStmt.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/Parse/ParseStmt.cpp b/lib/Parse/ParseStmt.cpp index f58f90d56c..f46ccb255a 100644 --- a/lib/Parse/ParseStmt.cpp +++ b/lib/Parse/ParseStmt.cpp @@ -183,6 +183,19 @@ Retry: return ParseExprStatement(); } + + case tok::kw___leave: { + Token LeaveTok = Tok; + ConsumeToken(); + if (getCurScope()->isSEHTryScope()) { + Res = Actions.ActOnSEHLeaveStmt(LeaveTok.getLocation()); + } else { + Diag(LeaveTok, diag::err_seh___try_block) + << LeaveTok.getIdentifierInfo()->getName(); + Res = StmtError(); + } + break; + } case tok::kw_case: // C99 6.8.1: labeled-statement return ParseCaseStatement(); @@ -322,7 +335,9 @@ StmtResult Parser::ParseSEHTryBlockCommon(SourceLocation TryLoc) { if(Tok.isNot(tok::l_brace)) return StmtError(Diag(Tok,diag::err_expected_lbrace)); - StmtResult TryBlock(ParseCompoundStatement()); + // Use the SEHTryScope to handle __leave as a statement. + unsigned ScopeFlags = Scope::DeclScope | Scope::SEHTryScope; + StmtResult TryBlock(ParseCompoundStatement(false /*isStmtExpr*/, ScopeFlags)); if(TryBlock.isInvalid()) return TryBlock; |