Author: Vitaly Buka
Date: 2022-09-11T10:15:13-07:00
New Revision: c3c930d573656a825523b7112891bd97eec7b64f

URL: 
https://github.com/llvm/llvm-project/commit/c3c930d573656a825523b7112891bd97eec7b64f
DIFF: 
https://github.com/llvm/llvm-project/commit/c3c930d573656a825523b7112891bd97eec7b64f.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..b2ab97e4f2494 100644
--- a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
+++ b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
@@ -1227,14 +1227,14 @@ TEST_F(TUSchedulerTests, IncluderCache) {
   auto GetFlags = [&](PathRef Header) {
     S.update(Header, getInputs(Header, ";"), WantDiagnostics::Yes);
     EXPECT_TRUE(S.blockUntilIdle(timeoutSeconds(10)));
-    tooling::CompileCommand Cmd;
+    auto Cmd = std::make_shared<tooling::CompileCommand>();
     S.runWithPreamble("GetFlags", Header, TUScheduler::StaleOrAbsent,
-                      [&](llvm::Expected<InputsAndPreamble> Inputs) {
+                      [Cmd](llvm::Expected<InputsAndPreamble> Inputs) {
                         ASSERT_FALSE(!Inputs) << Inputs.takeError();
-                        Cmd = std::move(Inputs->Command);
+                        *Cmd = std::move(Inputs->Command);
                       });
     EXPECT_TRUE(S.blockUntilIdle(timeoutSeconds(10)));
-    return Cmd.CommandLine;
+    return Cmd->CommandLine;
   };
 
   for (const auto &Path : {NoCmd, Unreliable, OK, NotIncluded})


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to