[compiler-rt] [compiler-rt][sanitizer-common] adding C23 memset_explicit interception. (PR #154428)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 19 14:52:50 PDT 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 HEAD~1 HEAD --extensions inc,c,h -- compiler-rt/test/sanitizer_common/TestCases/Linux/memset_explicit.c compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc
index 5334b0ded..6c48ac597 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors_memintrinsics.inc
@@ -238,9 +238,9 @@ INTERCEPTOR(void *, memset_explicit, void *block, int c, usize size) {
void *ctx;
COMMON_INTERCEPTOR_MEMSET_IMPL(ctx, block, c, size);
}
-#define INIT_MEMSET_EXPLICIT COMMON_INTERCEPT_FUNCTION(memset_explicit)
+# define INIT_MEMSET_EXPLICIT COMMON_INTERCEPT_FUNCTION(memset_explicit)
#else
-#define INIT_MEMSET_EXPLICIT
+# define INIT_MEMSET_EXPLICIT
#endif
namespace __sanitizer {
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
index eee7af206..5d9cd9c11 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
@@ -663,9 +663,9 @@ SANITIZER_WEAK_IMPORT void *aligned_alloc(__sanitizer::usize __alignment,
#define SANITIZER_INTERCEPT_GETSERVBYNAME_R SI_GLIBC
#define SANITIZER_INTERCEPT_GETSERVBYPORT_R SI_GLIBC
-// Until free_sized, free_aligned_sized and memset_explicit are more generally available,
-// we can only unconditionally intercept on ELF-based platforms where it
-// is okay to have undefined weak symbols.
+// Until free_sized, free_aligned_sized and memset_explicit are more generally
+// available, we can only unconditionally intercept on ELF-based platforms where
+// it is okay to have undefined weak symbols.
#ifdef __ELF__
# define SANITIZER_INTERCEPT_FREE_SIZED 1
# define SANITIZER_INTERCEPT_FREE_ALIGNED_SIZED 1
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/memset_explicit.c b/compiler-rt/test/sanitizer_common/TestCases/Linux/memset_explicit.c
index 08b8bdeb5..13ac71efe 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Linux/memset_explicit.c
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/memset_explicit.c
@@ -7,8 +7,7 @@
extern void *memset_explicit(void *p, int value, size_t size);
int main() {
- char secbuffer[64];
- (void)memset_explicit(secbuffer, 0, sizeof(secbuffer));
- return 0;
+ char secbuffer[64];
+ (void)memset_explicit(secbuffer, 0, sizeof(secbuffer));
+ return 0;
}
-
``````````
</details>
https://github.com/llvm/llvm-project/pull/154428
More information about the llvm-commits
mailing list