Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Return Void from function LLVM

I have created a function in LLVM IR. Now I want to create a return instruction return void.

I saw the function Create ReturnInst::(LLVMContext &C, Value *retVal, BasicBlock *InsertAtEnd)

But I don't know what should retVal should be so that it returns return void

like image 484
coder hacker Avatar asked Nov 15 '14 17:11

coder hacker


2 Answers

If you pass in nullptr to retVal (which is its default value too) that will give you a 'ret void'.

like image 148
ScottyP Avatar answered Nov 16 '22 10:11

ScottyP


Seems this code works: UndefValue::get(Type::getVoidTy(Context))

like image 1
Fangqing Du Avatar answered Nov 16 '22 09:11

Fangqing Du