aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseStmt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Parse/ParseStmt.cpp')
-rw-r--r--lib/Parse/ParseStmt.cpp17
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;