From: Anders Carlsson Date: Wed, 13 Apr 2011 02:35:36 +0000 (+0000) Subject: Use EmitCallOrInvoke in EmitBadTypeidCall and EmitBadCastCall. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ad3692bbe1874abafae1757a2b9d3bfa2249dc43;p=clang Use EmitCallOrInvoke in EmitBadTypeidCall and EmitBadCastCall. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129424 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp index 4d5f8827de..4caba15cb2 100644 --- a/lib/CodeGen/CGExprCXX.cpp +++ b/lib/CodeGen/CGExprCXX.cpp @@ -17,6 +17,8 @@ #include "CGObjCRuntime.h" #include "CGDebugInfo.h" #include "llvm/Intrinsics.h" +#include "llvm/Support/CallSite.h" + using namespace clang; using namespace CodeGen; @@ -1349,14 +1351,8 @@ static llvm::Constant *getBadTypeidFn(CodeGenFunction &CGF) { } static void EmitBadTypeidCall(CodeGenFunction &CGF) { - llvm::Value *F = getBadTypeidFn(CGF); - if (llvm::BasicBlock *InvokeDest = CGF.getInvokeDest()) { - llvm::BasicBlock *Cont = CGF.createBasicBlock("invoke.cont"); - CGF.Builder.CreateInvoke(F, Cont, InvokeDest)->setDoesNotReturn(); - CGF.EmitBlock(Cont); - } else - CGF.Builder.CreateCall(F)->setDoesNotReturn(); - + llvm::Value *Fn = getBadTypeidFn(CGF); + CGF.EmitCallOrInvoke(Fn, 0, 0).setDoesNotReturn(); CGF.Builder.CreateUnreachable(); } @@ -1437,14 +1433,8 @@ static llvm::Constant *getBadCastFn(CodeGenFunction &CGF) { } static void EmitBadCastCall(CodeGenFunction &CGF) { - llvm::Value *F = getBadCastFn(CGF); - if (llvm::BasicBlock *InvokeDest = CGF.getInvokeDest()) { - llvm::BasicBlock *Cont = CGF.createBasicBlock("invoke.cont"); - CGF.Builder.CreateInvoke(F, Cont, InvokeDest)->setDoesNotReturn(); - CGF.EmitBlock(Cont); - } else - CGF.Builder.CreateCall(F)->setDoesNotReturn(); - + llvm::Value *Fn = getBadCastFn(CGF); + CGF.EmitCallOrInvoke(Fn, 0, 0).setDoesNotReturn(); CGF.Builder.CreateUnreachable(); }