diff options
author | Vedant Kumar <vsk@apple.com> | 2018-08-28 18:01:42 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2018-08-28 18:01:42 +0000 |
commit | 76b0fc13b49bfc60789573467260e0d126c3049d (patch) | |
tree | 7911152b5d6fd1c0dc0fc880131c4d73bcccd9ad /lib/Driver/ToolChains/Darwin.cpp | |
parent | 52da60728b90db0f39dc0dc21f5c7460ad2ec616 (diff) |
[ubsan] Enable -fsanitize=vptr on Apple devices and simulators
It seems like an oversight that this check was not always enabled for
on-device or device simulator targets.
Differential Revision: https://reviews.llvm.org/D51239
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@340849 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains/Darwin.cpp')
-rw-r--r-- | lib/Driver/ToolChains/Darwin.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Driver/ToolChains/Darwin.cpp b/lib/Driver/ToolChains/Darwin.cpp index 1fded3cd1b..9d7f7848a5 100644 --- a/lib/Driver/ToolChains/Darwin.cpp +++ b/lib/Driver/ToolChains/Darwin.cpp @@ -2258,9 +2258,15 @@ SanitizerMask Darwin::getSupportedSanitizers() const { Res |= SanitizerKind::Fuzzer; Res |= SanitizerKind::FuzzerNoLink; Res |= SanitizerKind::Function; + + // Prior to 10.9, macOS shipped a version of the C++ standard library without + // C++11 support. The same is true of iOS prior to version 5. These OS'es are + // incompatible with -fsanitize=vptr. + if (!(isTargetMacOS() && isMacosxVersionLT(10, 9)) + && !(isTargetIPhoneOS() && isIPhoneOSVersionLT(5, 0))) + Res |= SanitizerKind::Vptr; + if (isTargetMacOS()) { - if (!isMacosxVersionLT(10, 9)) - Res |= SanitizerKind::Vptr; if (IsX86_64) Res |= SanitizerKind::Thread; } else if (isTargetIOSSimulator() || isTargetTvOSSimulator()) { |