Gang.Yao
2010-Apr-30 23:12 UTC
[LLVMdev] how to add and call a function with void return value in functionpass.
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. 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. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100430/a0f40ed9/attachment.html>
Nick Lewycky
2010-May-01 04:04 UTC
[LLVMdev] how to add and call a function with void return value in functionpass.
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