Author: d0k Date: Thu Nov 22 04:54:25 2018 New Revision: 347460 URL: http://llvm.org/viewvc/llvm-project?rev=347460&view=rev Log: [clangd] Fix use-after-scope in unit test
The scheduler holds a reference to `Proceed`, so it has to be destroyed after the scheduler. Found by asan. 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=347460&r1=347459&r2=347460&view=diff ============================================================================== --- clang-tools-extra/trunk/unittests/clangd/TUSchedulerTests.cpp (original) +++ clang-tools-extra/trunk/unittests/clangd/TUSchedulerTests.cpp Thu Nov 22 04:54:25 2018 @@ -221,6 +221,7 @@ TEST_F(TUSchedulerTests, Cancellation) { // R3 <-- cancelled std::vector<std::string> DiagsSeen, ReadsSeen, ReadsCanceled; { + Notification Proceed; // Ensure we schedule everything. TUScheduler S( getDefaultAsyncThreadsCount(), /*StorePreamblesInMemory=*/true, /*ASTCallbacks=*/nullptr, @@ -255,7 +256,6 @@ TEST_F(TUSchedulerTests, Cancellation) { return std::move(T.second); }; - Notification Proceed; // Ensure we schedule everything. S.update(Path, getInputs(Path, ""), WantDiagnostics::Yes, [&](std::vector<Diag> Diags) { Proceed.wait(); }); // The second parens indicate cancellation, where present. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits