From 69132a7fb28600d47e43f4f776f6352856efb967 Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Fri, 3 Apr 2015 22:49:05 +0000 Subject: [WinEH] Fill out .xdata for catch objects This add support for catching an exception such that an exception object available to the catch handler will be initialized by the runtime. llvm-svn: 234062 --- llvm/lib/CodeGen/WinEHPrepare.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'llvm/lib/CodeGen/WinEHPrepare.cpp') diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp index d12a8ed472b..9ebe8a2fc10 100644 --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/llvm/lib/CodeGen/WinEHPrepare.cpp @@ -1595,7 +1595,7 @@ CleanupHandler *WinEHPrepare::findCleanupHandler(BasicBlock *StartBB, // This is a public function, declared in WinEHFuncInfo.h and is also // referenced by WinEHNumbering in FunctionLoweringInfo.cpp. void llvm::parseEHActions(const IntrinsicInst *II, - SmallVectorImpl &Actions) { + SmallVectorImpl &Actions) { for (unsigned I = 0, E = II->getNumArgOperands(); I != E;) { uint64_t ActionKind = cast(II->getArgOperand(I))->getZExtValue(); @@ -1609,14 +1609,14 @@ void llvm::parseEHActions(const IntrinsicInst *II, CH->setHandlerBlockOrFunc(Handler); CH->setExceptionVarIndex(EHObjIndexVal); Actions.push_back(CH); - } - else { - assert(ActionKind == 0 && "expected a cleanup or a catch action!"); + } else if (ActionKind == 0) { Constant *Handler = cast(II->getArgOperand(I + 1)); I += 2; auto *CH = new CleanupHandler(/*BB=*/nullptr); CH->setHandlerBlockOrFunc(Handler); Actions.push_back(CH); + } else { + llvm_unreachable("Expected either a catch or cleanup handler!"); } } std::reverse(Actions.begin(), Actions.end()); -- cgit v1.2.3