[compiler-rt] [TySan] Intercept malloc_size on Apple platforms. (PR #122133)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 8 07:57:41 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 a5c3cbf7e0df23ca898e4f65e78531641fe4bf60 22fed997621f3954127fc95005a11dd8a5500dc3 --extensions cpp,h -- compiler-rt/lib/sanitizer_common/sanitizer_allocator_dlsym.h compiler-rt/lib/tysan/tysan_interceptors.cpp
``````````

</details>

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

``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_dlsym.h b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_dlsym.h
index 5465258e6a..9d7ebc54ea 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_allocator_dlsym.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_allocator_dlsym.h
@@ -36,16 +36,14 @@ struct DlSymAllocator {
   static void *Allocate(uptr size_in_bytes, uptr align = kWordSize) {
     void *ptr = InternalAlloc(size_in_bytes, nullptr, align);
     CHECK(internal_allocator()->FromPrimary(ptr));
-    Details::OnAllocate(ptr,
-                        Size(ptr));
+    Details::OnAllocate(ptr, Size(ptr));
     return ptr;
   }
 
   static void *Callocate(usize nmemb, usize size) {
     void *ptr = InternalCalloc(nmemb, size);
     CHECK(internal_allocator()->FromPrimary(ptr));
-    Details::OnAllocate(ptr,
-                        Size(ptr));
+    Details::OnAllocate(ptr, Size(ptr));
     return ptr;
   }
 
diff --git a/compiler-rt/lib/tysan/tysan_interceptors.cpp b/compiler-rt/lib/tysan/tysan_interceptors.cpp
index 4a89f07462..de2daa89f5 100644
--- a/compiler-rt/lib/tysan/tysan_interceptors.cpp
+++ b/compiler-rt/lib/tysan/tysan_interceptors.cpp
@@ -109,7 +109,7 @@ INTERCEPTOR(void *, malloc, uptr size) {
 }
 
 #if SANITIZER_APPLE
-INTERCEPTOR(uptr , malloc_size, void *ptr) {
+INTERCEPTOR(uptr, malloc_size, void *ptr) {
   if (DlsymAlloc::Use())
     return DlsymAlloc::Size(ptr);
   return REAL(malloc_size)(ptr);

``````````

</details>


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


More information about the llvm-commits mailing list