Author: ibiryukov Date: Wed Jan 10 09:59:27 2018 New Revision: 322199 URL: http://llvm.org/viewvc/llvm-project?rev=322199&view=rev Log: [clangd] Pass Context to onDiagnosticsReady callback
Reviewers: sammccall Reviewed By: sammccall Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D41907 Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp clang-tools-extra/trunk/clangd/ClangdLSPServer.h clang-tools-extra/trunk/clangd/ClangdServer.cpp clang-tools-extra/trunk/clangd/ClangdServer.h clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp?rev=322199&r1=322198&r2=322199&view=diff ============================================================================== --- clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp (original) +++ clang-tools-extra/trunk/clangd/ClangdLSPServer.cpp Wed Jan 10 09:59:27 2018 @@ -325,7 +325,8 @@ std::vector<TextEdit> ClangdLSPServer::g } void ClangdLSPServer::onDiagnosticsReady( - PathRef File, Tagged<std::vector<DiagWithFixIts>> Diagnostics) { + const Context &Ctx, PathRef File, + Tagged<std::vector<DiagWithFixIts>> Diagnostics) { json::ary DiagnosticsJSON; DiagnosticToReplacementMap LocalFixIts; // Temporary storage Modified: clang-tools-extra/trunk/clangd/ClangdLSPServer.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdLSPServer.h?rev=322199&r1=322198&r2=322199&view=diff ============================================================================== --- clang-tools-extra/trunk/clangd/ClangdLSPServer.h (original) +++ clang-tools-extra/trunk/clangd/ClangdLSPServer.h Wed Jan 10 09:59:27 2018 @@ -50,7 +50,7 @@ public: private: // Implement DiagnosticsConsumer. virtual void - onDiagnosticsReady(PathRef File, + onDiagnosticsReady(const Context &Ctx, PathRef File, Tagged<std::vector<DiagWithFixIts>> Diagnostics) override; // Implement ProtocolCallbacks. Modified: clang-tools-extra/trunk/clangd/ClangdServer.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdServer.cpp?rev=322199&r1=322198&r2=322199&view=diff ============================================================================== --- clang-tools-extra/trunk/clangd/ClangdServer.cpp (original) +++ clang-tools-extra/trunk/clangd/ClangdServer.cpp Wed Jan 10 09:59:27 2018 @@ -586,7 +586,7 @@ std::future<Context> ClangdServer::sched return; LastReportedDiagsVersion = Version; - DiagConsumer.onDiagnosticsReady(FileStr, + DiagConsumer.onDiagnosticsReady(Ctx, FileStr, make_tagged(std::move(*Diags), Tag)); }; Modified: clang-tools-extra/trunk/clangd/ClangdServer.h URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdServer.h?rev=322199&r1=322198&r2=322199&view=diff ============================================================================== --- clang-tools-extra/trunk/clangd/ClangdServer.h (original) +++ clang-tools-extra/trunk/clangd/ClangdServer.h Wed Jan 10 09:59:27 2018 @@ -72,7 +72,7 @@ public: /// Called by ClangdServer when \p Diagnostics for \p File are ready. virtual void - onDiagnosticsReady(PathRef File, + onDiagnosticsReady(const Context &Ctx, PathRef File, Tagged<std::vector<DiagWithFixIts>> Diagnostics) = 0; }; Modified: clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp?rev=322199&r1=322198&r2=322199&view=diff ============================================================================== --- clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp (original) +++ clang-tools-extra/trunk/unittests/clangd/ClangdTests.cpp Wed Jan 10 09:59:27 2018 @@ -49,7 +49,7 @@ static bool diagsContainErrors(ArrayRef< class ErrorCheckingDiagConsumer : public DiagnosticsConsumer { public: void - onDiagnosticsReady(PathRef File, + onDiagnosticsReady(const Context &Ctx, PathRef File, Tagged<std::vector<DiagWithFixIts>> Diagnostics) override { bool HadError = diagsContainErrors(Diagnostics.Value); @@ -470,7 +470,7 @@ int d; TestDiagConsumer() : Stats(FilesCount, FileStat()) {} void onDiagnosticsReady( - PathRef File, + const Context &Ctx, PathRef File, Tagged<std::vector<DiagWithFixIts>> Diagnostics) override { StringRef FileIndexStr = llvm::sys::path::stem(File); ASSERT_TRUE(FileIndexStr.consume_front("Foo")); @@ -758,7 +758,7 @@ TEST_F(ClangdThreadingTest, NoConcurrent : StartSecondReparse(std::move(StartSecondReparse)) {} void onDiagnosticsReady( - PathRef File, + const Context &Ctx, PathRef File, Tagged<std::vector<DiagWithFixIts>> Diagnostics) override { std::unique_lock<std::mutex> Lock(Mutex, std::try_to_lock_t()); Modified: clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp?rev=322199&r1=322198&r2=322199&view=diff ============================================================================== --- clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp (original) +++ clang-tools-extra/trunk/unittests/clangd/CodeCompleteTests.cpp Wed Jan 10 09:59:27 2018 @@ -59,8 +59,10 @@ using ::testing::ElementsAre; using ::testing::Not; class IgnoreDiagnostics : public DiagnosticsConsumer { - void onDiagnosticsReady( - PathRef File, Tagged<std::vector<DiagWithFixIts>> Diagnostics) override {} + void + onDiagnosticsReady(const Context &Ctx, PathRef File, + Tagged<std::vector<DiagWithFixIts>> Diagnostics) override { + } }; // GMock helpers for matching completion items. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits