You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Extend availability attribute to support feature-based availability
This commit extends the `__availability` attribute to accept a feature
name and a boolean-like integer argument (0 or 1) to indicate
availability based on feature presence or absence.
`__builtin_available` and `@available` take a feature name as their
arguments. References to annotated declarations in unguarded contexts
are rejected.
For example:
```
__attribute__((availability(domain:feature1, 0)))
void available_func(void);
__attribute__((availability(domain:feature1, 1)))
void unavailable_func(void);
if (__builtin_available(feature1)) {
available_func();
unavailable_func(); // error
} else {
available_func(); // error
unavailable_func();
}
```
rdar://137999979
0 commit comments