summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Biryukov <ibiryukov@google.com>2019-09-03 13:56:03 +0000
committerIlya Biryukov <ibiryukov@google.com>2019-09-03 13:56:03 +0000
commit72379548ebdec95cd4d9cfa58c16c90b6db8173d (patch)
tree116e363b451d9dcb575c05509525d7838cebddd5
parent80195e7d1c3ae1c54b949460eca62d7388560f8b (diff)
downloadbcm5719-llvm-72379548ebdec95cd4d9cfa58c16c90b6db8173d.tar.gz
bcm5719-llvm-72379548ebdec95cd4d9cfa58c16c90b6db8173d.zip
[clangd] Fix a data race in test code
Found by TSan, thanks bkramer for pointing this out. llvm-svn: 370758
-rw-r--r--clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
index 274c07f99cd..ff28cbbb416 100644
--- a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
+++ b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
@@ -740,12 +740,14 @@ TEST_F(TUSchedulerTests, CommandLineErrors) {
// We should see errors from command-line parsing inside the main file.
CDB.ExtraClangFlags = {"-fsome-unknown-flag"};
+ // (!) '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) {
OpenPOWER on IntegriCloud