[cfe-dev] Retrieving Appropriate Headers

Pedro Delgado Perez pedro.delgadoperez at mail.uca.es
Wed May 7 02:02:55 PDT 2014


 
Hi,

Some C++ programs include headers which are not in the same directory as the file being processed. In some cases, it is used a path relative to the file, for instance "directory/file.h". And in some other cases, the headers are included in a way understandable to the build system of the program, even using angled headers "<name/file.h> and that path is not relative to its location. 

The problem for me is that I don't know how can I indicate in my tool the exact location of headers which are not in the same directory when creating the AST. 

I'm using something like this to parse the code:

 ...
 ClangTool Tool(OptionsParser.getCompilations(), file); 
 Tool.run(newFrontendActionFactory(&mytool));
...

so I would need to tell the object "Tool" to find also in other directories, for instance, a mapping of the headers included and their directory. Or is there a simple way to do this that I'm overlooking?

Thanks,

Pedro.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20140507/2475ad14/attachment.html>


More information about the cfe-dev mailing list