Author: ibiryukov Date: Tue Sep 3 06:56:03 2019 New Revision: 370758 URL: http://llvm.org/viewvc/llvm-project?rev=370758&view=rev Log: [clangd] Fix a data race in test code
Found by TSan, thanks bkramer for pointing this out. Modified: clang-tools-extra/trunk/clangd/unittests/TUSchedulerTests.cpp Modified: clang-tools-extra/trunk/clangd/unittests/TUSchedulerTests.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clangd/unittests/TUSchedulerTests.cpp?rev=370758&r1=370757&r2=370758&view=diff ============================================================================== --- clang-tools-extra/trunk/clangd/unittests/TUSchedulerTests.cpp (original) +++ clang-tools-extra/trunk/clangd/unittests/TUSchedulerTests.cpp Tue Sep 3 06:56:03 2019 @@ -740,12 +740,14 @@ TEST_F(TUSchedulerTests, CommandLineErro // 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) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits