[PATCH] D62804: [clangd] Enable extraction of system includes from custom toolchains

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 12 05:18:13 PDT 2019


kadircet added a comment.

In D62804#1538202 <https://reviews.llvm.org/D62804#1538202>, @ilya-biryukov wrote:

> In D62804#1538155 <https://reviews.llvm.org/D62804#1538155>, @kadircet wrote:
>
> > For example a gcc cross compiling to arm comes with its own system includes and has some mechanisms to discover that implicitly, without requiring any "-I" flags.
> >  Hence when used with clangd, we make use of system includes instead of the target's include library. This patch aims to solve that issue, tools like cquery also handles that problem in a similar way.
>
>
> That's exactly what driver is about. The approach is slightly different, though. Instead of executing a binary, one has to mimic the toolchain search logic of a particular toolchain by hand.
>  In addition to includes, it also handles adding the corresponding `-D` flags and anything else that the cross-compile toolchain does. Is this toolchain not currently supported by the driver? Is adding it so much work that we would choose to workaround like this instead?


As discussed offline, this is also a possible way to go. but looks like it requires making sure every toolchain has correct logic to deduce include paths which is more work and could become outdated, in addition to that it is also possible to introduce breakages due to new search logic. whereas this solution fixes the problem for all target.
So we decided to keep it clangd specific.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62804/new/

https://reviews.llvm.org/D62804





More information about the cfe-commits mailing list