[test][clangd] Fix use-after-return after 72142fbac4
authorVitaly Buka <vitalybuka@google.com>
Sun, 11 Sep 2022 18:46:49 +0000 (11:46 -0700)
committerVitaly Buka <vitalybuka@google.com>
Sun, 11 Sep 2022 18:46:58 +0000 (11:46 -0700)
clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp

index 4e95fcf..2719a4f 100644 (file)
@@ -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;
   };