Retrieving Appropriate Headers

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.