mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-17 09:16:38 +00:00

C++11 `alignas` is already used extensively. `alignas` must precede `static`, so adjust the ordering accordingly. msan.cpp: Clang 15 doesn't allow `__attribute__((visibility("default"))) alignas(16)`. Use the order `alignas(16) SANITIZER_INTERFACE_ATTRIBUTE`. Tested with Clang 7. Pull Request: https://github.com/llvm/llvm-project/pull/98958
30 lines
907 B
C++
30 lines
907 B
C++
#include "hwasan_thread_list.h"
|
|
|
|
#include "sanitizer_common/sanitizer_placement_new.h"
|
|
#include "sanitizer_common/sanitizer_thread_arg_retval.h"
|
|
|
|
namespace __hwasan {
|
|
|
|
static HwasanThreadList *hwasan_thread_list;
|
|
static ThreadArgRetval *thread_data;
|
|
|
|
HwasanThreadList &hwasanThreadList() { return *hwasan_thread_list; }
|
|
ThreadArgRetval &hwasanThreadArgRetval() { return *thread_data; }
|
|
|
|
void InitThreadList(uptr storage, uptr size) {
|
|
CHECK_EQ(hwasan_thread_list, nullptr);
|
|
|
|
alignas(alignof(HwasanThreadList)) static char
|
|
thread_list_placeholder[sizeof(HwasanThreadList)];
|
|
hwasan_thread_list =
|
|
new (thread_list_placeholder) HwasanThreadList(storage, size);
|
|
|
|
CHECK_EQ(thread_data, nullptr);
|
|
|
|
alignas(alignof(ThreadArgRetval)) static char
|
|
thread_data_placeholder[sizeof(ThreadArgRetval)];
|
|
thread_data = new (thread_data_placeholder) ThreadArgRetval();
|
|
}
|
|
|
|
} // namespace __hwasan
|