[cfe-dev] Identifying function calls made to a library

Nikola Smiljanic popizdeh at gmail.com
Mon Aug 11 19:02:14 PDT 2014

The compiler itself has no idea where your calls point to. It just requires
that you provide declaration for functions and classes you're using and
these are pulled in via includes.

That doesn't mean that you can't detect this yourself. If your library
headers are located inside /mylib you could:

- get the callee from CallExpr
- get the location of the function or member declaration
- and ask SourceManager what file it belongs to
- compare paths.

On Tue, Aug 12, 2014 at 10:23 AM, Sandeep K Chaudhary <
babbusandy2006 at gmail.com> wrote:

> Hi Guys,
> I am trying to identify all the function calls made to a particular
> library. While visiting all the statements in the Clang AST, I can find the
> "CallExpr" but I don't know how I can figure out if the callee belongs to a
> particular library.
> What characteristics a callee belonging to a library will have? Is there
> even a way to distinguish a callee in a library from a  callee defined in
> the same source file? Please let me know.
> Thanks a lot !
> Regards,
> Sandeep.
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140812/e6562e28/attachment.html>

More information about the cfe-dev mailing list