[compiler-rt] ce1cb9d - [NFC][sanitizer] Clang format some code

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 12 18:46:05 PDT 2022


Author: Vitaly Buka
Date: 2022-04-12T18:45:50-07:00
New Revision: ce1cb9d2c1d41735de60a8744f9700e2ce0ce390

URL: https://github.com/llvm/llvm-project/commit/ce1cb9d2c1d41735de60a8744f9700e2ce0ce390
DIFF: https://github.com/llvm/llvm-project/commit/ce1cb9d2c1d41735de60a8744f9700e2ce0ce390.diff

LOG: [NFC][sanitizer] Clang format some code

Added: 
    

Modified: 
    compiler-rt/lib/asan/asan_internal.h
    compiler-rt/lib/hwasan/hwasan.h
    compiler-rt/lib/lsan/lsan_allocator.cpp
    compiler-rt/lib/memprof/memprof_internal.h

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/asan/asan_internal.h b/compiler-rt/lib/asan/asan_internal.h
index 711e7aa1562aa..27f8949ffdb05 100644
--- a/compiler-rt/lib/asan/asan_internal.h
+++ b/compiler-rt/lib/asan/asan_internal.h
@@ -17,19 +17,19 @@
 #include "asan_interface_internal.h"
 #include "sanitizer_common/sanitizer_common.h"
 #include "sanitizer_common/sanitizer_internal_defs.h"
-#include "sanitizer_common/sanitizer_stacktrace.h"
 #include "sanitizer_common/sanitizer_libc.h"
+#include "sanitizer_common/sanitizer_stacktrace.h"
 
 #if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
-# error "The AddressSanitizer run-time should not be"
-        " instrumented by AddressSanitizer"
+#  error \
+      "The AddressSanitizer run-time should not be instrumented by AddressSanitizer"
 #endif
 
 // Build-time configuration options.
 
 // If set, asan will intercept C++ exception api call(s).
 #ifndef ASAN_HAS_EXCEPTIONS
-# define ASAN_HAS_EXCEPTIONS 1
+#  define ASAN_HAS_EXCEPTIONS 1
 #endif
 
 // If set, values like allocator chunk size, as well as defaults for some flags
@@ -43,11 +43,11 @@
 #endif
 
 #ifndef ASAN_DYNAMIC
-# ifdef PIC
-#  define ASAN_DYNAMIC 1
-# else
-#  define ASAN_DYNAMIC 0
-# endif
+#  ifdef PIC
+#    define ASAN_DYNAMIC 1
+#  else
+#    define ASAN_DYNAMIC 0
+#  endif
 #endif
 
 // All internal functions in asan reside inside the __asan namespace
@@ -127,24 +127,30 @@ void InstallAtExitCheckLeaks();
 
 // Add convenient macro for interface functions that may be represented as
 // weak hooks.
-#define ASAN_MALLOC_HOOK(ptr, size)                                   \
-  do {                                                                \
-    if (&__sanitizer_malloc_hook) __sanitizer_malloc_hook(ptr, size); \
-    RunMallocHooks(ptr, size);                                        \
+#define ASAN_MALLOC_HOOK(ptr, size)       \
+  do {                                    \
+    if (&__sanitizer_malloc_hook)         \
+      __sanitizer_malloc_hook(ptr, size); \
+    RunMallocHooks(ptr, size);            \
   } while (false)
-#define ASAN_FREE_HOOK(ptr)                                 \
-  do {                                                      \
-    if (&__sanitizer_free_hook) __sanitizer_free_hook(ptr); \
-    RunFreeHooks(ptr);                                      \
+
+#define ASAN_FREE_HOOK(ptr)       \
+  do {                            \
+    if (&__sanitizer_free_hook)   \
+      __sanitizer_free_hook(ptr); \
+    RunFreeHooks(ptr);            \
   } while (false)
+
 #define ASAN_ON_ERROR() \
-  if (&__asan_on_error) __asan_on_error()
+  if (&__asan_on_error) \
+  __asan_on_error()
 
 extern int asan_inited;
 // Used to avoid infinite recursion in __asan_init().
 extern bool asan_init_is_running;
 extern void (*death_callback)(void);
-// These magic values are written to shadow for better error reporting.
+// These magic values are written to shadow for better error
+// reporting.
 const int kAsanHeapLeftRedzoneMagic = 0xfa;
 const int kAsanHeapFreeMagic = 0xfd;
 const int kAsanStackLeftRedzoneMagic = 0xf1;

diff  --git a/compiler-rt/lib/hwasan/hwasan.h b/compiler-rt/lib/hwasan/hwasan.h
index 371c43f3cbde7..6c5c0b6986c79 100644
--- a/compiler-rt/lib/hwasan/hwasan.h
+++ b/compiler-rt/lib/hwasan/hwasan.h
@@ -172,14 +172,15 @@ void HwasanTagMismatch(uptr addr, uptr access_info, uptr *registers_frame,
 
 }  // namespace __hwasan
 
-#define HWASAN_MALLOC_HOOK(ptr, size)       \
+#define HWASAN_MALLOC_HOOK(ptr, size)     \
   do {                                    \
     if (&__sanitizer_malloc_hook) {       \
       __sanitizer_malloc_hook(ptr, size); \
     }                                     \
     RunMallocHooks(ptr, size);            \
   } while (false)
-#define HWASAN_FREE_HOOK(ptr)       \
+
+#define HWASAN_FREE_HOOK(ptr)     \
   do {                            \
     if (&__sanitizer_free_hook) { \
       __sanitizer_free_hook(ptr); \

diff  --git a/compiler-rt/lib/lsan/lsan_allocator.cpp b/compiler-rt/lib/lsan/lsan_allocator.cpp
index ea4c6c9cf6470..ccd9b5a8b45d3 100644
--- a/compiler-rt/lib/lsan/lsan_allocator.cpp
+++ b/compiler-rt/lib/lsan/lsan_allocator.cpp
@@ -104,7 +104,8 @@ void *Allocate(const StackTrace &stack, uptr size, uptr alignment,
   if (cleared && allocator.FromPrimary(p))
     memset(p, 0, size);
   RegisterAllocation(stack, p, size);
-  if (&__sanitizer_malloc_hook) __sanitizer_malloc_hook(p, size);
+  if (&__sanitizer_malloc_hook)
+    __sanitizer_malloc_hook(p, size);
   RunMallocHooks(p, size);
   return p;
 }
@@ -120,7 +121,8 @@ static void *Calloc(uptr nmemb, uptr size, const StackTrace &stack) {
 }
 
 void Deallocate(void *p) {
-  if (&__sanitizer_free_hook) __sanitizer_free_hook(p);
+  if (&__sanitizer_free_hook)
+    __sanitizer_free_hook(p);
   RunFreeHooks(p);
   RegisterDeallocation(p);
   allocator.Deallocate(GetAllocatorCache(), p);

diff  --git a/compiler-rt/lib/memprof/memprof_internal.h b/compiler-rt/lib/memprof/memprof_internal.h
index 8d227887fe156..0ebf9e0bbeee2 100644
--- a/compiler-rt/lib/memprof/memprof_internal.h
+++ b/compiler-rt/lib/memprof/memprof_internal.h
@@ -84,6 +84,7 @@ void *MemprofDlSymNext(const char *sym);
       __sanitizer_malloc_hook(ptr, size);                                      \
     RunMallocHooks(ptr, size);                                                 \
   } while (false)
+
 #define MEMPROF_FREE_HOOK(ptr)                                                 \
   do {                                                                         \
     if (&__sanitizer_free_hook)                                                \


        


More information about the llvm-commits mailing list