[clangd] Store paths as requested in PreambleStatCache
authorKadir Cetinkaya <kadircet@google.com>
Tue, 23 May 2023 07:47:57 +0000 (09:47 +0200)
committerKadir Cetinkaya <kadircet@google.com>
Tue, 23 May 2023 12:30:58 +0000 (14:30 +0200)
commit35ce741ef3e3dd9db1da3ea0a06c565cb90f665a
treed9bb7c9e6faf935d3a253f3d23ccfcd134f9c98e
parent70688e82e2fd6b486931669b981c18f3830385b5
[clangd] Store paths as requested in PreambleStatCache

Underlying FS can store different file names inside the stat response
(e.g. symlinks resolved, absolute paths, dots removed). But we store path names
as requested inside the preamble,
https://github.com/llvm/llvm-project/blob/main/clang/lib/Serialization/ASTWriter.cpp#L1635.

This improves cache hit rates from ~30% to 90% in a build system that uses
symlinks.

Differential Revision: https://reviews.llvm.org/D151185
clang-tools-extra/clangd/FS.cpp
clang-tools-extra/clangd/FS.h
clang-tools-extra/clangd/unittests/FSTests.cpp