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 bfe85230e2dc27493b82ffba5a46c8f7449a6e10 bfd36727df42b6bc95468e84a74efbbff968e7aa --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/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 8cbb84943f..aa3862a957 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/lib/Support/ProgramStack.cpp b/llvm/lib/Support/ProgramStack.cpp index 3a48e86062..1ddfc38848 100644 --- a/llvm/lib/Support/ProgramStack.cpp +++ b/llvm/lib/Support/ProgramStack.cpp @@ -11,24 +11,24 @@ #include "llvm/Support/Compiler.h" #ifdef HAVE_SYS_RESOURCE_H -# include <sys/resource.h> +#include <sys/resource.h> #endif #ifdef _MSC_VER -# include <intrin.h> // for _AddressOfReturnAddress +#include <intrin.h> // for _AddressOfReturnAddress #endif // Currently only Apple AArch64 is known to support split stacks in the debugger // and other tooling. #if defined(__APPLE__) && defined(__aarch64__) && \ LLVM_HAS_CPP_ATTRIBUTE(gnu::naked) && __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 #include <sys/mman.h> #endif #ifndef LLVM_HAS_SPLIT_STACKS -# include "llvm/Support/thread.h" +#include "llvm/Support/thread.h" #endif using namespace llvm; @@ -65,32 +65,28 @@ namespace { #ifdef LLVM_HAS_SPLIT_STACKS_AARCH64 [[gnu::naked]] void runOnNewStackImpl(void *Stack, void (*Fn)(void *), void *Ctx) { - __asm__ volatile( - "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" - ); + __asm__ volatile("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"); } #endif #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 `````````` </details> https://github.com/llvm/llvm-project/pull/133173 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits