<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt">See here for what's needed to build a tool on top of clang:<div><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Tooling.cpp?revision=166508&view=markup">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Tooling.cpp?revision=166508&view=markup</a><br>
</div><div>(the solution is to use the Driver, which handles finding of builtin and system includes)</div><div><br></div><div>Alternatively, you can just use the tooling library :) (see <a href="http://clang.llvm.org/docs/LibTooling.html">http://clang.llvm.org/docs/LibTooling.html</a>)</div>
<div><br></div><div>Cheers,</div><div>/Manuel</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Nov 7, 2012 at 11:42 PM, Antoine Trouve <span dir="ltr"><<a href="mailto:trouve@isit.or.jp" target="_blank">trouve@isit.or.jp</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello everybody<br>
<br>
I am now using clang API in order to alter some C sources using my custom ASTVisitor, and I am struggling to make my CompilerInstance object to know about the path of default system headers.<br>
<br>
I have a protoype that uses the object CompilerInstance to initialize all the important stuffs (DiagnosticsEngine, Preprocessor ...) and calls "clang::ParseAST" at the end to use my own visitor.<br>
This prototype works well for simple file that do not use any system headers (e.g. "stdlib.h"), but when I want to use these, I get errors like:<br>
<br>
$ tsc.c:34:10: fatal error: 'stdlib.h' file not found<br>
$ #include <stdlib.h><br>
<br>
If I set "Verbose = 1" to the HeaderSearchOptions of my CompilerInstance object, I can see that indeed, my search list is empty:<br>
<br>
$ #include "..." search starts here:<br>
$ End of search list.<br>
<br>
I tried to add the system headers manually using "HeaderSearchOptions.Add" but (1) this is not portable and (2) anyway I can't make that work either.<br>
<br>
Could you please explain me more in details how Clang does to find the default system headers ?<br>
I attach the source file of my simple prototype.<br>
<br>
Best regards,<br>
<br>
- Antoine<br>
<br>
<br>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>