<div style="font-family: arial, helvetica, sans-serif; font-size: 10pt">On Thu, Nov 8, 2012 at 10:42 AM, Mehdi AMINI <span dir="ltr"><<a href="mailto:mehdi.amini@silkan.com" target="_blank">mehdi.amini@silkan.com</a>></span> wrote:<br>
<div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
<br>
<br>
Le 08/11/2012 10:22, Manuel Klimek a écrit :<div class="im"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
See here for what's needed to build a tool on top of clang:<br>
<a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/Tooling.cpp?revision=166508&view=markup" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/cfe/trunk/lib/Tooling/<u></u>Tooling.cpp?revision=166508&<u></u>view=markup</a><br>

(the solution is to use the Driver, which handles finding of builtin and<br>
system includes)<br>
<br>
Alternatively, you can just use the tooling library :) (see<br>
<a href="http://clang.llvm.org/docs/LibTooling.html" target="_blank">http://clang.llvm.org/docs/<u></u>LibTooling.html</a>)<br>
</blockquote>
<br></div>
None of these solutions relieves you from building your binary at the same place at Clang is installed, or duplicate the Clang headers along your tool installation so that they are in PATH_TO_BIN/../lib/...<br>
Or did I miss something at some point?</blockquote><div><br></div><div>What you can do is slurp up the builtin headers as char*'s in your sources, compile them into your binary, and use virtual files at runtime with LibTooling (we're actually doing that for our internal mapreduce framework).</div>
<div><br></div><div>The problem with this approach, and the main reason Chandler has opposed doing that for quite some time, is that when you see errors that reference the builtin headers you'll not be able to open those files from your editor (Chandler will jump in if I misrepresented his views :)</div>
<div><br></div><div>Cheers,</div><div>/Manuel</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
    I tried to add the system headers manually using<br>
    "HeaderSearchOptions.Add" but (1) this is not portable and (2)<br>
    anyway I can't make that work either.<br>
<br>
    Could you please explain me more in details how Clang does to find<br>
    the default system headers ?<br>
    I attach the source file of my simple prototype.<br>
</blockquote>
<br>
<br></div>
>From my (very shallow) experience, unless you get very deep with the initialization it end up by looking the headers from the place the binary is installed.<br>
<br>
Best,<br>
<br>
Mehdi<br>
</blockquote></div><br></div></div>