[clangd] Make PreambleStatusCache handle filenames more carefully
authorSam McCall <sam.mccall@gmail.com>
Mon, 1 Jul 2019 10:11:18 +0000 (10:11 +0000)
committerSam McCall <sam.mccall@gmail.com>
Mon, 1 Jul 2019 10:11:18 +0000 (10:11 +0000)
commit9cca81344c861cebe7a11ebefc2d0cf6d180e8cd
tree92c20358f7d8a217f4e063da8720cfd3ae127a0a
parent4f878fe3a7d5f62b726e83bde0a23a268a875734
[clangd] Make PreambleStatusCache handle filenames more carefully

Summary:
 - when we hit the cache, the reported filename should be that of the
   cache query, not that of the cache store. This matches behaviors of
   common FSes, and avoids triggering difficult edge cases in
   FileManager when files are being moved around concurrently.
 - filename comparisons (both cache queries and == mainfile checks)
   should fold away . and .. in paths. These can appear when relative
   paths occur in compile_commands.json. (gn does this).

Reviewers: kadircet

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D63931

llvm-svn: 364740
clang-tools-extra/clangd/FS.cpp
clang-tools-extra/clangd/unittests/FSTests.cpp