<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Thu, Oct 15, 2015 at 11:02 AM Milian Wolff via cfe-dev <<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Thursday, October 15, 2015 10:30:54 AM CEST Benjamin Kramer via cfe-dev<br>
wrote:<br>
> Hi,<br>
><br>
> currently all libclang APIs that get passed a command line expect that<br>
> there is no argv[0] in the list, i. e. no binary name at the beginning<br>
> of the command line. We later fake one<br>
> (clang::createInvocationFromCommandLine) as the invocation gets passed<br>
> down into the proper clang machinery.<br>
><br>
> This is nasty because it changes the behavior if the original clang<br>
> invocation would've used a relative path to the standard library:<br>
><br>
> cmdline: /foo/bar/bin/clang -c test.cc<br>
> std lib in: /foo/bar/include/c++<br>
> libclang sees: -c test.cc<br>
><br>
> and the stdlib is lost. This comes up if we're using a compile<br>
> database, for example ycm is using it like this.<br>
><br>
> The only sane solution I see at the moment is to add a new libclang<br>
> API that expects a full argv. Any other ideas?<br>
<br>
In KDevelop, we parse the output of<br>
<br>
        clang++ --std=c++11 -xc++ -E -v /dev/null<br>
<br>
and pass those in to liblcang as explicit include paths. It works fine for our<br>
use case.</blockquote><div><br></div><div>Note that this might also be wrong.</div><div>If you have multiple compilers / libstdc++'s installed, it is important to take the right one for the current project you work in.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> But for a simpler tool it might be far too much overhead of course<br>
to get up and running. Couldn't the code path in clang use the path to the<br>
clang library as a fallback when no binary is given? That way, nothing needs<br>
to be changed.<br>
<br>
Bye<br>
--<br>
Milian Wolff<br>
<a href="mailto:mail@milianw.de" target="_blank">mail@milianw.de</a><br>
<a href="http://milianw.de" rel="noreferrer" target="_blank">http://milianw.de</a><br>
_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
</blockquote></div></div>