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 HEAD~1 HEAD --extensions cpp,h -- 
llvm/include/llvm/Support/ProgramStack.h llvm/lib/Support/ProgramStack.cpp 
llvm/unittests/Support/ProgramStackTest.cpp clang/include/clang/Basic/Stack.h 
clang/lib/Basic/Stack.cpp clang/lib/Frontend/CompilerInstance.cpp 
llvm/include/llvm/Support/CrashRecoveryContext.h 
llvm/include/llvm/Support/thread.h llvm/lib/Support/CrashRecoveryContext.cpp
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Basic/Stack.cpp b/clang/lib/Basic/Stack.cpp
index 8cbb84943..aa3862a95 100644
--- a/clang/lib/Basic/Stack.cpp
+++ b/clang/lib/Basic/Stack.cpp
@@ -49,10 +49,12 @@ void 
clang::runWithSufficientStackSpaceSlow(llvm::function_ref<void()> Diag,
   llvm::CrashRecoveryContext CRC;
   // Preserve the BottomOfStack in case RunSafelyOnNewStack uses split stacks.
   uintptr_t PrevBottom = BottomOfStack;
-  CRC.RunSafelyOnNewStack([&] {
-    noteBottomOfStack(true);
-    Diag();
-    Fn();
-  }, DesiredStackSize);
+  CRC.RunSafelyOnNewStack(
+      [&] {
+        noteBottomOfStack(true);
+        Diag();
+        Fn();
+      },
+      DesiredStackSize);
   BottomOfStack = PrevBottom;
 }
diff --git a/llvm/include/llvm/Support/ProgramStack.h 
b/llvm/include/llvm/Support/ProgramStack.h
index 55964c977..524cdd468 100644
--- a/llvm/include/llvm/Support/ProgramStack.h
+++ b/llvm/include/llvm/Support/ProgramStack.h
@@ -18,8 +18,8 @@
 // and other tooling.
 #if defined(__APPLE__) && defined(__MACH__) && defined(__aarch64__) &&         
\
     __has_extension(gnu_asm)
-# define LLVM_HAS_SPLIT_STACKS
-# define LLVM_HAS_SPLIT_STACKS_AARCH64
+#define LLVM_HAS_SPLIT_STACKS
+#define LLVM_HAS_SPLIT_STACKS_AARCH64
 #endif
 
 namespace llvm {
diff --git a/llvm/lib/Support/ProgramStack.cpp 
b/llvm/lib/Support/ProgramStack.cpp
index 66f74ff66..993ceb452 100644
--- a/llvm/lib/Support/ProgramStack.cpp
+++ b/llvm/lib/Support/ProgramStack.cpp
@@ -11,15 +11,15 @@
 #include "llvm/Support/Compiler.h"
 
 #ifdef LLVM_ON_UNIX
-# include <sys/resource.h> // for getrlimit
+#include <sys/resource.h> // for getrlimit
 #endif
 
 #ifdef _MSC_VER
-# include <intrin.h>  // for _AddressOfReturnAddress
+#include <intrin.h> // for _AddressOfReturnAddress
 #endif
 
 #ifndef LLVM_HAS_SPLIT_STACKS
-# include "llvm/Support/thread.h"
+#include "llvm/Support/thread.h"
 #endif
 
 using namespace llvm;
@@ -65,38 +65,34 @@ void runOnNewStackImpl(void *Stack, void (*Fn)(void *), 
void *Ctx) __asm__(
 //
 // When adding new platforms it may be better to move to a .S file with macros
 // for dealing with platform differences.
-__asm__ (
-    ".globl  _ZN4llvm17runOnNewStackImplEPvPFvS0_ES0_\n\t"
-    ".p2align  2\n\t"
-    "_ZN4llvm17runOnNewStackImplEPvPFvS0_ES0_:\n\t"
-    ".cfi_startproc\n\t"
-    "mov       x16, sp\n\t"
-    "sub       x0, x0, #0x20\n\t"            // subtract space from stack
-    "stp       xzr, x16, [x0, #0x00]\n\t"    // save old sp
-    "stp       x29, x30, [x0, #0x10]\n\t"    // save fp, lr
-    "mov       sp, x0\n\t"                   // switch to new stack
-    "add       x29, x0, #0x10\n\t"           // switch to new frame
-    ".cfi_def_cfa w29, 16\n\t"
-    ".cfi_offset w30, -8\n\t"                // lr
-    ".cfi_offset w29, -16\n\t"               // fp
-
-    "mov       x0, x2\n\t"                   // Ctx is the only argument
-    "blr       x1\n\t"                       // call Fn
-
-    "ldp       x29, x30, [sp, #0x10]\n\t"    // restore fp, lr
-    "ldp       xzr, x16, [sp, #0x00]\n\t"    // load old sp
-    "mov       sp, x16\n\t"
-    "ret\n\t"
-    ".cfi_endproc"
-);
+__asm__(".globl  _ZN4llvm17runOnNewStackImplEPvPFvS0_ES0_\n\t"
+        ".p2align  2\n\t"
+        "_ZN4llvm17runOnNewStackImplEPvPFvS0_ES0_:\n\t"
+        ".cfi_startproc\n\t"
+        "mov       x16, sp\n\t"
+        "sub       x0, x0, #0x20\n\t"         // subtract space from stack
+        "stp       xzr, x16, [x0, #0x00]\n\t" // save old sp
+        "stp       x29, x30, [x0, #0x10]\n\t" // save fp, lr
+        "mov       sp, x0\n\t"                // switch to new stack
+        "add       x29, x0, #0x10\n\t"        // switch to new frame
+        ".cfi_def_cfa w29, 16\n\t"
+        ".cfi_offset w30, -8\n\t"  // lr
+        ".cfi_offset w29, -16\n\t" // fp
+
+        "mov       x0, x2\n\t" // Ctx is the only argument
+        "blr       x1\n\t"     // call Fn
+
+        "ldp       x29, x30, [sp, #0x10]\n\t" // restore fp, lr
+        "ldp       xzr, x16, [sp, #0x00]\n\t" // load old sp
+        "mov       sp, x16\n\t"
+        "ret\n\t"
+        ".cfi_endproc");
 #endif
 } // namespace llvm
 
 namespace {
 #ifdef LLVM_HAS_SPLIT_STACKS
-void callback(void *Ctx) {
-  (*reinterpret_cast<function_ref<void()> *>(Ctx))();
-}
+void callback(void *Ctx) { (*reinterpret_cast<function_ref<void()> *>(Ctx))(); 
}
 #endif
 } // namespace
 
diff --git a/llvm/unittests/Support/ProgramStackTest.cpp 
b/llvm/unittests/Support/ProgramStackTest.cpp
index 31dfb3b88..f0fa47685 100644
--- a/llvm/unittests/Support/ProgramStackTest.cpp
+++ b/llvm/unittests/Support/ProgramStackTest.cpp
@@ -17,9 +17,7 @@ static uintptr_t func(int &A) {
   return getStackPointer();
 }
 
-static void func2(int &A) {
-  A = 5;
-}
+static void func2(int &A) { A = 5; }
 
 TEST(ProgramStackTest, runOnNewStack) {
   int A = 0;

``````````

</details>


https://github.com/llvm/llvm-project/pull/136046
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to