[clang-tools-extra] dde62a5 - [test][clangd] Fix use-after-return after 72142fbac4

Vitaly Buka via cfe-commits cfe-commits at lists.llvm.org
Sun Sep 11 11:47:16 PDT 2022


Author: Vitaly Buka
Date: 2022-09-11T11:46:58-07:00
New Revision: dde62a575a3394c7c6734a5a1057bb8f91c729bb

URL: https://github.com/llvm/llvm-project/commit/dde62a575a3394c7c6734a5a1057bb8f91c729bb
DIFF: https://github.com/llvm/llvm-project/commit/dde62a575a3394c7c6734a5a1057bb8f91c729bb.diff

LOG: [test][clangd] Fix use-after-return after 72142fbac4

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
index 4e95fcfea91c1..2719a4fe32ff4 100644
--- a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
+++ b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
@@ -1227,12 +1227,15 @@ TEST_F(TUSchedulerTests, IncluderCache) {
   auto GetFlags = [&](PathRef Header) {
     S.update(Header, getInputs(Header, ";"), WantDiagnostics::Yes);
     EXPECT_TRUE(S.blockUntilIdle(timeoutSeconds(10)));
+    Notification CmdDone;
     tooling::CompileCommand Cmd;
     S.runWithPreamble("GetFlags", Header, TUScheduler::StaleOrAbsent,
                       [&](llvm::Expected<InputsAndPreamble> Inputs) {
                         ASSERT_FALSE(!Inputs) << Inputs.takeError();
                         Cmd = std::move(Inputs->Command);
+                        CmdDone.notify();
                       });
+    CmdDone.wait();
     EXPECT_TRUE(S.blockUntilIdle(timeoutSeconds(10)));
     return Cmd.CommandLine;
   };


        


More information about the cfe-commits mailing list