[cfe-commits] r129273 - in /cfe/trunk: lib/CodeGen/CGExprCXX.cpp test/CodeGenCXX/typeid.cpp

John McCall rjmccall at apple.com
Mon Apr 11 10:22:23 PDT 2011


On Apr 11, 2011, at 7:13 AM, Anders Carlsson wrote:
> Author: andersca
> Date: Mon Apr 11 09:13:40 2011
> New Revision: 129273
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=129273&view=rev
> Log:
> If there's an invoke destination, we should use invoke instead of call when calling the __cxa_bad_typeid function. Fixes PR7400.

Nice catch!

> +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();
> +  
> +  CGF.Builder.CreateUnreachable();
> +}
> +

CGF.EmitCallOrInvoke(...).setDoesNotReturn();
CGF.Builder.CreateUnreachable();

John.



More information about the cfe-commits mailing list