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.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