[WinEH] Update to new EH pad/ret signatures (with tokens required)

Summary:
The signatures of the methods in LLVM for creating EH pads/rets are changing
to require token arguments on rets and assume token return type on pads.
Update creation code accordingly.

Reviewers: majnemer, rnk

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D12109

llvm-svn: 245798
This commit is contained in:
Joseph Tremoulet 2015-08-23 00:26:48 +00:00
parent 8220bcc570
commit ce536a596b
3 changed files with 6 additions and 8 deletions

View File

@ -904,8 +904,7 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) {
llvm::BasicBlock *NextAction = getEHDispatchBlock(EHParent);
if (CGM.getCodeGenOpts().NewMSEH &&
EHPersonality::get(*this).isMSVCPersonality())
CPI = Builder.CreateCleanupPad(llvm::Type::getTokenTy(getLLVMContext()),
{});
CPI = Builder.CreateCleanupPad({});
// We only actually emit the cleanup code if the cleanup is either
// active or was used before it was deactivated.
@ -916,7 +915,7 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) {
}
if (CPI)
Builder.CreateCleanupRet(NextAction, CPI);
Builder.CreateCleanupRet(CPI, NextAction);
else
Builder.CreateBr(NextAction);

View File

@ -887,11 +887,10 @@ static llvm::BasicBlock *emitMSVCCatchDispatchBlock(CodeGenFunction &CGF,
if (EHPersonality::get(CGF).isMSVCXXPersonality()) {
CGF.Builder.CreateCatchPad(
llvm::Type::getTokenTy(CGF.getLLVMContext()), Handler.Block,
NextBlock, {TypeValue, llvm::Constant::getNullValue(CGF.VoidPtrTy)});
Handler.Block, NextBlock,
{TypeValue, llvm::Constant::getNullValue(CGF.VoidPtrTy)});
} else {
CGF.Builder.CreateCatchPad(llvm::Type::getTokenTy(CGF.getLLVMContext()),
Handler.Block, NextBlock, {TypeValue});
CGF.Builder.CreateCatchPad(Handler.Block, NextBlock, {TypeValue});
}
// Otherwise we need to emit and continue at that block.

View File

@ -859,7 +859,7 @@ struct CallEndCatchMSVC final : EHScopeStack::Cleanup {
void Emit(CodeGenFunction &CGF, Flags flags) override {
if (CGF.CGM.getCodeGenOpts().NewMSEH) {
llvm::BasicBlock *BB = CGF.createBasicBlock("catchret.dest");
CGF.Builder.CreateCatchRet(BB, CPI);
CGF.Builder.CreateCatchRet(CPI, BB);
CGF.EmitBlock(BB);
} else {
CGF.EmitNounwindRuntimeCall(