forked from OSchip/llvm-project
[NFC][sanitizer] Clang format some code
This commit is contained in:
parent
79fa8be4ae
commit
ce1cb9d2c1
|
@ -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;
|
||||
|
|
|
@ -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); \
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) \
|
||||
|
|
Loading…
Reference in New Issue