[cfe-dev] Including header file using clang

Riyad Parvez riyad.parvez at gmail.com
Mon May 11 17:37:15 PDT 2015


I admit it's simple, can be doable without Clang. Basically, I'm 
developing a refactoring tool which do some analysis on source and then 
decide whether to include a header file or not. So it would be nice if I 
can do this in one tool.

I realize this can't be done via Python bindings. Any one has any idea 
how I can do this using Clang refactoring lib?

Thanks
Riyad
On 05/11/2015 05:32 AM, Nikola Smiljanic wrote:
> You don't really need Clang for something as simple as that, whatever 
> you code in next 5 minutes will likely work in almost all circumstance :)
> PPCallback is what you'd use in Clang, I'm not sure if that's 
> accessible through Python, hopefully someone who know will chime in.
>
> On Mon, May 11, 2015 at 2:27 PM, Riyad Parvez 
> <riyad.parvez at uwaterloo.ca <mailto:riyad.parvez at uwaterloo.ca>> wrote:
>
>     Hi All,
>
>     I want to write tool in python which will go through every source
>     file and add preprocessor macro to the file.
>
>         #include <stdio.h>
>         #include "my_header.h"   // This should be inserted by clang
>         python tool
>
>         int main() {
>
>         }
>
>
>     How can I do this using Python bindings?
>
>     Thanks
>     Riyad
>
>     _______________________________________________
>     cfe-dev mailing list
>     cfe-dev at cs.uiuc.edu <mailto: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/20150511/a169f47b/attachment.html>


More information about the cfe-dev mailing list