summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGException.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2015-12-14 18:34:18 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2015-12-14 18:34:18 +0000
commitfeeefb214dfa398df4cec92b1e9f3e3219d3944f (patch)
tree51029601bc29c11fb0de35224621891fbf59cc23 /clang/lib/CodeGen/CGException.cpp
parentaccc3e03765fc3d623af6198458936f8c9029036 (diff)
downloadbcm5719-llvm-feeefb214dfa398df4cec92b1e9f3e3219d3944f.tar.gz
bcm5719-llvm-feeefb214dfa398df4cec92b1e9f3e3219d3944f.zip
[MS ABI] Don't rely on terminatepad
We'd like to remove support for terminatepad from LLVM. To do this, we need to move Clang off of it first. The intent behind terminatepad was to carefully model exception specifications for the MSVC personality. However, we don't support exception specifications for the MSVC personality and neither does MSVC. Instead, MSVC supports all-or-nothing exception specifications. We can model this limited usage using cleanuppads which call std::terminate. Differential Revision: http://reviews.llvm.org/D15478 llvm-svn: 255521
Diffstat (limited to 'clang/lib/CodeGen/CGException.cpp')
-rw-r--r--clang/lib/CodeGen/CGException.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CGException.cpp b/clang/lib/CodeGen/CGException.cpp
index b5e1dcdc6c9..a064e6246a7 100644
--- a/clang/lib/CodeGen/CGException.cpp
+++ b/clang/lib/CodeGen/CGException.cpp
@@ -1325,21 +1325,20 @@ llvm::BasicBlock *CodeGenFunction::getTerminateHandler() {
// end of the function by FinishFunction.
TerminateHandler = createBasicBlock("terminate.handler");
Builder.SetInsertPoint(TerminateHandler);
+ llvm::Value *Exn = nullptr;
if (EHPersonality::get(*this).usesFuncletPads()) {
llvm::Value *ParentPad = CurrentFuncletPad;
if (!ParentPad)
ParentPad = llvm::ConstantTokenNone::get(CGM.getLLVMContext());
- Builder.CreateTerminatePad(ParentPad, /*UnwindBB=*/nullptr,
- {CGM.getTerminateFn()});
+ Builder.CreateCleanupPad(ParentPad);
} else {
- llvm::Value *Exn = nullptr;
if (getLangOpts().CPlusPlus)
Exn = getExceptionFromSlot();
- llvm::CallInst *terminateCall =
- CGM.getCXXABI().emitTerminateForUnexpectedException(*this, Exn);
- terminateCall->setDoesNotReturn();
- Builder.CreateUnreachable();
}
+ llvm::CallInst *terminateCall =
+ CGM.getCXXABI().emitTerminateForUnexpectedException(*this, Exn);
+ terminateCall->setDoesNotReturn();
+ Builder.CreateUnreachable();
// Restore the saved insertion state.
Builder.restoreIP(SavedIP);
OpenPOWER on IntegriCloud