[LLVMdev] Insert a function call in the code

Duncan Sands baldrick at free.fr
Sat Nov 19 05:53:44 PST 2011


Hi 赵夏,

>              hookFunc = M.getOrInsertFunction("hook",
> Type::getVoidTy(M.getContext()), Type::getVoidTy(M.getContext()), (Type*)0);

try removing the second Type::getVoidTy.  Your function doesn't take any
parameters, so you should simply pass an empty list of parameter types.
Unlike in C++, a function foo(void) taking no parameters shouldn't be
declared as taking one parameter of void type, it takes no parameters.

Ciao, Duncan.



More information about the llvm-dev mailing list