Skip to content

Commit b78dbb5

Browse files
committed
Fix clang-format noise.
1 parent b590be6 commit b78dbb5

File tree

3 files changed

+39
-40
lines changed

3 files changed

+39
-40
lines changed

compiler-rt/lib/asan/asan_allocator.cpp

Lines changed: 30 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,36 +1409,36 @@ namespace __asan {
14091409
static const size_t kPageSize_ = 4096;
14101410

14111411
hsa_status_t asan_hsa_amd_memory_pool_allocate(
1412-
hsa_amd_memory_pool_t memory_pool, size_t size, uint32_t flags, void** ptr,
1413-
BufferedStackTrace* stack) {
1412+
hsa_amd_memory_pool_t memory_pool, size_t size, uint32_t flags, void **ptr,
1413+
BufferedStackTrace *stack) {
14141414
AmdgpuAllocationInfo aa_info;
14151415
aa_info.alloc_func =
1416-
reinterpret_cast<void*>(asan_hsa_amd_memory_pool_allocate);
1416+
reinterpret_cast<void *>(asan_hsa_amd_memory_pool_allocate);
14171417
aa_info.memory_pool = memory_pool;
14181418
aa_info.size = size;
14191419
aa_info.flags = flags;
14201420
aa_info.ptr = nullptr;
1421-
SetErrnoOnNull(*ptr = instance.Allocate(size, kPageSize_, stack, FROM_MALLOC,
1422-
false, &aa_info));
1421+
SetErrnoOnNull(*ptr = instance.Allocate(size, kPageSize_, stack,
1422+
FROM_MALLOC, false, &aa_info));
14231423
return aa_info.status;
14241424
}
14251425

1426-
hsa_status_t asan_hsa_amd_memory_pool_free(void* ptr,
1427-
BufferedStackTrace* stack) {
1428-
void* p = get_allocator().GetBlockBegin(ptr);
1426+
hsa_status_t asan_hsa_amd_memory_pool_free(
1427+
void *ptr,
1428+
BufferedStackTrace *stack) {
1429+
void *p = get_allocator().GetBlockBegin(ptr);
14291430
if (p) {
14301431
instance.Deallocate(ptr, 0, 0, stack, FROM_MALLOC);
14311432
return HSA_STATUS_SUCCESS;
14321433
}
14331434
return REAL(hsa_amd_memory_pool_free)(ptr);
14341435
}
14351436

1436-
hsa_status_t asan_hsa_amd_agents_allow_access(uint32_t num_agents,
1437-
const hsa_agent_t* agents,
1438-
const uint32_t* flags,
1439-
const void* ptr,
1440-
BufferedStackTrace* stack) {
1441-
void* p = get_allocator().GetBlockBegin(ptr);
1437+
hsa_status_t asan_hsa_amd_agents_allow_access(
1438+
uint32_t num_agents, const hsa_agent_t *agents, const uint32_t *flags,
1439+
const void *ptr,
1440+
BufferedStackTrace *stack) {
1441+
void *p = get_allocator().GetBlockBegin(ptr);
14421442
return REAL(hsa_amd_agents_allow_access)(num_agents, agents, flags,
14431443
p ? p : ptr);
14441444
}
@@ -1448,45 +1448,44 @@ hsa_status_t asan_hsa_amd_agents_allow_access(uint32_t num_agents,
14481448
// is always one kPageSize_
14491449
// IPC calls use static_assert to make sure kMetadataSize = 0
14501450
//
1451-
# if SANITIZER_CAN_USE_ALLOCATOR64
1451+
#if SANITIZER_CAN_USE_ALLOCATOR64
14521452
static struct AP64<LocalAddressSpaceView> AP_;
1453-
# else
1453+
#else
14541454
static struct AP32<LocalAddressSpaceView> AP_;
1455-
# endif
1455+
#endif
14561456

1457-
hsa_status_t asan_hsa_amd_ipc_memory_create(void* ptr, size_t len,
1458-
hsa_amd_ipc_memory_t* handle) {
1459-
void* ptr_;
1457+
hsa_status_t asan_hsa_amd_ipc_memory_create(void *ptr, size_t len,
1458+
hsa_amd_ipc_memory_t * handle) {
1459+
void *ptr_;
14601460
size_t len_ = get_allocator().GetActuallyAllocatedSize(ptr);
14611461
if (len_) {
14621462
static_assert(AP_.kMetadataSize == 0, "Expression below requires this");
1463-
ptr_ = reinterpret_cast<void*>(reinterpret_cast<uptr>(ptr) - kPageSize_);
1463+
ptr_ = reinterpret_cast<void *>(reinterpret_cast<uptr>(ptr) - kPageSize_);
14641464
} else {
14651465
ptr_ = ptr;
14661466
len_ = len;
14671467
}
14681468
return REAL(hsa_amd_ipc_memory_create)(ptr_, len_, handle);
14691469
}
14701470

1471-
hsa_status_t asan_hsa_amd_ipc_memory_attach(const hsa_amd_ipc_memory_t* handle,
1472-
size_t len, uint32_t num_agents,
1473-
const hsa_agent_t* mapping_agents,
1474-
void** mapped_ptr) {
1471+
hsa_status_t asan_hsa_amd_ipc_memory_attach(const hsa_amd_ipc_memory_t *handle,
1472+
size_t len, uint32_t num_agents, const hsa_agent_t *mapping_agents,
1473+
void **mapped_ptr) {
14751474
static_assert(AP_.kMetadataSize == 0, "Expression below requires this");
14761475
size_t len_ = len + kPageSize_;
14771476
hsa_status_t status = REAL(hsa_amd_ipc_memory_attach)(
1478-
handle, len_, num_agents, mapping_agents, mapped_ptr);
1477+
handle, len_, num_agents, mapping_agents, mapped_ptr);
14791478
if (status == HSA_STATUS_SUCCESS && mapped_ptr) {
1480-
*mapped_ptr = reinterpret_cast<void*>(reinterpret_cast<uptr>(*mapped_ptr) +
1481-
kPageSize_);
1479+
*mapped_ptr = reinterpret_cast<void *>(reinterpret_cast<uptr>(*mapped_ptr) +
1480+
kPageSize_);
14821481
}
14831482
return status;
14841483
}
14851484

1486-
hsa_status_t asan_hsa_amd_ipc_memory_detach(void* mapped_ptr) {
1485+
hsa_status_t asan_hsa_amd_ipc_memory_detach(void *mapped_ptr) {
14871486
static_assert(AP_.kMetadataSize == 0, "Expression below requires this");
1488-
void* mapped_ptr_ =
1489-
reinterpret_cast<void*>(reinterpret_cast<uptr>(mapped_ptr) - kPageSize_);
1487+
void *mapped_ptr_ =
1488+
reinterpret_cast<void *>(reinterpret_cast<uptr>(mapped_ptr) - kPageSize_);
14901489
return REAL(hsa_amd_ipc_memory_detach)(mapped_ptr_);
14911490
}
14921491

compiler-rt/lib/asan/asan_interceptors.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,7 @@ INTERCEPTOR(hsa_status_t, hsa_amd_vmem_address_free, void* ptr, size_t size) {
950950

951951
INTERCEPTOR(hsa_status_t, hsa_init) {
952952
AsanInitFromRtl();
953+
ENSURE_HSA_INITED();
953954
return asan_hsa_init();
954955
}
955956

compiler-rt/lib/sanitizer_common/sanitizer_allocator_amdgpu.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,29 +11,28 @@
1111
//===----------------------------------------------------------------------===//
1212
#if SANITIZER_AMDGPU
1313
# include <dlfcn.h> // For dlsym
14-
1514
# include "sanitizer_allocator.h"
1615
# include "sanitizer_atomic.h"
1716

1817
namespace __sanitizer {
1918
struct HsaFunctions {
2019
// ---------------- Memory Functions ----------------
2120
hsa_status_t (*memory_pool_allocate)(hsa_amd_memory_pool_t memory_pool,
22-
size_t size, uint32_t flags, void** ptr);
23-
hsa_status_t (*memory_pool_free)(void* ptr);
24-
hsa_status_t (*pointer_info)(void* ptr, hsa_amd_pointer_info_t* info,
25-
void* (*alloc)(size_t),
26-
uint32_t* num_agents_accessible,
27-
hsa_agent_t** accessible);
21+
size_t size, uint32_t flags, void **ptr);
22+
hsa_status_t (*memory_pool_free)(void *ptr);
23+
hsa_status_t (*pointer_info)(void *ptr, hsa_amd_pointer_info_t *info,
24+
void *(*alloc)(size_t),
25+
uint32_t *num_agents_accessible,
26+
hsa_agent_t **accessible);
2827
hsa_status_t (*vmem_address_reserve_align)(void** ptr, size_t size,
2928
uint64_t address,
3029
uint64_t alignment,
3130
uint64_t flags);
32-
hsa_status_t (*vmem_address_free)(void* ptr, size_t size);
31+
hsa_status_t (*vmem_address_free)(void *ptr, size_t size);
3332

3433
// ----------------Event Functions ----------------
3534
hsa_status_t (*register_system_event_handler)(
36-
hsa_amd_system_event_callback_t callback, void* data);
35+
hsa_amd_system_event_callback_t callback, void *data);
3736
};
3837

3938
static HsaFunctions hsa_amd;

0 commit comments

Comments
 (0)