Hi all, I have to create a return instruction in a function. The function is of type -- void * func (void *) . So i have to create a return instruction for the function that should return a void pointer. But actually the function will not return anything useful . it will be something like -- return void * null. The problem i am facing is to create a return instruction the Create function expects a pointer to a value and i am not able to do that. How do i create such a return instruction. Thanks, Rohith. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100417/e06b2439/attachment.html>
On 17 April 2010 23:12, Rohith Goparaju <rgoparaj at umail.iu.edu> wrote:> But actually the function will not return anything useful. >Then I assume it should return an undef: http://llvm.org/docs/LangRef.html#undefvalues
Rohith Goparaju wrote:> Hi all, > > I have to create a return instruction in a function. The function is > of type -- void * func (void *) . So i have to create a return > instruction for the function that should return a void pointer. But > actually the function will not return anything useful . it will be > something like -- return void * null. The problem i am facing is to > create a return instruction the Create function expects a pointer to a > value and i am not able to do that. How do i create such a return > instruction.'void *' is not a valid LLVM type. Did you mean 'i8 *'? LLVMContext C; const Type *Ty = Type::getInt8Ty(C)->getPointerTo(); 'ret i8* null': Builder.CreateRet(Constant::getNullValue(Ty)); 'ret i8* undef': Builder.CreateRet(UndefValue::get(Ty)); Nick