Index: lib/CodeGen/CGCleanup.cpp =================================================================== --- lib/CodeGen/CGCleanup.cpp +++ lib/CodeGen/CGCleanup.cpp @@ -904,8 +904,7 @@ 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 @@ } if (CPI) - Builder.CreateCleanupRet(NextAction, CPI); + Builder.CreateCleanupRet(CPI, NextAction); else Builder.CreateBr(NextAction); Index: lib/CodeGen/CGException.cpp =================================================================== --- lib/CodeGen/CGException.cpp +++ lib/CodeGen/CGException.cpp @@ -887,11 +887,10 @@ 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. Index: lib/CodeGen/MicrosoftCXXABI.cpp =================================================================== --- lib/CodeGen/MicrosoftCXXABI.cpp +++ lib/CodeGen/MicrosoftCXXABI.cpp @@ -859,7 +859,7 @@ 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(