file name for Decl

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

file name for Decl

Cristina Basescu
Hi all,

I'm trying to find out the file name where a clang::Decl comes from. More precisely, I'd like to see which library a certain function comes from e.g. be able to find out that the definition of printf used in the analyzed program is in stdio.h. I thought using 'const char *getMangledName(const GlobalDecl &D)' from CodeGenModule.h could provide some information, however it seems that CodeGenModule is just used internally and, besides that, one should not count on the mangled names format.

Any ideas would be appreciated!

Best regards,
Cristina

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: file name for Decl

Chris Lattner

On Dec 31, 2009, at 11:29 AM, Cristina Basescu wrote:

> Hi all,
>
> I'm trying to find out the file name where a clang::Decl comes from. More precisely, I'd like to see which library a certain function comes from e.g. be able to find out that the definition of printf used in the analyzed program is in stdio.h. I thought using 'const char *getMangledName(const GlobalDecl &D)' from CodeGenModule.h could provide some information, however it seems that CodeGenModule is just used internally and, besides that, one should not count on the mangled names format.

Try getting a source location from the decl.  Given a source location, the SourceManager object can map the location back to a file/line/col for you.

-Chris


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: file name for Decl

Cristina Basescu


On Fri, Jan 1, 2010 at 5:45 AM, Chris Lattner <[hidden email]> wrote:

On Dec 31, 2009, at 11:29 AM, Cristina Basescu wrote:

> Hi all,
>
> I'm trying to find out the file name where a clang::Decl comes from. More precisely, I'd like to see which library a certain function comes from e.g. be able to find out that the definition of printf used in the analyzed program is in stdio.h. I thought using 'const char *getMangledName(const GlobalDecl &D)' from CodeGenModule.h could provide some information, however it seems that CodeGenModule is just used internally and, besides that, one should not count on the mangled names format.

Try getting a source location from the decl.  Given a source location, the SourceManager object can map the location back to a file/line/col for you.


Thanks, this is indeed the solution.

Best regards,
Cristina


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev