From 86877a86797ac4e347e43ae2eab6cad0944e59a4 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Thu, 19 Mar 2015 19:18:22 +0000 Subject: 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 --- lib/Sema/DelayedDiagnostic.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/Sema/DelayedDiagnostic.cpp') 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; -- cgit v1.2.1