forked from OSchip/llvm-project
[asan] Pass -fms-compatibility-version=19 with VS 2015
This resolves errors about char16_t and char32_t when compiling 2015 STL headers with clang. llvm-svn: 263973
This commit is contained in:
parent
6896b35585
commit
a4192a743a
|
|
@ -60,6 +60,11 @@ endif()
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
# Disable exceptions on Windows until they work reliably.
|
# Disable exceptions on Windows until they work reliably.
|
||||||
list(APPEND ASAN_UNITTEST_COMMON_CFLAGS -fno-exceptions -DGTEST_HAS_SEH=0)
|
list(APPEND ASAN_UNITTEST_COMMON_CFLAGS -fno-exceptions -DGTEST_HAS_SEH=0)
|
||||||
|
# Extract the major version from CMake's MSVC_VERSION variable and pass it to
|
||||||
|
# -fms-compatibility-version. The major version controls the most important
|
||||||
|
# parts of clang's compatibility.
|
||||||
|
string(SUBSTRING "${MSVC_VERSION}" 0 2 MSVC_MAJOR_VERSION)
|
||||||
|
list(APPEND ASAN_UNITTEST_COMMON_CFLAGS "-fms-compatibility-version=${MSVC_MAJOR_VERSION}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(ASAN_BLACKLIST_FILE "${CMAKE_CURRENT_SOURCE_DIR}/asan_test.ignore")
|
set(ASAN_BLACKLIST_FILE "${CMAKE_CURRENT_SOURCE_DIR}/asan_test.ignore")
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,13 @@ if(APPLE)
|
||||||
darwin_filter_host_archs(ASAN_SUPPORTED_ARCH ASAN_TEST_ARCH)
|
darwin_filter_host_archs(ASAN_SUPPORTED_ARCH ASAN_TEST_ARCH)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Extract the major version from CMake's MSVC_VERSION variable and pass it into
|
||||||
|
# the lit configuration.
|
||||||
|
set(MSVC_MAJOR_VERSION "")
|
||||||
|
if (MSVC)
|
||||||
|
string(SUBSTRING "${MSVC_VERSION}" 0 2 MSVC_MAJOR_VERSION)
|
||||||
|
endif()
|
||||||
|
|
||||||
foreach(arch ${ASAN_TEST_ARCH})
|
foreach(arch ${ASAN_TEST_ARCH})
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
set(ASAN_TEST_TARGET_ARCH ${arch}-android)
|
set(ASAN_TEST_TARGET_ARCH ${arch}-android)
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,13 @@ else:
|
||||||
if config.android:
|
if config.android:
|
||||||
extra_linkflags += ["-lm"]
|
extra_linkflags += ["-lm"]
|
||||||
|
|
||||||
|
msvc_major_version = get_required_attr(config, "msvc_major_version")
|
||||||
|
|
||||||
# Setup default compiler flags used with -fsanitize=address option.
|
# Setup default compiler flags used with -fsanitize=address option.
|
||||||
# FIXME: Review the set of required flags and check if it can be reduced.
|
# FIXME: Review the set of required flags and check if it can be reduced.
|
||||||
target_cflags = [get_required_attr(config, "target_cflags")] + extra_linkflags
|
target_cflags = [get_required_attr(config, "target_cflags")] + extra_linkflags
|
||||||
|
if msvc_major_version:
|
||||||
|
target_cflags.append("-fms-compatibility-version=" + msvc_major_version)
|
||||||
target_cxxflags = config.cxx_mode_flags + target_cflags
|
target_cxxflags = config.cxx_mode_flags + target_cflags
|
||||||
clang_asan_static_cflags = (["-fsanitize=address",
|
clang_asan_static_cflags = (["-fsanitize=address",
|
||||||
"-mno-omit-leaf-frame-pointer",
|
"-mno-omit-leaf-frame-pointer",
|
||||||
|
|
@ -110,6 +114,7 @@ if platform.system() == 'Windows':
|
||||||
clang_cl_asan_cxxflags = ["-fsanitize=address",
|
clang_cl_asan_cxxflags = ["-fsanitize=address",
|
||||||
"-Wno-deprecated-declarations",
|
"-Wno-deprecated-declarations",
|
||||||
"-WX",
|
"-WX",
|
||||||
|
"-fms-compatibility-version=" + msvc_major_version,
|
||||||
"-D_HAS_EXCEPTIONS=0",
|
"-D_HAS_EXCEPTIONS=0",
|
||||||
"-Zi"] + target_cflags
|
"-Zi"] + target_cflags
|
||||||
if config.asan_dynamic:
|
if config.asan_dynamic:
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
config.name_suffix = "@ASAN_TEST_CONFIG_SUFFIX@"
|
config.name_suffix = "@ASAN_TEST_CONFIG_SUFFIX@"
|
||||||
config.asan_lit_source_dir = "@ASAN_LIT_SOURCE_DIR@"
|
config.asan_lit_source_dir = "@ASAN_LIT_SOURCE_DIR@"
|
||||||
config.target_cflags = "@ASAN_TEST_TARGET_CFLAGS@"
|
config.target_cflags = "@ASAN_TEST_TARGET_CFLAGS@"
|
||||||
|
config.msvc_major_version = "@MSVC_MAJOR_VERSION@"
|
||||||
config.clang = "@ASAN_TEST_TARGET_CC@"
|
config.clang = "@ASAN_TEST_TARGET_CC@"
|
||||||
config.bits = "@ASAN_TEST_BITS@"
|
config.bits = "@ASAN_TEST_BITS@"
|
||||||
config.android = "@ANDROID@"
|
config.android = "@ANDROID@"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue