[LLVMdev] how to add and call a function with void return value in functionpass.

Nick Lewycky nicholas at mxc.ca
Fri Apr 30 21:04:11 PDT 2010


Gang.Yao wrote:
> Hi:
>
> In a function pass, I tried to create a function which takes a int32 and
> return void.
> When I call this function with CallInst::Create and using opt, it always
> has the error report:
>
> opt: Value.cpp:189: void llvm::Value::setName(const llvm::Twine&):
> Assertion `getType() != Type::getVoidTy(getContext()) && "Cannot assign
> a name to void values!"' failed.

Don't try to pass a name in to CallInst::Create when trying to create a 
call that returns void.

Nick

> if I change the return type to int32, then it works.
>
> so what is the special trick to use a function with void return type.
>
> Any help would be appreciated.
>
> --
> --Gang.
>
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list