diff options
| author | Sam McCall <sam.mccall@gmail.com> | 2018-10-25 02:04:30 +0000 |
|---|---|---|
| committer | Sam McCall <sam.mccall@gmail.com> | 2018-10-25 02:04:30 +0000 |
| commit | fd7d341b43a8f591fa40f0a5510a4dd39d13963d (patch) | |
| tree | 1df6bc50ed25dfc2dbc2f7682353b0be7fe489c0 | |
| parent | 325c9c5e84ae6f0b0856bfb00d6278a2fdbfd969 (diff) | |
| download | bcm5719-llvm-fd7d341b43a8f591fa40f0a5510a4dd39d13963d.tar.gz bcm5719-llvm-fd7d341b43a8f591fa40f0a5510a4dd39d13963d.zip | |
[clangd] Don't invalidate LSP-set compile commands when closing a file.
Summary:
It doesn't make much sense: setting them is not coupled to opening the file,
it's an asynchronous notification.
I don't think this is a breaking change - this behavior is hard to observe!
Reviewers: ilya-biryukov
Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits
Differential Revision: https://reviews.llvm.org/D53642
llvm-svn: 345231
4 files changed, 0 insertions, 18 deletions
diff --git a/clang-tools-extra/clangd/ClangdLSPServer.cpp b/clang-tools-extra/clangd/ClangdLSPServer.cpp index f50d3ab0c82..e7e25f23be1 100644 --- a/clang-tools-extra/clangd/ClangdLSPServer.cpp +++ b/clang-tools-extra/clangd/ClangdLSPServer.cpp @@ -393,7 +393,6 @@ void ClangdLSPServer::onDocumentDidChange( // fail rather than giving wrong results. DraftMgr.removeDraft(File); Server->removeDocument(File); - CDB->invalidate(File); elog("Failed to update {0}: {1}", File, Contents.takeError()); return; } @@ -489,7 +488,6 @@ void ClangdLSPServer::onDocumentDidClose( PathRef File = Params.textDocument.uri.file(); DraftMgr.removeDraft(File); Server->removeDocument(File); - CDB->invalidate(File); } void ClangdLSPServer::onDocumentOnTypeFormatting( @@ -804,11 +802,6 @@ ClangdLSPServer::CompilationDB::makeDirectoryBased( /*IsDirectoryBased=*/true); } -void ClangdLSPServer::CompilationDB::invalidate(PathRef File) { - if (!IsDirectoryBased) - static_cast<InMemoryCompilationDb *>(CDB.get())->invalidate(File); -} - bool ClangdLSPServer::CompilationDB::setCompilationCommandForFile( PathRef File, tooling::CompileCommand CompilationCommand) { if (IsDirectoryBased) { diff --git a/clang-tools-extra/clangd/ClangdLSPServer.h b/clang-tools-extra/clangd/ClangdLSPServer.h index 70d13fc0d28..768db0f1931 100644 --- a/clang-tools-extra/clangd/ClangdLSPServer.h +++ b/clang-tools-extra/clangd/ClangdLSPServer.h @@ -113,8 +113,6 @@ private: static CompilationDB makeDirectoryBased(llvm::Optional<Path> CompileCommandsDir); - void invalidate(PathRef File); - /// Sets the compilation command for a particular file. /// Only valid for in-memory CDB, no-op and error log on DirectoryBasedCDB. /// diff --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp index 57fac1cd0fe..0e09cd122d1 100644 --- a/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp +++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.cpp @@ -135,10 +135,5 @@ bool InMemoryCompilationDb::setCompilationCommandForFile( return false; } -void InMemoryCompilationDb::invalidate(PathRef File) { - std::unique_lock<std::mutex> Lock(Mutex); - Commands.erase(File); -} - } // namespace clangd } // namespace clang diff --git a/clang-tools-extra/clangd/GlobalCompilationDatabase.h b/clang-tools-extra/clangd/GlobalCompilationDatabase.h index 5633607fb85..f09045ecbaf 100644 --- a/clang-tools-extra/clangd/GlobalCompilationDatabase.h +++ b/clang-tools-extra/clangd/GlobalCompilationDatabase.h @@ -100,10 +100,6 @@ public: bool setCompilationCommandForFile(PathRef File, tooling::CompileCommand CompilationCommand); - /// Removes the compilation command for \p File if it's present in the - /// mapping. - void invalidate(PathRef File); - private: mutable std::mutex Mutex; llvm::StringMap<tooling::CompileCommand> Commands; /* GUARDED_BY(Mut) */ |

