[PATCH] D51239: [ubsan] Enable -fsanitize=vptr on Apple devices and simulators
Vedant Kumar via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 27 10:01:45 PDT 2018
vsk added inline comments.
================
Comment at: clang/lib/Driver/ToolChains/Darwin.cpp:2254
Res |= SanitizerKind::Function;
+ if (!isTargetMacOS() || !isMacosxVersionLT(10, 9))
+ Res |= SanitizerKind::Vptr;
----------------
delcypher wrote:
> Could we apply De'Morgan's rule here and write that as
>
> ```
> if (!(isTargetMacOS() && isMacosxVersionLT(10, 9)) {
> Res |= SanitizerKind::Vptr
> }
> ```
>
> I find that a bit easier to read.
>
> Is there any particular reason why vptr isn't supported for old macOS versions? There's no mention of ios here which suggests that it's supported on all ios versions which seems like an odd disparity. Perhaps a comment briefly explaining why this is the case would be helpful?
Sure.
MacOS versions older than 10.8 shipped a version of the C++ standard library which is incompatible with the vptr check's implementation (see: https://trac.macports.org/wiki/LibcxxOnOlderSystems). I'll add a comment to that effect.
As far as I know, all currently-supported versions of iOS ship libc++. I'll ask around and double-check, just to be safe.
https://reviews.llvm.org/D51239
More information about the cfe-commits
mailing list