This patch implements support for diagnostics for @available violations. This is done with a traversal of the AST after semantic analysis of a function where a partially available (based on availability attributes) use of a declaration is found. For example:
if (@available(macos 10.12, *)) fn_10_12(); else fn_10_12(); // clang now emits a warning here
This patch also treats both branches of if (@available(...)) checks as begin protected; being able to goto into them would break this feature. Also, -Wpartial-availability is now an alias of -Wunguarded-availability.
Up next is a patch to implement clang CodeGen support for ObjCAvailabilityCheckExpr, and another to provide fixits to suggest using @available.
This patch is part of a series that implements the feature I proposed here:
http://lists.llvm.org/pipermail/cfe-dev/2016-July/049851.html