[llvm-commits] [llvm] r86525 - /llvm/trunk/lib/VMCore/Instructions.cpp
Victor Hernandez
vhernandez at apple.com
Mon Nov 9 10:29:14 PST 2009
Thanks for pointing this out, Duncan, and for fixing this, Chris.
Victor
On Nov 8, 2009, at 11:12 PM, Chris Lattner wrote:
> Author: lattner
> Date: Mon Nov 9 01:12:01 2009
> New Revision: 86525
>
> URL: http://llvm.org/viewvc/llvm-project?rev=86525&view=rev
> Log:
> make this handle redefinition of malloc with different prototype
> correctly.
>
> Modified:
> llvm/trunk/lib/VMCore/Instructions.cpp
>
> Modified: llvm/trunk/lib/VMCore/Instructions.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Instructions.cpp?rev=86525&r1=86524&r2=86525&view=diff
>
> =
> =
> =
> =
> =
> =
> =
> =
> ======================================================================
> --- llvm/trunk/lib/VMCore/Instructions.cpp (original)
> +++ llvm/trunk/lib/VMCore/Instructions.cpp Mon Nov 9 01:12:01 2009
> @@ -568,8 +568,7 @@
> const Type *VoidTy = Type::getVoidTy(M->getContext());
> const Type *IntPtrTy = Type::getInt8PtrTy(M->getContext());
> // prototype free as "void free(void*)"
> - Function *FreeFunc = cast<Function>(M->getOrInsertFunction
> ("free", VoidTy,
> -
> IntPtrTy, NULL));
> + Value *FreeFunc = M->getOrInsertFunction("free", VoidTy,
> IntPtrTy, NULL);
> CallInst* Result = NULL;
> Value *PtrCast = Source;
> if (InsertBefore) {
> @@ -582,7 +581,8 @@
> Result = CallInst::Create(FreeFunc, PtrCast, "");
> }
> Result->setTailCall();
> - Result->setCallingConv(FreeFunc->getCallingConv());
> + if (Function *F = dyn_cast<Function>(FreeFunc))
> + Result->setCallingConv(F->getCallingConv());
>
> return Result;
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
More information about the llvm-commits
mailing list