forked from OSchip/llvm-project
sanitizer_common: fix 32-bit build
https://reviews.llvm.org/D105716 enabled thread safety annotations, and that broke 32-bit build: https://green.lab.llvm.org/green/job/lldb-cmake/33604/consoleFull#-77815080549ba4694-19c4-4d7e-bec5-911270d8a58c 1. Enable thread-safety analysis in unit tests (this catches the breakage even in 64-bit mode). 2. Add NO_THREAD_SAFETY_ANALYSIS to sanitizer_allocator_primary32.h to unbreak the build. Reviewed By: melver Differential Revision: https://reviews.llvm.org/D105808
This commit is contained in:
parent
f042e0a0f8
commit
10158b52dc
|
@ -360,11 +360,13 @@ endif()
|
|||
append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 SANITIZER_COMMON_CFLAGS)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES Clang)
|
||||
list(APPEND SANITIZER_COMMON_CFLAGS
|
||||
list(APPEND THREAD_SAFETY_FLAGS
|
||||
"-Werror=thread-safety"
|
||||
"-Werror=thread-safety-reference"
|
||||
"-Werror=thread-safety-beta"
|
||||
)
|
||||
)
|
||||
list(APPEND SANITIZER_COMMON_CFLAGS ${THREAD_SAFETY_FLAGS})
|
||||
list(APPEND COMPILER_RT_TEST_COMPILER_CFLAGS ${THREAD_SAFETY_FLAGS})
|
||||
endif()
|
||||
|
||||
# If we're using MSVC,
|
||||
|
|
|
@ -237,13 +237,13 @@ class SizeClassAllocator32 {
|
|||
|
||||
// ForceLock() and ForceUnlock() are needed to implement Darwin malloc zone
|
||||
// introspection API.
|
||||
void ForceLock() {
|
||||
void ForceLock() NO_THREAD_SAFETY_ANALYSIS {
|
||||
for (uptr i = 0; i < kNumClasses; i++) {
|
||||
GetSizeClassInfo(i)->mutex.Lock();
|
||||
}
|
||||
}
|
||||
|
||||
void ForceUnlock() {
|
||||
void ForceUnlock() NO_THREAD_SAFETY_ANALYSIS {
|
||||
for (int i = kNumClasses - 1; i >= 0; i--) {
|
||||
GetSizeClassInfo(i)->mutex.Unlock();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue