github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp -- 
clang-tools-extra/clangd/TUScheduler.cpp 
clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp 
--diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang-tools-extra/clangd/TUScheduler.cpp 
b/clang-tools-extra/clangd/TUScheduler.cpp
index 20864e8e1..eccc5f5ff 100644
--- a/clang-tools-extra/clangd/TUScheduler.cpp
+++ b/clang-tools-extra/clangd/TUScheduler.cpp
@@ -396,9 +396,9 @@ scanPrecedingIncludes(const ThreadsafeFS &TFS,
   CI->getDiagnosticOpts().IgnoreWarnings = true;
 
   auto ContentsBuffer = llvm::MemoryBuffer::getMemBuffer(PI.Contents);
-  auto Clang = prepareCompilerInstance(
-      std::move(CI), /*Preamble=*/nullptr, std::move(ContentsBuffer),
-      TFS.view(std::nullopt), IgnoreDiags);
+  auto Clang = prepareCompilerInstance(std::move(CI), /*Preamble=*/nullptr,
+                                       std::move(ContentsBuffer),
+                                       TFS.view(std::nullopt), IgnoreDiags);
   if (!Clang || Clang->getFrontendOpts().Inputs.empty())
     return {};
 
@@ -986,22 +986,18 @@ void ASTWorker::update(ParseInputs Inputs, 
WantDiagnostics WantDiags,
         llvm::sys::path::remove_dots(ProxyPath, /*remove_dot_dot=*/true);
         // Use cached result if the proxy hasn't changed, otherwise
         // fetch the proxy's compile command and preprocess it.
-        auto ProxyStat = Inputs.TFS->view(std::nullopt)
-                             ->status(ProxyPath);
-        auto ProxyMTime = ProxyStat
-                              ? ProxyStat->getLastModificationTime()
-                              : llvm::sys::TimePoint<>();
+        auto ProxyStat = Inputs.TFS->view(std::nullopt)->status(ProxyPath);
+        auto ProxyMTime = ProxyStat ? ProxyStat->getLastModificationTime()
+                                    : llvm::sys::TimePoint<>();
         std::vector<std::string> *Preceding = nullptr;
-        if (CachedProxyPath == ProxyPath &&
-            CachedProxyMTime == ProxyMTime) {
+        if (CachedProxyPath == ProxyPath && CachedProxyMTime == ProxyMTime) {
           Preceding = &CachedPrecedingIncludes;
-        } else if (auto ProxyCmd =
-                       CDB.getCompileCommand(ProxyPath)) {
+        } else if (auto ProxyCmd = CDB.getCompileCommand(ProxyPath)) {
           if (isReliable(*ProxyCmd)) {
             CachedProxyPath = std::string(ProxyPath);
             CachedProxyMTime = ProxyMTime;
-            CachedPrecedingIncludes = scanPrecedingIncludes(
-                *Inputs.TFS, *ProxyCmd, FileName);
+            CachedPrecedingIncludes =
+                scanPrecedingIncludes(*Inputs.TFS, *ProxyCmd, FileName);
             Preceding = &CachedPrecedingIncludes;
           }
         }
diff --git a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp 
b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
index b5cab2efa..1581053bb 100644
--- a/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
+++ b/clang-tools-extra/clangd/unittests/TUSchedulerTests.cpp
@@ -1443,8 +1443,7 @@ TEST_F(TUSchedulerTests, IncluderCache) {
 // includes that precede child.c in parent.c. Header files should not get
 // preceding includes injected even when they have a proxy.
 TEST_F(TUSchedulerTests, IncluderCacheNonHeaderProxy) {
-  static std::string Parent = testPath("parent.c"),
-                     Child = testPath("child.c"),
+  static std::string Parent = testPath("parent.c"), Child = 
testPath("child.c"),
                      Header = testPath("header.h"),
                      NoCmd = testPath("no_cmd.h");
   struct NonHeaderCDB : public GlobalCompilationDatabase {
@@ -1465,13 +1464,12 @@ TEST_F(TUSchedulerTests, IncluderCacheNonHeaderProxy) {
     EXPECT_TRUE(S.blockUntilIdle(timeoutSeconds(60)));
     Notification CmdDone;
     tooling::CompileCommand Cmd;
-    S.runWithPreamble(
-        "GetFlags", File, TUScheduler::StaleOrAbsent,
-        [&](llvm::Expected<InputsAndPreamble> Inputs) {
-          ASSERT_FALSE(!Inputs) << Inputs.takeError();
-          Cmd = std::move(Inputs->Command);
-          CmdDone.notify();
-        });
+    S.runWithPreamble("GetFlags", File, 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(60)));
     return Cmd.CommandLine;
@@ -1489,8 +1487,7 @@ TEST_F(TUSchedulerTests, IncluderCacheNonHeaderProxy) {
     #include "child.c"
   )cpp";
   FS.Files[Parent] = ParentContents;
-  S.update(Parent, getInputs(Parent, ParentContents),
-           WantDiagnostics::Yes);
+  S.update(Parent, getInputs(Parent, ParentContents), WantDiagnostics::Yes);
   EXPECT_TRUE(S.blockUntilIdle(timeoutSeconds(60)));
 
   // child.c is a non-header included by a non-header: should get
@@ -1519,8 +1516,7 @@ TEST_F(TUSchedulerTests, 
IncluderCacheNonHeaderProxyColdStart) {
   // first. The CDB returns an interpolated command for child.c inferred from
   // parent.c. Preprocessing parent.c should find preceding includes and
   // inject them as -include flags.
-  static std::string Parent = testPath("parent.c"),
-                     Child = testPath("child.c"),
+  static std::string Parent = testPath("parent.c"), Child = 
testPath("child.c"),
                      Header = testPath("header.h"),
                      Sibling = testPath("sibling.c");
   FS.Files[Header] = "";
@@ -1558,13 +1554,12 @@ TEST_F(TUSchedulerTests, 
IncluderCacheNonHeaderProxyColdStart) {
 
   Notification CmdDone;
   tooling::CompileCommand Cmd;
-  S.runWithPreamble(
-      "GetFlags", Child, TUScheduler::StaleOrAbsent,
-      [&](llvm::Expected<InputsAndPreamble> Inputs) {
-        ASSERT_FALSE(!Inputs) << Inputs.takeError();
-        Cmd = std::move(Inputs->Command);
-        CmdDone.notify();
-      });
+  S.runWithPreamble("GetFlags", Child, 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(60)));
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/180402
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to