diff options
author | Nico Weber <nicolasweber@gmx.de> | 2015-02-12 23:16:11 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2015-02-12 23:16:11 +0000 |
commit | 5779f840005af201df8f60dfab514e4cafdebd8e (patch) | |
tree | 20dc5c974ba6066b54f1774119e23dfeee381c37 /clang/lib/CodeGen/CGException.cpp | |
parent | e4bcad475462a4e6cb09cc0e0fad1e661ca1e265 (diff) | |
download | bcm5719-llvm-5779f840005af201df8f60dfab514e4cafdebd8e.tar.gz bcm5719-llvm-5779f840005af201df8f60dfab514e4cafdebd8e.zip |
[ms] Implement codegen for __leave.
Reviewed at http://reviews.llvm.org/D7575
llvm-svn: 228977
Diffstat (limited to 'clang/lib/CodeGen/CGException.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGException.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp index 4ec87e07dfb..a76b3d82abb 100644 --- a/clang/lib/CodeGen/CGException.cpp +++ b/clang/lib/CodeGen/CGException.cpp @@ -1707,9 +1707,18 @@ void CodeGenFunction::EmitSEHTryStmt(const SEHTryStmt &S) { SEHFinallyInfo FI; EnterSEHTryStmt(S, FI); { + JumpDest TryExit = getJumpDestInCurrentScope("__try.__leave"); + SEHTryEpilogueStack.push_back(&TryExit); + // Disable inlining inside SEH __try scopes. SaveAndRestore<bool> Saver(IsSEHTryScope, true); EmitStmt(S.getTryBlock()); + + if (!TryExit.getBlock()->use_empty()) + EmitBlock(TryExit.getBlock(), /*IsFinished=*/true); + else + delete TryExit.getBlock(); + SEHTryEpilogueStack.pop_back(); } ExitSEHTryStmt(S, FI); } @@ -1988,5 +1997,13 @@ void CodeGenFunction::ExitSEHTryStmt(const SEHTryStmt &S, SEHFinallyInfo &FI) { } void CodeGenFunction::EmitSEHLeaveStmt(const SEHLeaveStmt &S) { - CGM.ErrorUnsupported(&S, "SEH __leave"); + // If this code is reachable then emit a stop point (if generating + // debug info). We have to do this ourselves because we are on the + // "simple" statement path. + if (HaveInsertPoint()) + EmitStopPoint(&S); + + assert(!SEHTryEpilogueStack.empty() && + "sema should have rejected this __leave"); + EmitBranchThroughCleanup(*SEHTryEpilogueStack.back()); } |