getCalledFunction

Hi,

The getCalledFunction on CallInst is returning NULL, although it is (directly)
calling a function, which is defined in the same file.

The getCalledFunction on CallInst is returning NULL, although it is (directly)
calling a function, which is defined in the same file.

...

the output is.

%tmp.10 = call int (...)* cast (int ()* %releaseLock to int (...)*)( )

This is the problem. This isn't a direct call, it's a call through a cast. If you run the -instcombine pass, I believe it will clean this up. Alternatively, you can prototype releaseLock in your source file properly. In C, use:

int releaseLock(void);

not:

int releaseLock();

... which in C are different.

-Chris