Author: sammccall Date: Thu Feb 22 07:33:33 2018 New Revision: 325801 URL: http://llvm.org/viewvc/llvm-project?rev=325801&view=rev Log: [clangd] fix test use-after-free from r325774
Modified: clang-tools-extra/trunk/unittests/clangd/TUSchedulerTests.cpp Modified: clang-tools-extra/trunk/unittests/clangd/TUSchedulerTests.cpp URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/TUSchedulerTests.cpp?rev=325801&r1=325800&r2=325801&view=diff ============================================================================== --- clang-tools-extra/trunk/unittests/clangd/TUSchedulerTests.cpp (original) +++ clang-tools-extra/trunk/unittests/clangd/TUSchedulerTests.cpp Thu Feb 22 07:33:33 2018 @@ -91,14 +91,13 @@ TEST_F(TUSchedulerTests, MissingFiles) { TEST_F(TUSchedulerTests, WantDiagnostics) { std::atomic<int> CallbackCount(0); { + // To avoid a racy test, don't allow tasks to actualy run on the worker + // thread until we've scheduled them all. + Notification Ready; TUScheduler S(getDefaultAsyncThreadsCount(), /*StorePreamblesInMemory=*/true, /*ASTParsedCallback=*/nullptr); auto Path = testPath("foo.cpp"); - - // To avoid a racy test, don't allow tasks to actualy run on the worker - // thread until we've scheduled them all. - Notification Ready; S.update(Path, getInputs(Path, ""), WantDiagnostics::Yes, [&](std::vector<DiagWithFixIts>) { Ready.wait(); }); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits