Skip to content

Commit ce1cb9d

Browse files
committed
[NFC][sanitizer] Clang format some code
1 parent 79fa8be commit ce1cb9d

File tree

4 files changed

+33
-23
lines changed

4 files changed

+33
-23
lines changed

compiler-rt/lib/asan/asan_internal.h

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,19 @@
1717
#include "asan_interface_internal.h"
1818
#include "sanitizer_common/sanitizer_common.h"
1919
#include "sanitizer_common/sanitizer_internal_defs.h"
20-
#include "sanitizer_common/sanitizer_stacktrace.h"
2120
#include "sanitizer_common/sanitizer_libc.h"
21+
#include "sanitizer_common/sanitizer_stacktrace.h"
2222

2323
#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__)
24-
# error "The AddressSanitizer run-time should not be"
25-
" instrumented by AddressSanitizer"
24+
# error \
25+
"The AddressSanitizer run-time should not be instrumented by AddressSanitizer"
2626
#endif
2727

2828
// Build-time configuration options.
2929

3030
// If set, asan will intercept C++ exception api call(s).
3131
#ifndef ASAN_HAS_EXCEPTIONS
32-
# define ASAN_HAS_EXCEPTIONS 1
32+
# define ASAN_HAS_EXCEPTIONS 1
3333
#endif
3434

3535
// If set, values like allocator chunk size, as well as defaults for some flags
@@ -43,11 +43,11 @@
4343
#endif
4444

4545
#ifndef ASAN_DYNAMIC
46-
# ifdef PIC
47-
# define ASAN_DYNAMIC 1
48-
# else
49-
# define ASAN_DYNAMIC 0
50-
# endif
46+
# ifdef PIC
47+
# define ASAN_DYNAMIC 1
48+
# else
49+
# define ASAN_DYNAMIC 0
50+
# endif
5151
#endif
5252

5353
// All internal functions in asan reside inside the __asan namespace
@@ -127,24 +127,30 @@ void InstallAtExitCheckLeaks();
127127

128128
// Add convenient macro for interface functions that may be represented as
129129
// weak hooks.
130-
#define ASAN_MALLOC_HOOK(ptr, size) \
131-
do { \
132-
if (&__sanitizer_malloc_hook) __sanitizer_malloc_hook(ptr, size); \
133-
RunMallocHooks(ptr, size); \
130+
#define ASAN_MALLOC_HOOK(ptr, size) \
131+
do { \
132+
if (&__sanitizer_malloc_hook) \
133+
__sanitizer_malloc_hook(ptr, size); \
134+
RunMallocHooks(ptr, size); \
134135
} while (false)
135-
#define ASAN_FREE_HOOK(ptr) \
136-
do { \
137-
if (&__sanitizer_free_hook) __sanitizer_free_hook(ptr); \
138-
RunFreeHooks(ptr); \
136+
137+
#define ASAN_FREE_HOOK(ptr) \
138+
do { \
139+
if (&__sanitizer_free_hook) \
140+
__sanitizer_free_hook(ptr); \
141+
RunFreeHooks(ptr); \
139142
} while (false)
143+
140144
#define ASAN_ON_ERROR() \
141-
if (&__asan_on_error) __asan_on_error()
145+
if (&__asan_on_error) \
146+
__asan_on_error()
142147

143148
extern int asan_inited;
144149
// Used to avoid infinite recursion in __asan_init().
145150
extern bool asan_init_is_running;
146151
extern void (*death_callback)(void);
147-
// These magic values are written to shadow for better error reporting.
152+
// These magic values are written to shadow for better error
153+
// reporting.
148154
const int kAsanHeapLeftRedzoneMagic = 0xfa;
149155
const int kAsanHeapFreeMagic = 0xfd;
150156
const int kAsanStackLeftRedzoneMagic = 0xf1;

compiler-rt/lib/hwasan/hwasan.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,15 @@ void HwasanTagMismatch(uptr addr, uptr access_info, uptr *registers_frame,
172172

173173
} // namespace __hwasan
174174

175-
#define HWASAN_MALLOC_HOOK(ptr, size) \
175+
#define HWASAN_MALLOC_HOOK(ptr, size) \
176176
do { \
177177
if (&__sanitizer_malloc_hook) { \
178178
__sanitizer_malloc_hook(ptr, size); \
179179
} \
180180
RunMallocHooks(ptr, size); \
181181
} while (false)
182-
#define HWASAN_FREE_HOOK(ptr) \
182+
183+
#define HWASAN_FREE_HOOK(ptr) \
183184
do { \
184185
if (&__sanitizer_free_hook) { \
185186
__sanitizer_free_hook(ptr); \

compiler-rt/lib/lsan/lsan_allocator.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ void *Allocate(const StackTrace &stack, uptr size, uptr alignment,
104104
if (cleared && allocator.FromPrimary(p))
105105
memset(p, 0, size);
106106
RegisterAllocation(stack, p, size);
107-
if (&__sanitizer_malloc_hook) __sanitizer_malloc_hook(p, size);
107+
if (&__sanitizer_malloc_hook)
108+
__sanitizer_malloc_hook(p, size);
108109
RunMallocHooks(p, size);
109110
return p;
110111
}
@@ -120,7 +121,8 @@ static void *Calloc(uptr nmemb, uptr size, const StackTrace &stack) {
120121
}
121122

122123
void Deallocate(void *p) {
123-
if (&__sanitizer_free_hook) __sanitizer_free_hook(p);
124+
if (&__sanitizer_free_hook)
125+
__sanitizer_free_hook(p);
124126
RunFreeHooks(p);
125127
RegisterDeallocation(p);
126128
allocator.Deallocate(GetAllocatorCache(), p);

compiler-rt/lib/memprof/memprof_internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ void *MemprofDlSymNext(const char *sym);
8484
__sanitizer_malloc_hook(ptr, size); \
8585
RunMallocHooks(ptr, size); \
8686
} while (false)
87+
8788
#define MEMPROF_FREE_HOOK(ptr) \
8889
do { \
8990
if (&__sanitizer_free_hook) \

0 commit comments

Comments
 (0)