[clang-tools-extra] [clangd] Add background index path remapping tool (PR #185482)
Aleksandr Platonov via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 27 06:29:58 PDT 2026
ArcsinX wrote:
> As far as I can tell, the new binary does a bunch of string processing, but it depends on the full clangDaemon library, meaning building the new binary requires compiling all of clang. Could the new binary have fewer dependencies, to make it faster to build, and likely smaller too?
Roughly, the tool works like this:
- deserializes the index (clangd-specific)
- replaces strings (uses the mapping implementation from clangd)
- serializes back (clangd-specific)
So, this isn't just a string replacement, and a separate implementation (without clangDaemon library usage) will require updating whenever the clangd index format changes.
In terms of build time and size, (tested on my local environment):
- clangd-remap is 12 Mb. For comparison, clangd is 112 Mb, clang is 233 Mb
- If clangd is built, the build is almost instantaneous (compilation of 1 source file + linking).
In other words, this is not impossible to rewrite clangd-remap without clangDaemon library usage, but it looks unreasonable to potentially save 11Mb. Furthermore, we have other `clangd-*` tools, and `clangd-remap` is the smallest of them:
```
112M bin/clangd
71M bin/clangd-indexer
47M bin/clangd-index-server
35M bin/clangd-index-server-monitor
12M bin/clangd-remap
```
https://github.com/llvm/llvm-project/pull/185482
More information about the cfe-commits
mailing list