summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaStmt.cpp
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2014-07-06 22:53:19 +0000
committerNico Weber <nicolasweber@gmx.de>2014-07-06 22:53:19 +0000
commiteb61d4d7c2fdc089c5625aa1128c844edd51285f (patch)
tree6dd096b3b22dd563046e02f1301e524b8545d3a1 /clang/lib/Sema/SemaStmt.cpp
parentc7d0596429b6051c212a5ae1864c8635ab8ae906 (diff)
downloadbcm5719-llvm-eb61d4d7c2fdc089c5625aa1128c844edd51285f.tar.gz
bcm5719-llvm-eb61d4d7c2fdc089c5625aa1128c844edd51285f.zip
Sema: Check that __leave is contained in a __try block.
Give scope a SEHTryScope bit, set that in ParseSEHTry(), and let Sema walk the scope chain to find the SEHTry parent on __leave statements. (They are rare enough that it seems better to do the walk instead of giving Scope a SEHTryParent pointer -- this is similar to AtCatchScope.) llvm-svn: 212422
Diffstat (limited to 'clang/lib/Sema/SemaStmt.cpp')
-rw-r--r--clang/lib/Sema/SemaStmt.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index 6090d6d14d4..0b778918543 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/lib/Sema/SemaStmt.cpp
@@ -3279,6 +3279,12 @@ Sema::ActOnSEHFinallyBlock(SourceLocation Loc,
StmtResult
Sema::ActOnSEHLeaveStmt(SourceLocation Loc, Scope *CurScope) {
+ Scope *SEHTryParent = CurScope;
+ while (SEHTryParent && !SEHTryParent->isSEHTryScope())
+ SEHTryParent = SEHTryParent->getParent();
+ if (!SEHTryParent)
+ return StmtError(Diag(Loc, diag::err_ms___leave_not_in___try));
+
return StmtError(Diag(Loc, diag::err_ms___leave_unimplemented));
}
OpenPOWER on IntegriCloud