From ed4fbe6d9cfd25c1783eccf28f1b475b3a8ee390 Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Fri, 30 Oct 2020 16:16:09 -0700 Subject: [PATCH 1/4] [CMake] Replace ctime with time.h in memprof Part of D88922 --- compiler-rt/lib/memprof/memprof_allocator.cpp | 2 +- compiler-rt/lib/memprof/memprof_rtl.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler-rt/lib/memprof/memprof_allocator.cpp b/compiler-rt/lib/memprof/memprof_allocator.cpp index f13fde02c13584..c6a68118f7de2b 100644 --- a/compiler-rt/lib/memprof/memprof_allocator.cpp +++ b/compiler-rt/lib/memprof/memprof_allocator.cpp @@ -27,9 +27,9 @@ #include "sanitizer_common/sanitizer_list.h" #include "sanitizer_common/sanitizer_stackdepot.h" -#include #include #include +#include namespace __memprof { diff --git a/compiler-rt/lib/memprof/memprof_rtl.cpp b/compiler-rt/lib/memprof/memprof_rtl.cpp index 93264dd562d089..8e1335aea875e6 100644 --- a/compiler-rt/lib/memprof/memprof_rtl.cpp +++ b/compiler-rt/lib/memprof/memprof_rtl.cpp @@ -23,7 +23,8 @@ #include "sanitizer_common/sanitizer_flags.h" #include "sanitizer_common/sanitizer_libc.h" #include "sanitizer_common/sanitizer_symbolizer.h" -#include + +#include uptr __memprof_shadow_memory_dynamic_address; // Global interface symbol. From 6db314e86b26741c2e29ce51d88a6a5dca35336c Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Fri, 30 Oct 2020 16:16:09 -0700 Subject: [PATCH 2/4] [CMake] Remove cxx-headers from runtime deps Part of D88922 --- compiler-rt/lib/asan/CMakeLists.txt | 28 +++++++---------------- compiler-rt/lib/hwasan/CMakeLists.txt | 16 ++++--------- compiler-rt/lib/memprof/CMakeLists.txt | 4 ---- compiler-rt/lib/tsan/CMakeLists.txt | 10 +------- compiler-rt/lib/tsan/tests/CMakeLists.txt | 8 ++++++- 5 files changed, 20 insertions(+), 46 deletions(-) diff --git a/compiler-rt/lib/asan/CMakeLists.txt b/compiler-rt/lib/asan/CMakeLists.txt index 41e889eb79e6fa..17214e3f95cbec 100644 --- a/compiler-rt/lib/asan/CMakeLists.txt +++ b/compiler-rt/lib/asan/CMakeLists.txt @@ -111,10 +111,6 @@ append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread ASAN_DYNAMIC_LIBS) append_list_if(COMPILER_RT_HAS_LIBLOG log ASAN_DYNAMIC_LIBS) append_list_if(MINGW "${MINGW_LIBRARIES}" ASAN_DYNAMIC_LIBS) -if (TARGET cxx-headers OR HAVE_LIBCXX) - set(ASAN_DEPS cxx-headers) -endif() - # Compile ASan sources into an object library. add_compiler_rt_object_libraries(RTAsan_dynamic @@ -123,8 +119,7 @@ add_compiler_rt_object_libraries(RTAsan_dynamic SOURCES ${ASAN_SOURCES} ${ASAN_CXX_SOURCES} ADDITIONAL_HEADERS ${ASAN_HEADERS} CFLAGS ${ASAN_DYNAMIC_CFLAGS} - DEFS ${ASAN_DYNAMIC_DEFINITIONS} - DEPS ${ASAN_DEPS}) + DEFS ${ASAN_DYNAMIC_DEFINITIONS}) if(NOT APPLE) add_compiler_rt_object_libraries(RTAsan @@ -132,30 +127,26 @@ if(NOT APPLE) SOURCES ${ASAN_SOURCES} ADDITIONAL_HEADERS ${ASAN_HEADERS} CFLAGS ${ASAN_CFLAGS} - DEFS ${ASAN_COMMON_DEFINITIONS} - DEPS ${ASAN_DEPS}) + DEFS ${ASAN_COMMON_DEFINITIONS}) add_compiler_rt_object_libraries(RTAsan_cxx ARCHS ${ASAN_SUPPORTED_ARCH} SOURCES ${ASAN_CXX_SOURCES} ADDITIONAL_HEADERS ${ASAN_HEADERS} CFLAGS ${ASAN_CFLAGS} - DEFS ${ASAN_COMMON_DEFINITIONS} - DEPS ${ASAN_DEPS}) + DEFS ${ASAN_COMMON_DEFINITIONS}) add_compiler_rt_object_libraries(RTAsan_preinit ARCHS ${ASAN_SUPPORTED_ARCH} SOURCES ${ASAN_PREINIT_SOURCES} ADDITIONAL_HEADERS ${ASAN_HEADERS} CFLAGS ${ASAN_CFLAGS} - DEFS ${ASAN_COMMON_DEFINITIONS} - DEPS ${ASAN_DEPS}) + DEFS ${ASAN_COMMON_DEFINITIONS}) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp "") add_compiler_rt_object_libraries(RTAsan_dynamic_version_script_dummy ARCHS ${ASAN_SUPPORTED_ARCH} SOURCES ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp CFLAGS ${ASAN_DYNAMIC_CFLAGS} - DEFS ${ASAN_DYNAMIC_DEFINITIONS} - DEPS ${ASAN_DEPS}) + DEFS ${ASAN_DYNAMIC_DEFINITIONS}) endif() # Build ASan runtimes shipped with Clang. @@ -250,8 +241,7 @@ else() ARCHS ${arch} SOURCES asan_win_weak_interception.cpp CFLAGS ${ASAN_CFLAGS} -DSANITIZER_DYNAMIC - DEFS ${ASAN_COMMON_DEFINITIONS} - DEPS ${ASAN_DEPS}) + DEFS ${ASAN_COMMON_DEFINITIONS}) set(ASAN_DYNAMIC_WEAK_INTERCEPTION AsanWeakInterception UbsanWeakInterception @@ -296,8 +286,7 @@ else() SOURCES asan_globals_win.cpp asan_win_dll_thunk.cpp CFLAGS ${ASAN_CFLAGS} -DSANITIZER_DLL_THUNK - DEFS ${ASAN_COMMON_DEFINITIONS} - DEPS ${ASAN_DEPS}) + DEFS ${ASAN_COMMON_DEFINITIONS}) add_compiler_rt_runtime(clang_rt.asan_dll_thunk STATIC @@ -322,8 +311,7 @@ else() SOURCES asan_globals_win.cpp asan_win_dynamic_runtime_thunk.cpp CFLAGS ${ASAN_CFLAGS} ${DYNAMIC_RUNTIME_THUNK_CFLAGS} - DEFS ${ASAN_COMMON_DEFINITIONS} - DEPS ${ASAN_DEPS}) + DEFS ${ASAN_COMMON_DEFINITIONS}) add_compiler_rt_runtime(clang_rt.asan_dynamic_runtime_thunk STATIC diff --git a/compiler-rt/lib/hwasan/CMakeLists.txt b/compiler-rt/lib/hwasan/CMakeLists.txt index d294579c970c8e..b20bb441c82028 100644 --- a/compiler-rt/lib/hwasan/CMakeLists.txt +++ b/compiler-rt/lib/hwasan/CMakeLists.txt @@ -71,10 +71,6 @@ append_list_if(COMPILER_RT_HAS_LIBRT rt HWASAN_DYNAMIC_LIBS) append_list_if(COMPILER_RT_HAS_LIBM m HWASAN_DYNAMIC_LIBS) append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread HWASAN_DYNAMIC_LIBS) -if (TARGET cxx-headers OR HAVE_LIBCXX) - set(HWASAN_DEPS cxx-headers) -endif() - # Static runtime library. add_compiler_rt_component(hwasan) @@ -83,30 +79,26 @@ add_compiler_rt_object_libraries(RTHwasan SOURCES ${HWASAN_RTL_SOURCES} ADDITIONAL_HEADERS ${HWASAN_RTL_HEADERS} CFLAGS ${HWASAN_RTL_CFLAGS} - DEFS ${HWASAN_DEFINITIONS} - DEPS ${HWASAN_DEPS}) + DEFS ${HWASAN_DEFINITIONS}) add_compiler_rt_object_libraries(RTHwasan_cxx ARCHS ${HWASAN_SUPPORTED_ARCH} SOURCES ${HWASAN_RTL_CXX_SOURCES} ADDITIONAL_HEADERS ${HWASAN_RTL_HEADERS} CFLAGS ${HWASAN_RTL_CFLAGS} - DEFS ${HWASAN_DEFINITIONS} - DEPS ${HWASAN_DEPS}) + DEFS ${HWASAN_DEFINITIONS}) add_compiler_rt_object_libraries(RTHwasan_dynamic ARCHS ${HWASAN_SUPPORTED_ARCH} SOURCES ${HWASAN_RTL_SOURCES} ${HWASAN_RTL_CXX_SOURCES} ADDITIONAL_HEADERS ${HWASAN_RTL_HEADERS} CFLAGS ${HWASAN_DYNAMIC_CFLAGS} - DEFS ${HWASAN_DEFINITIONS} - DEPS ${HWASAN_DEPS}) + DEFS ${HWASAN_DEFINITIONS}) file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp "") add_compiler_rt_object_libraries(RTHwasan_dynamic_version_script_dummy ARCHS ${HWASAN_SUPPORTED_ARCH} SOURCES ${CMAKE_CURRENT_BINARY_DIR}/dummy.cpp CFLAGS ${HWASAN_DYNAMIC_CFLAGS} - DEFS ${HWASAN_DEFINITIONS} - DEPS ${HWASAN_DEPS}) + DEFS ${HWASAN_DEFINITIONS}) foreach(arch ${HWASAN_SUPPORTED_ARCH}) add_compiler_rt_runtime(clang_rt.hwasan diff --git a/compiler-rt/lib/memprof/CMakeLists.txt b/compiler-rt/lib/memprof/CMakeLists.txt index a990ef3304d5fe..92f9da1d423443 100644 --- a/compiler-rt/lib/memprof/CMakeLists.txt +++ b/compiler-rt/lib/memprof/CMakeLists.txt @@ -64,10 +64,6 @@ append_list_if(COMPILER_RT_HAS_LIBM m MEMPROF_DYNAMIC_LIBS) append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread MEMPROF_DYNAMIC_LIBS) append_list_if(COMPILER_RT_HAS_LIBLOG log MEMPROF_DYNAMIC_LIBS) -if (TARGET cxx-headers OR HAVE_LIBCXX) - set(MEMPROF_DEPS cxx-headers) -endif() - # Compile MemProf sources into an object library. add_compiler_rt_object_libraries(RTMemprof_dynamic diff --git a/compiler-rt/lib/tsan/CMakeLists.txt b/compiler-rt/lib/tsan/CMakeLists.txt index 3c6731d79dc457..c99b16d8aaa3a1 100644 --- a/compiler-rt/lib/tsan/CMakeLists.txt +++ b/compiler-rt/lib/tsan/CMakeLists.txt @@ -25,10 +25,6 @@ append_list_if(SANITIZER_LIMIT_FRAME_SIZE -Wframe-larger-than=530 append_list_if(COMPILER_RT_HAS_WGLOBAL_CONSTRUCTORS_FLAG -Wglobal-constructors TSAN_RTL_CFLAGS) -if (TARGET cxx-headers OR HAVE_LIBCXX) - set(TSAN_DEPS cxx-headers) -endif() - set(TSAN_SOURCES rtl/tsan_clock.cpp rtl/tsan_debugging.cpp @@ -146,7 +142,6 @@ if(APPLE) RTSanitizerCommonSymbolizer RTUbsan CFLAGS ${TSAN_RTL_CFLAGS} - DEPS ${TSAN_DEPS} LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS} LINK_LIBS ${TSAN_LINK_LIBS} objc PARENT_TARGET tsan) @@ -155,8 +150,7 @@ if(APPLE) ARCHS ${TSAN_SUPPORTED_ARCH} SOURCES ${TSAN_SOURCES} ${TSAN_CXX_SOURCES} ${TSAN_ASM_SOURCES} ADDITIONAL_HEADERS ${TSAN_HEADERS} - CFLAGS ${TSAN_RTL_CFLAGS} - DEPS ${TSAN_DEPS}) + CFLAGS ${TSAN_RTL_CFLAGS}) # Build and check Go runtime. set(BUILDGO_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/go/buildgo.sh) @@ -220,7 +214,6 @@ else() $ ADDITIONAL_HEADERS ${TSAN_HEADERS} CFLAGS ${TSAN_RTL_CFLAGS} - DEPS ${TSAN_DEPS} PARENT_TARGET tsan) add_compiler_rt_runtime(clang_rt.tsan_cxx STATIC @@ -229,7 +222,6 @@ else() $ ADDITIONAL_HEADERS ${TSAN_HEADERS} CFLAGS ${TSAN_RTL_CFLAGS} - DEPS ${TSAN_DEPS} PARENT_TARGET tsan) list(APPEND TSAN_RUNTIME_LIBRARIES clang_rt.tsan-${arch} clang_rt.tsan_cxx-${arch}) diff --git a/compiler-rt/lib/tsan/tests/CMakeLists.txt b/compiler-rt/lib/tsan/tests/CMakeLists.txt index 7b1ba21c52d936..61b01a8b4da122 100644 --- a/compiler-rt/lib/tsan/tests/CMakeLists.txt +++ b/compiler-rt/lib/tsan/tests/CMakeLists.txt @@ -53,6 +53,12 @@ foreach (header ${TSAN_HEADERS}) list(APPEND TSAN_RTL_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/../${header}) endforeach() +set(TSAN_DEPS gtest tsan) +# TSan uses C++ standard library headers. +if (TARGET cxx-headers OR HAVE_LIBCXX) + set(TSAN_DEPS cxx-headers) +endif() + # add_tsan_unittest( # SOURCES # HEADERS ) @@ -66,7 +72,7 @@ macro(add_tsan_unittest testname) SOURCES ${TEST_SOURCES} ${COMPILER_RT_GTEST_SOURCE} RUNTIME ${TSAN_TEST_RUNTIME} COMPILE_DEPS ${TEST_HEADERS} ${TSAN_RTL_HEADERS} - DEPS gtest tsan + DEPS ${TSAN_DEPS} CFLAGS ${TSAN_UNITTEST_CFLAGS} LINK_FLAGS ${LINK_FLAGS}) endforeach() From 59d503159134de548c3958efb597db545bdef650 Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Fri, 30 Oct 2020 16:16:09 -0700 Subject: [PATCH 3/4] [CMake] Add -fno-rtti into tsan unittests And some other NFC parts of D88922 --- compiler-rt/cmake/config-ix.cmake | 1 + compiler-rt/lib/fuzzer/CMakeLists.txt | 1 + compiler-rt/lib/profile/CMakeLists.txt | 2 +- compiler-rt/lib/tsan/tests/CMakeLists.txt | 5 +++-- compiler-rt/lib/xray/CMakeLists.txt | 1 + 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/compiler-rt/cmake/config-ix.cmake b/compiler-rt/cmake/config-ix.cmake index 38a1a2bdfac515..88a874f20ec240 100644 --- a/compiler-rt/cmake/config-ix.cmake +++ b/compiler-rt/cmake/config-ix.cmake @@ -123,6 +123,7 @@ check_symbol_exists(__func__ "" COMPILER_RT_HAS_FUNC_SYMBOL) # Includes. check_cxx_compiler_flag(-nostdinc++ COMPILER_RT_HAS_NOSTDINCXX_FLAG) +check_cxx_compiler_flag(-nostdlib++ COMPILER_RT_HAS_NOSTDLIBXX_FLAG) check_include_files("sys/auxv.h" COMPILER_RT_HAS_AUXV) # Libraries. diff --git a/compiler-rt/lib/fuzzer/CMakeLists.txt b/compiler-rt/lib/fuzzer/CMakeLists.txt index b98c27145687b0..48bb7fb956af65 100644 --- a/compiler-rt/lib/fuzzer/CMakeLists.txt +++ b/compiler-rt/lib/fuzzer/CMakeLists.txt @@ -64,6 +64,7 @@ if(OS_NAME MATCHES "Linux|Fuchsia" AND # Remove -stdlib= which is unused when passing -nostdinc++. string(REGEX REPLACE "-stdlib=[a-zA-Z+]*" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) elseif(TARGET cxx-headers OR HAVE_LIBCXX) + # libFuzzer uses C++ standard library headers. set(LIBFUZZER_DEPS cxx-headers) endif() diff --git a/compiler-rt/lib/profile/CMakeLists.txt b/compiler-rt/lib/profile/CMakeLists.txt index 3457bb6444de6f..f899e402d92228 100644 --- a/compiler-rt/lib/profile/CMakeLists.txt +++ b/compiler-rt/lib/profile/CMakeLists.txt @@ -113,7 +113,7 @@ endif() # We don't use the C++ Standard Library here, so avoid including it by mistake. append_list_if(COMPILER_RT_HAS_NOSTDINCXX_FLAG -nostdinc++ EXTRA_FLAGS) -# Remove -stdlib= which is unused when passing -nostdinc++. +# XRay uses C++ standard library headers. string(REGEX REPLACE "-stdlib=[a-zA-Z+]*" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # This appears to be a C-only warning banning the use of locals in aggregate diff --git a/compiler-rt/lib/tsan/tests/CMakeLists.txt b/compiler-rt/lib/tsan/tests/CMakeLists.txt index 61b01a8b4da122..5d27e134555ac7 100644 --- a/compiler-rt/lib/tsan/tests/CMakeLists.txt +++ b/compiler-rt/lib/tsan/tests/CMakeLists.txt @@ -5,13 +5,14 @@ set_target_properties(TsanUnitTests PROPERTIES FOLDER "Compiler-RT Tests") set(TSAN_UNITTEST_CFLAGS - ${TSAN_CFLAGS} ${COMPILER_RT_UNITTEST_CFLAGS} ${COMPILER_RT_GTEST_CFLAGS} -I${COMPILER_RT_SOURCE_DIR}/include -I${COMPILER_RT_SOURCE_DIR}/lib -I${COMPILER_RT_SOURCE_DIR}/lib/tsan/rtl - -DGTEST_HAS_RTTI=0) + -DGTEST_HAS_RTTI=0 + -fno-rtti +) set(TSAN_TEST_ARCH ${TSAN_SUPPORTED_ARCH}) diff --git a/compiler-rt/lib/xray/CMakeLists.txt b/compiler-rt/lib/xray/CMakeLists.txt index 3798f557c42cef..1b738d0ff5bf8b 100644 --- a/compiler-rt/lib/xray/CMakeLists.txt +++ b/compiler-rt/lib/xray/CMakeLists.txt @@ -149,6 +149,7 @@ set(XRAY_COMMON_RUNTIME_OBJECT_LIBS RTSanitizerCommon RTSanitizerCommonLibc) +# XRay uses C++ standard library headers. if (TARGET cxx-headers OR HAVE_LIBCXX) set(XRAY_DEPS cxx-headers) endif() From d11710dae6c18e91ee7e58b2f833f4722cc8f78a Mon Sep 17 00:00:00 2001 From: Petr Hosek Date: Fri, 30 Oct 2020 16:16:09 -0700 Subject: [PATCH 4/4] [NFC][CMake] Move some COMPILER_RT variables setup Part of D88922 --- compiler-rt/CMakeLists.txt | 34 +++++++++++++++++++ compiler-rt/cmake/Modules/AddCompilerRT.cmake | 34 ------------------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/compiler-rt/CMakeLists.txt b/compiler-rt/CMakeLists.txt index 82ed440bc013ca..6209320d36b85c 100644 --- a/compiler-rt/CMakeLists.txt +++ b/compiler-rt/CMakeLists.txt @@ -471,6 +471,40 @@ elseif (SANITIZER_TEST_CXX_LIBNAME STREQUAL "libstdc++") append_list_if(COMPILER_RT_HAS_LIBSTDCXX stdc++ SANITIZER_TEST_CXX_LIBRARIES) endif() +# when cross compiling, COMPILER_RT_TEST_COMPILER_CFLAGS help +# in compilation and linking of unittests. +string(REPLACE " " ";" COMPILER_RT_UNITTEST_CFLAGS "${COMPILER_RT_TEST_COMPILER_CFLAGS}") +set(COMPILER_RT_UNITTEST_LINK_FLAGS ${COMPILER_RT_UNITTEST_CFLAGS}) + +# Unittests support. +set(COMPILER_RT_GTEST_PATH ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest) +set(COMPILER_RT_GTEST_SOURCE ${COMPILER_RT_GTEST_PATH}/src/gtest-all.cc) +set(COMPILER_RT_GTEST_CFLAGS + -DGTEST_NO_LLVM_SUPPORT=1 + -DGTEST_HAS_RTTI=0 + -I${COMPILER_RT_GTEST_PATH}/include + -I${COMPILER_RT_GTEST_PATH} +) + +# Mocking support. +set(COMPILER_RT_GMOCK_PATH ${LLVM_MAIN_SRC_DIR}/utils/unittest/googlemock) +set(COMPILER_RT_GMOCK_SOURCE ${COMPILER_RT_GMOCK_PATH}/src/gmock-all.cc) +set(COMPILER_RT_GMOCK_CFLAGS + -DGTEST_NO_LLVM_SUPPORT=1 + -DGTEST_HAS_RTTI=0 + -I${COMPILER_RT_GMOCK_PATH}/include + -I${COMPILER_RT_GMOCK_PATH} +) + +append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 COMPILER_RT_UNITTEST_CFLAGS) +append_list_if(COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG -Wno-covered-switch-default COMPILER_RT_UNITTEST_CFLAGS) +append_list_if(COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG -Wno-suggest-override COMPILER_RT_UNITTEST_CFLAGS) + +if(MSVC) + # gtest use a lot of stuff marked as deprecated on Windows. + list(APPEND COMPILER_RT_GTEST_CFLAGS -Wno-deprecated-declarations) +endif() + # Warnings to turn off for all libraries, not just sanitizers. append_string_if(COMPILER_RT_HAS_WUNUSED_PARAMETER_FLAG -Wno-unused-parameter CMAKE_C_FLAGS CMAKE_CXX_FLAGS) diff --git a/compiler-rt/cmake/Modules/AddCompilerRT.cmake b/compiler-rt/cmake/Modules/AddCompilerRT.cmake index 90a946a0df7da6..bd1499b4b4d838 100644 --- a/compiler-rt/cmake/Modules/AddCompilerRT.cmake +++ b/compiler-rt/cmake/Modules/AddCompilerRT.cmake @@ -380,40 +380,6 @@ function(add_compiler_rt_runtime name type) endif() endfunction() -# when cross compiling, COMPILER_RT_TEST_COMPILER_CFLAGS help -# in compilation and linking of unittests. -string(REPLACE " " ";" COMPILER_RT_UNITTEST_CFLAGS "${COMPILER_RT_TEST_COMPILER_CFLAGS}") -set(COMPILER_RT_UNITTEST_LINK_FLAGS ${COMPILER_RT_UNITTEST_CFLAGS}) - -# Unittests support. -set(COMPILER_RT_GTEST_PATH ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest) -set(COMPILER_RT_GTEST_SOURCE ${COMPILER_RT_GTEST_PATH}/src/gtest-all.cc) -set(COMPILER_RT_GTEST_CFLAGS - -DGTEST_NO_LLVM_SUPPORT=1 - -DGTEST_HAS_RTTI=0 - -I${COMPILER_RT_GTEST_PATH}/include - -I${COMPILER_RT_GTEST_PATH} -) - -# Mocking support. -set(COMPILER_RT_GMOCK_PATH ${LLVM_MAIN_SRC_DIR}/utils/unittest/googlemock) -set(COMPILER_RT_GMOCK_SOURCE ${COMPILER_RT_GMOCK_PATH}/src/gmock-all.cc) -set(COMPILER_RT_GMOCK_CFLAGS - -DGTEST_NO_LLVM_SUPPORT=1 - -DGTEST_HAS_RTTI=0 - -I${COMPILER_RT_GMOCK_PATH}/include - -I${COMPILER_RT_GMOCK_PATH} -) - -append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 COMPILER_RT_UNITTEST_CFLAGS) -append_list_if(COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG -Wno-covered-switch-default COMPILER_RT_UNITTEST_CFLAGS) -append_list_if(COMPILER_RT_HAS_WSUGGEST_OVERRIDE_FLAG -Wno-suggest-override COMPILER_RT_UNITTEST_CFLAGS) - -if(MSVC) - # gtest use a lot of stuff marked as deprecated on Windows. - list(APPEND COMPILER_RT_GTEST_CFLAGS -Wno-deprecated-declarations) -endif() - # Compile and register compiler-rt tests. # generate_compiler_rt_tests( #