[PATCH] D22697: [ObjC Availability] Consider lexical context of use of declaration when emitting availability diagnostics
Erik Pilkington via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 22 13:55:59 PDT 2016
erik.pilkington created this revision.
erik.pilkington added a reviewer: manmanren.
erik.pilkington added a subscriber: cfe-commits.
-Wpartial-availability currently fires on the following:
```
void f1() __attribute__((availability(macos, introduced=10.10)));
void f2() __attribute__((availability(macos, introduced=10.10))) {
f1(); // warning: f1 is partially available: introduced in 10.10.
}
```
This is bad: f2 is also only available on macOS 10.10, so we know that the call to f1 is safe. This patch fixes this by considering the availability attributes of the lexical context of a use of a declaration when checking it for availability violations.
Thanks!
https://reviews.llvm.org/D22697
Files:
include/clang/AST/DeclBase.h
include/clang/Sema/Sema.h
lib/AST/DeclBase.cpp
lib/Sema/SemaDeclAttr.cpp
lib/Sema/SemaExpr.cpp
test/SemaObjC/attr-availability.m
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22697.65139.patch
Type: text/x-patch
Size: 9598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160722/c20c290f/attachment.bin>
More information about the cfe-commits
mailing list