search for: iscalltofree

Displaying 2 results from an estimated 2 matches for "iscalltofree".

2009 Jun 18
2
[LLVMdev] Referring to an argument in another function
...call of my own that takes some of the same arguments. For example, I would like to instrument calls to free with some function foo, so the C code would look like: foo(myarg1, myarg2, ptr); free(ptr); The problem occurs when I grab the arg from the free function and try to pass it to foo... if (isCallToFree(&I)) { Value* P; if (Function *F = I.getCalledFunction()) { Function::arg_iterator ait = F->arg_begin(); if (ait) { P = &(*ait); } createCallInst(mem_fcall, &I, 3, getOpcodeValue(I), getInstrIDValue(), P); } } create...
2009 Jun 18
0
[LLVMdev] Referring to an argument in another function
...ts. For example, I would > like to instrument calls to free with some function foo, so the C code > would look like: > > foo(myarg1, myarg2, ptr); > free(ptr); > > The problem occurs when I grab the arg from the free function and try > to pass it to foo... > > if (isCallToFree(&I)) { > Value* P; > if (Function *F = I.getCalledFunction()) { > Function::arg_iterator ait = F->arg_begin(); You want to look at the operands of the call/invoke/free instruction, not the arguments of the function being called. So if you're sure it's a call...