[PATCH] D23003: [ObjC Availability] Warn upon unguarded use of partially available declaration
Devin Coughlin via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 1 13:59:42 PDT 2016
dcoughlin added a comment.
It's really great to see this!
Comment at: lib/Sema/SemaExpr.cpp:15200
@@ -15182,2 +15199,3 @@
- Diag(AtLoc, diag::warn_available_using_star_case) << RParen << Platform;
+ Diag(AtLoc, diag::warn_available_using_star_case)
+ << SourceRange(AtLoc, RParen) << Platform;
In Swift we don't warn for this scenario and don't require the programmer to explicitly account for the current platform. The rationale behind '*' was to make platform bringup easier. Because new platforms are typically forked from existing platforms, treating '*' as the minimum deployment target on the current platform would typically do the "right thing" on new platforms. In cases where it doesn't, the user would still get a diagnostic if she tried to use a potentially unavailable API.
If I understand it correctly, with the behavior here anyone porting code to a new platform will get a warning for each `@available`. Is this what you want?
More information about the cfe-commits