[clangd] Fixed crash on MacOS.
Caused by invalid order of members in ClangdServer. DiagnosticsMutex was used after destruction. llvm-svn: 313801
This commit is contained in:
parent
23be5e8d70
commit
f4e95d7290
|
@ -151,7 +151,7 @@ ClangdServer::ClangdServer(GlobalCompilationDatabase &CDB,
|
|||
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) {
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue