[PATCH] D51239: [ubsan] Enable -fsanitize=vptr on Apple devices and simulators

Dan Liew via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Aug 26 15:57:28 PDT 2018


delcypher requested changes to this revision.
delcypher added inline comments.
This revision now requires changes to proceed.


================
Comment at: clang/lib/Driver/ToolChains/Darwin.cpp:2254
   Res |= SanitizerKind::Function;
+  if (!isTargetMacOS() || !isMacosxVersionLT(10, 9))
+    Res |= SanitizerKind::Vptr;
----------------
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?


https://reviews.llvm.org/D51239





More information about the cfe-commits mailing list