Googlers: clangd has been installed on your glinux by default, just use
Alternative: use the following command to build clangd from LLVM source, and you will get the binary at
tools/clang/scripts/build_clang_tools_extra.py --fetch out/Release clangd
ninja -C out/Release chrome
tools/clang/scripts/generate_compdb.py -p out/Release > compile_commands.json
Note: the compilation database is not re-generated automatically, you'd need to regenerate it manually when you have new files checked in.
By default, clangd only knows the files you are currently editing. To provide project-wide code navigations (e.g. find references), clangd neesds a project-wide index.
You can pass an experimental
--background-index command line argument to clangd, clangd will incrementally build an index of Chromium in the background. Note: the first index time may take hours (for reference, it took 2~3 hours on a 48-core, 64GB machine).
A full index of Chromium (including v8, blink) takes ~550 MB disk space and ~2.7 GB memory in clangd.
If you have any questions, reach out to firstname.lastname@example.org.