[clang-tools-extra] r313801 - [clangd] Fixed crash on MacOS.
Ilya Biryukov via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 20 12:32:06 PDT 2017
Author: ibiryukov
Date: Wed Sep 20 12:32:06 2017
New Revision: 313801
URL: http://llvm.org/viewvc/llvm-project?rev=313801&view=rev
Log:
[clangd] Fixed crash on MacOS.
Caused by invalid order of members in ClangdServer.
DiagnosticsMutex was used after destruction.
Modified:
clang-tools-extra/trunk/clangd/ClangdServer.cpp
clang-tools-extra/trunk/clangd/ClangdServer.h
Modified: clang-tools-extra/trunk/clangd/ClangdServer.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdServer.cpp?rev=313801&r1=313800&r2=313801&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ClangdServer.cpp (original)
+++ clang-tools-extra/trunk/clangd/ClangdServer.cpp Wed Sep 20 12:32:06 2017
@@ -151,7 +151,7 @@ ClangdServer::ClangdServer(GlobalCompila
FSProvider(FSProvider),
ResourceDir(ResourceDir ? ResourceDir->str() : getStandardResourceDir()),
PCHs(std::make_shared<PCHContainerOperations>()),
- WorkScheduler(AsyncThreadsCount), SnippetCompletions(SnippetCompletions) {
+ SnippetCompletions(SnippetCompletions), WorkScheduler(AsyncThreadsCount) {
}
std::future<void> ClangdServer::addDocument(PathRef File, StringRef Contents) {
Modified: clang-tools-extra/trunk/clangd/ClangdServer.h
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/ClangdServer.h?rev=313801&r1=313800&r2=313801&view=diff
==============================================================================
--- clang-tools-extra/trunk/clangd/ClangdServer.h (original)
+++ clang-tools-extra/trunk/clangd/ClangdServer.h Wed Sep 20 12:32:06 2017
@@ -279,18 +279,17 @@ private:
CppFileCollection Units;
std::string ResourceDir;
std::shared_ptr<PCHContainerOperations> PCHs;
- // WorkScheduler has to be the last member, because its destructor has to be
- // called before all other members to stop the worker thread that references
- // ClangdServer
- ClangdScheduler WorkScheduler;
bool SnippetCompletions;
-
/// Used to serialize diagnostic callbacks.
/// FIXME(ibiryukov): get rid of an extra map and put all version counters
/// into CppFile.
std::mutex DiagnosticsMutex;
/// Maps from a filename to the latest version of reported diagnostics.
llvm::StringMap<DocVersion> ReportedDiagnosticVersions;
+ // WorkScheduler has to be the last member, because its destructor has to be
+ // called before all other members to stop the worker thread that references
+ // ClangdServer
+ ClangdScheduler WorkScheduler;
};
} // namespace clangd
More information about the cfe-commits
mailing list