I’m using clangd on windows/linux for indexing company’s project. The project is organized (in terms of cpp files, header files) in um… unorthodox way so that we heavily rely on the precompiled-header technology.
The rough structure is layered and somewhat looks as following:
Layer 1: a bunch of headers that all are included into one stdafx.h on that level
Layer 2: first includes stdafx.h from Layer 1 and then also includes a bunch of own headers into own stdafx.h
Layer 3: includes stdafx.h from Layer 2 and then… you get the idea.
So while building we create precompiled header for the Nth layer once and re-use it via -include-pch flag when creating the PCH for the N+1th layer. Overall this gives acceptable full-rebuild times on a single machine.
Now in order to make clangd work on our project I had to ‘hack’ it a bit to make it understand certain source file dependencies and how to correctly infer compilation commands for particular cpp/header files in our case and it all works as expected however now the performance is somewhat of an issue and I believe it can be addressed if I could ‘teach’ clangd to deal with PCH the same way we do during the build process.
If someone could point me into the direction where relevant code in clangd is (e.g. for building/re-using preamble), that would be nice. And maybe some hints/advices along the way