[cfe-dev] argv[0] in libclang

Manuel Klimek via cfe-dev cfe-dev at lists.llvm.org
Mon Oct 26 12:30:24 PDT 2015


Note that this is about the standard c++ headers, not the builtin headers.

On Mon, Oct 26, 2015, 7:12 PM Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:

>
> > On Oct 15, 2015, at 1:30 AM, Benjamin Kramer via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
> >
> > Hi,
> >
> > currently all libclang APIs that get passed a command line expect that
> > there is no argv[0] in the list, i. e. no binary name at the beginning
> > of the command line. We later fake one
> > (clang::createInvocationFromCommandLine) as the invocation gets passed
> > down into the proper clang machinery.
> >
> > This is nasty because it changes the behavior if the original clang
> > invocation would've used a relative path to the standard library:
> >
> > cmdline: /foo/bar/bin/clang -c test.cc
> > std lib in: /foo/bar/include/c++
> > libclang sees: -c test.cc
> >
> > and the stdlib is lost. This comes up if we're using a compile
> > database, for example ycm is using it like this.
> >
> > The only sane solution I see at the moment is to add a new libclang
> > API that expects a full argv. Any other ideas?
>
> You are talking about inferring the resources path from argv[0], but this
> is not 100% correct, libclang should be including the right clang and
> stdlib headers for the version it was compiled with.
>
> Is there a particular reason why you can’t have libclang setup so that it
> can find the proper headers ?
>
> >
> > - Ben
> > _______________________________________________
> > cfe-dev mailing list
> > cfe-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20151026/24576933/attachment.html>


More information about the cfe-dev mailing list