[PATCH] D27827: [ObjC] CodeGen support for @available on macOS
Erik Pilkington via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Feb 22 12:36:16 PST 2017
erik.pilkington added inline comments.
================
Comment at: test/CodeGenObjC/availability-check.m:16
+ // CHECK: br i1 true
+ if (__builtin_available(ios 10, *))
+ ;
----------------
arphaman wrote:
> Shouldn't this be `br i1 false`, since we are building for macOS so we have no iOS support at all?
No, this is intentional. If the platform we're targeting isn't mentioned, we take the `*` case, and emit -Wunguarded-availability diagnostics in the body of the `if` using the minimum deployment target. The idea is that if a new OS is released it will be forked from an existing one and use existing APIs, and it would be unfortunate for everyone to have to add the new platform to their existing `@available` calls. This is probably the most counterintuative part of this feature, and is the reason for the somewhat bizarre `*` syntax, to call out this control flow.
https://reviews.llvm.org/D27827
More information about the cfe-commits
mailing list