diff options
author | Nico Weber <nicolasweber@gmx.de> | 2015-03-19 19:18:22 +0000 |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2015-03-19 19:18:22 +0000 |
commit | 86877a86797ac4e347e43ae2eab6cad0944e59a4 (patch) | |
tree | 7b7af45a2545cdd70a83bd11dd928108f1b93248 /lib/Sema/DelayedDiagnostic.cpp | |
parent | ed642255720097e356e4e4d4e8fae3e1d6aa1bf4 (diff) | |
download | clang-86877a86797ac4e347e43ae2eab6cad0944e59a4.tar.gz |
Add -Wpartial-availability.
This warns when using decls that are not available on all deployment targets.
For example, a call to
- (void)ppartialMethod __attribute__((availability(macosx,introduced=10.8)));
will warn if -mmacosx-version-min is set to less than 10.8.
To silence the warning, one has to explicitly redeclare the method like so:
@interface Whatever(MountainLionAPI)
- (void)ppartialMethod;
@end
This way, one cannot accidentally call a function that isn't available
everywhere. Having to add the redeclaration will hopefully remind the user
to add an explicit respondsToSelector: call as well.
Some projects build against old SDKs to get this effect, but building against
old SDKs suppresses some bug fixes -- see http://crbug.com/463171 for examples.
The hope is that SDK headers are annotated well enough with availability
attributes that new SDK + this warning offers the same amount of protection
as using an old SDK.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232750 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/DelayedDiagnostic.cpp')
-rw-r--r-- | lib/Sema/DelayedDiagnostic.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Sema/DelayedDiagnostic.cpp b/lib/Sema/DelayedDiagnostic.cpp index 664a6b1a89..ceea04f276 100644 --- a/lib/Sema/DelayedDiagnostic.cpp +++ b/lib/Sema/DelayedDiagnostic.cpp @@ -35,6 +35,8 @@ DelayedDiagnostic::makeAvailability(Sema::AvailabilityDiagnostic AD, case Sema::AD_Unavailable: DD.Kind = Unavailable; break; + case Sema::AD_Partial: + llvm_unreachable("AD_Partial diags should not be delayed"); } DD.Triggered = false; DD.Loc = Loc; |