[clangd] Fix another TSAN issue
authorBenjamin Kramer <benny.kra@googlemail.com>
Tue, 17 Sep 2019 14:56:11 +0000 (14:56 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Tue, 17 Sep 2019 14:56:11 +0000 (14:56 +0000)
llvm-svn: 372128

clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp

index 5dbfca5..db05c70 100644 (file)
@@ -769,12 +769,14 @@ TEST_F(TUSchedulerTests, CommandLineWarnings) {
   // 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) {