[lldb] [llvm] [BoundsSafety][LLDB] Implement instrumentation plugin for -fbounds-safety soft traps (PR #169117)

via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 21 14:49:05 PST 2025


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 c,cpp,h -- lldb/source/Plugins/InstrumentationRuntime/BoundsSafety/InstrumentationRuntimeBoundsSafety.cpp lldb/source/Plugins/InstrumentationRuntime/BoundsSafety/InstrumentationRuntimeBoundsSafety.h lldb/test/API/lang/BoundsSafety/soft_trap/main.c lldb/test/API/lang/BoundsSafety/soft_trap/mockSoftTrapRuntime.c lldb/test/Shell/BoundsSafety/Inputs/boundsSafetyMockCallSoftTrapRuntime.c lldb/test/Shell/BoundsSafety/Inputs/boundsSafetyMockSoftTrapRuntime.c lldb/test/Shell/BoundsSafety/Inputs/boundsSafetySoftTraps.c lldb/test/Shell/BoundsSafety/Inputs/boundsSafetySoftTrapsMissingReason.c lldb/include/lldb/lldb-enumerations.h --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/lldb/test/Shell/BoundsSafety/Inputs/boundsSafetyMockSoftTrapRuntime.c b/lldb/test/Shell/BoundsSafety/Inputs/boundsSafetyMockSoftTrapRuntime.c
index 2b3f3d93f..3e680451e 100644
--- a/lldb/test/Shell/BoundsSafety/Inputs/boundsSafetyMockSoftTrapRuntime.c
+++ b/lldb/test/Shell/BoundsSafety/Inputs/boundsSafetyMockSoftTrapRuntime.c
@@ -10,12 +10,6 @@
 #error Do not compile the runtime with -fbounds-safety enabled due to potential for infinite recursion
 #endif
 
+void __bounds_safety_soft_trap_s(const char *reason) { printf("BoundsSafety check FAILED: message:\"%s\"\n", reason ? reason : ""); }
 
-
-void __bounds_safety_soft_trap_s(const char *reason) {
-    printf("BoundsSafety check FAILED: message:\"%s\"\n", reason? reason: "");
-}
-
-void __bounds_safety_soft_trap(void) {
-    printf("BoundsSafety check FAILED\n");
-}
+void __bounds_safety_soft_trap(void) { printf("BoundsSafety check FAILED\n"); }
diff --git a/lldb/test/Shell/BoundsSafety/Inputs/boundsSafetySoftTraps.c b/lldb/test/Shell/BoundsSafety/Inputs/boundsSafetySoftTraps.c
index 70eaea4a3..265e57e42 100644
--- a/lldb/test/Shell/BoundsSafety/Inputs/boundsSafetySoftTraps.c
+++ b/lldb/test/Shell/BoundsSafety/Inputs/boundsSafetySoftTraps.c
@@ -5,7 +5,7 @@ int bad_read(int index) {
   return array[index];
 }
 
-int main(int argc, char** argv) {
+int main(int argc, char **argv) {
   bad_read(10);
   printf("Execution continued\n");
   return 0;
diff --git a/lldb/test/Shell/BoundsSafety/Inputs/boundsSafetySoftTrapsMissingReason.c b/lldb/test/Shell/BoundsSafety/Inputs/boundsSafetySoftTrapsMissingReason.c
index 542723450..db65c9d93 100644
--- a/lldb/test/Shell/BoundsSafety/Inputs/boundsSafetySoftTrapsMissingReason.c
+++ b/lldb/test/Shell/BoundsSafety/Inputs/boundsSafetySoftTrapsMissingReason.c
@@ -1,7 +1,7 @@
+#include <ptrcheck.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <ptrcheck.h>
 
 int bad_call(int *__counted_by(count) ptr, int count) {}
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/169117


More information about the llvm-commits mailing list