[cfe-dev] How to find the source file, the called function is defined inside

Himanshu via cfe-dev cfe-dev at lists.llvm.org
Fri Jul 22 09:37:54 PDT 2016


Hi,

You could use the getFilename() API by SourceManager. Get the function's
startLoc and then pass it to the getFileName( ).

--
Himanshu

On Thu, Jul 21, 2016 at 6:53 PM, Georgiou, Andreas via cfe-dev <
cfe-dev at lists.llvm.org> wrote:

> Hi all,
>
> I have an ASTvisitor and when it visits a CallExpr node, if the expression
> is a function call I would like to retrieve the filename of the source code
> where the called function is defined within. Is it possible?
>
> Thank you
>
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20160722/563e0270/attachment.html>


More information about the cfe-dev mailing list