[clangd] Fix another TSAN issue
git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@372128 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/clangd/unittests/TUSchedulerTests.cpp b/clangd/unittests/TUSchedulerTests.cpp
index 5dbfca5..db05c70 100644
--- a/clangd/unittests/TUSchedulerTests.cpp
+++ b/clangd/unittests/TUSchedulerTests.cpp
@@ -769,12 +769,14 @@
// We should not see warnings from command-line parsing.
CDB.ExtraClangFlags = {"-Wsome-unknown-warning"};
+ // (!) 'Ready' must live longer than TUScheduler.
+ Notification Ready;
+
TUScheduler S(CDB, /*AsyncThreadsCount=*/getDefaultAsyncThreadsCount(),
/*StorePreambleInMemory=*/true, /*ASTCallbacks=*/captureDiags(),
/*UpdateDebounce=*/std::chrono::steady_clock::duration::zero(),
ASTRetentionPolicy());
- Notification Ready;
std::vector<Diag> Diagnostics;
updateWithDiags(S, testPath("foo.cpp"), "void test() {}",
WantDiagnostics::Yes, [&](std::vector<Diag> D) {