[Sanitizer tests] Land the sanitizer twin of the asan-only change r208682

llvm-svn: 208697
This commit is contained in:
Timur Iskhodzhanov 2014-05-13 13:29:11 +00:00
parent 339e8c98f8
commit e33158bcd1
1 changed files with 28 additions and 2 deletions

View File

@ -39,10 +39,32 @@ set(SANITIZER_TEST_CFLAGS_COMMON
-I${COMPILER_RT_SOURCE_DIR}/lib
-I${COMPILER_RT_SOURCE_DIR}/lib/sanitizer_common
-DGTEST_HAS_RTTI=0
-O2 -g -fno-rtti
-O2
-Werror=sign-compare
-Wno-non-virtual-dtor)
append_if(COMPILER_RT_HAS_G_FLAG -g SANITIZER_TEST_CFLAGS_COMMON)
append_if(COMPILER_RT_HAS_Zi_FLAG -Zi SANITIZER_TEST_CFLAGS_COMMON)
append_if(COMPILER_RT_HAS_FNO_RTTI_FLAG -fno-rtti SANITIZER_TEST_CFLAGS_COMMON)
append_if(COMPILER_RT_HAS_GR_FLAG -GR- SANITIZER_TEST_CFLAGS_COMMON)
if(MSVC)
# System headers and gtest use a lot of deprecated stuff.
list(APPEND SANITIZER_TEST_CFLAGS_COMMON
-Wno-deprecated-declarations)
# clang-cl doesn't support exceptions yet.
list(APPEND SANITIZER_TEST_CFLAGS_COMMON
/fallback
-D_HAS_EXCEPTIONS=0)
# We should teach clang-cl to understand more pragmas.
list(APPEND SANITIZER_TEST_CFLAGS_COMMON
-Wno-unknown-pragmas
-Wno-undefined-inline)
endif()
append_if(COMPILER_RT_HAS_LIBSTDCXX -lstdc++ SANITIZER_TEST_LINK_FLAGS_COMMON)
append_if(COMPILER_RT_HAS_LIBDL -ldl SANITIZER_TEST_LINK_FLAGS_COMMON)
append_if(COMPILER_RT_HAS_LIBPTHREAD -lpthread SANITIZER_TEST_LINK_FLAGS_COMMON)
@ -69,7 +91,11 @@ function(get_sanitizer_common_lib_for_arch arch lib lib_name)
set(tgt_name "RTSanitizerCommon.test.${arch}")
endif()
set(${lib} "${tgt_name}" PARENT_SCOPE)
set(${lib_name} "lib${tgt_name}.a" PARENT_SCOPE)
if(NOT MSVC)
set(${lib_name} "lib${tgt_name}.a" PARENT_SCOPE)
else()
set(${lib_name} "${tgt_name}.lib" PARENT_SCOPE)
endif()
endfunction()
# Sanitizer_common unit tests testsuite.