[PATCH] D54872: [clangd] Add ability to not use -resource-dir at all

Marc-Andre Laperle via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 26 20:50:47 PST 2018


malaperle planned changes to this revision.
malaperle added a comment.

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

> We have to point clangd into the resource dir, corresponding to the version of the headers it was built with. It's important we pick the exact version of the built-in headers that clangd was built for.


Can you clarity/confirm "headers it was built with"? For example, if I build Clangd using Xcode's Clang, then running this Clangd, I would have to point to Xcode's Clang headers? This is what I have observed when using Clangd on Clangd's code. What if I compile Clangd with another non-Clang compiler?

> Note that resource-dir should **only** be used for the built-in headers, any compiler-specific libraries should be found using other flags. Could you provide an example clang-cl commands that it breaks with?

The problematic case is a bit different than I originally thought. The CDB contains an include path to the built-in headers of the Clang (windows installer) used to build the project, let's call the compiler Clang1. I also built Clang+Clangd separately from this Clang1, using CL, let's call it Clang2. When running that custom Clangd, the fallback resource-dir is the one from Clang2. I haven't looked deeply to confirm this, but having an include path to Clang1 (windows installer) and resource-dir to Clang2 (custom build) seems like would likely not work. In fact, when running Clangd from Clang2 and setting resource-dir to Clang1, it works properly. Now, I don't know if it's the CDB that's wrongly including the headers of Clang1 or if the CDB should include -resource-dir to Clang1. In any case, I'll spend a bit more time clarifying this.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D54872





More information about the cfe-commits mailing list