forked from OSchip/llvm-project
[CMake] [MinGW] Enable use of LLVM_USE_SANITIZER in a MinGW environment
Currently using LLVM_USE_SANITIZER with a MinGW target leads to a fatal configuration error due to an unsupported platform. MinGW targets on clang however implement a few sanitizers, currently ASAN and UBSAN. This patch enables LLVM_USE_SANITIZER in a MinGW environment as well. Differential Revision: https://reviews.llvm.org/D95750
This commit is contained in:
parent
ec41ed5b1b
commit
99dfcfd14c
|
@ -793,6 +793,21 @@ if(LLVM_USE_SANITIZER)
|
|||
else()
|
||||
message(FATAL_ERROR "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
|
||||
endif()
|
||||
elseif(MINGW)
|
||||
if (LLVM_USE_SANITIZER STREQUAL "Address")
|
||||
append_common_sanitizer_flags()
|
||||
append("-fsanitize=address" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||
elseif (LLVM_USE_SANITIZER STREQUAL "Undefined")
|
||||
append_common_sanitizer_flags()
|
||||
append("${LLVM_UBSAN_FLAGS}" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||
elseif (LLVM_USE_SANITIZER STREQUAL "Address;Undefined" OR
|
||||
LLVM_USE_SANITIZER STREQUAL "Undefined;Address")
|
||||
append_common_sanitizer_flags()
|
||||
append("-fsanitize=address" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||
append("${LLVM_UBSAN_FLAGS}" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
|
||||
else()
|
||||
message(FATAL_ERROR "This sanitizer not yet supported in a MinGW environment: ${LLVM_USE_SANITIZER}")
|
||||
endif()
|
||||
elseif(MSVC)
|
||||
if (LLVM_USE_SANITIZER STREQUAL "Address")
|
||||
append_common_sanitizer_flags()
|
||||
|
|
Loading…
Reference in New Issue