diff options
| author | Ilya Biryukov <ibiryukov@google.com> | 2018-07-26 09:21:07 +0000 |
|---|---|---|
| committer | Ilya Biryukov <ibiryukov@google.com> | 2018-07-26 09:21:07 +0000 |
| commit | 1720113ace55cca0e5b0cc31de6c1c6a142130c1 (patch) | |
| tree | beddd155e2d2f85ab681ec0e51f75ee91bbf5ba3 /clang-tools-extra/unittests/clangd/TestFS.cpp | |
| parent | 31d38586e77fcd7a52e4905a078685d175eb5338 (diff) | |
| download | bcm5719-llvm-1720113ace55cca0e5b0cc31de6c1c6a142130c1.tar.gz bcm5719-llvm-1720113ace55cca0e5b0cc31de6c1c6a142130c1.zip | |
[clangd] Do not rebuild AST if inputs have not changed
Summary:
If the contents are the same, the update most likely comes from the
fact that compile commands were invalidated. In that case we want to
avoid rebuilds in case the compile commands are actually the same.
Reviewers: ioeric
Reviewed By: ioeric
Subscribers: simark, javed.absar, MaskRay, jkorous, arphaman, jfb, cfe-commits
Differential Revision: https://reviews.llvm.org/D49783
llvm-svn: 338012
Diffstat (limited to 'clang-tools-extra/unittests/clangd/TestFS.cpp')
| -rw-r--r-- | clang-tools-extra/unittests/clangd/TestFS.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang-tools-extra/unittests/clangd/TestFS.cpp b/clang-tools-extra/unittests/clangd/TestFS.cpp index 741eb8cee7c..b3081d6430b 100644 --- a/clang-tools-extra/unittests/clangd/TestFS.cpp +++ b/clang-tools-extra/unittests/clangd/TestFS.cpp @@ -19,13 +19,15 @@ namespace clangd { using namespace llvm; IntrusiveRefCntPtr<vfs::FileSystem> -buildTestFS(StringMap<std::string> const &Files) { +buildTestFS(llvm::StringMap<std::string> const &Files, + llvm::StringMap<time_t> const &Timestamps) { IntrusiveRefCntPtr<vfs::InMemoryFileSystem> MemFS( new vfs::InMemoryFileSystem); for (auto &FileAndContents : Files) { - MemFS->addFile(FileAndContents.first(), time_t(), - MemoryBuffer::getMemBufferCopy(FileAndContents.second, - FileAndContents.first())); + StringRef File = FileAndContents.first(); + MemFS->addFile( + File, Timestamps.lookup(File), + MemoryBuffer::getMemBufferCopy(FileAndContents.second, File)); } return MemFS; } |

