Don't complain about incomplete implementations for methods that are
authorDouglas Gregor <dgregor@apple.com>
Tue, 11 Dec 2012 18:53:07 +0000 (18:53 +0000)
committerDouglas Gregor <dgregor@apple.com>
Tue, 11 Dec 2012 18:53:07 +0000 (18:53 +0000)
unavailable due to availability attributes. <rdar://problem/12798237>

llvm-svn: 169903

clang/lib/Sema/SemaDeclObjC.cpp
clang/test/SemaObjC/incomplete-implementation.m

index 14546de..64b000e 100644 (file)
@@ -1168,8 +1168,17 @@ void Sema::CheckImplementationIvars(ObjCImplementationDecl *ImpDecl,
 void Sema::WarnUndefinedMethod(SourceLocation ImpLoc, ObjCMethodDecl *method,
                                bool &IncompleteImpl, unsigned DiagID) {
   // No point warning no definition of method which is 'unavailable'.
-  if (method->hasAttr<UnavailableAttr>())
+  switch (method->getAvailability()) {
+  case AR_Available:
+  case AR_Deprecated:
+    break;
+
+      // Don't warn about unavailable or not-yet-introduced methods.
+  case AR_NotYetIntroduced:
+  case AR_Unavailable:
     return;
+  }
+  
   if (!IncompleteImpl) {
     Diag(ImpLoc, diag::warn_incomplete_impl);
     IncompleteImpl = true;
index 54f66ef..69e355c 100644 (file)
@@ -1,8 +1,10 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fsyntax-only -verify -Wno-objc-root-class %s
 
 @interface I
 - Meth; // expected-note{{method definition for 'Meth' not found}} \
         // expected-note{{method 'Meth' declared here}}
+- unavailableMeth __attribute__((availability(macosx,unavailable)));
+- unavailableMeth2 __attribute__((unavailable));
 @end
 
 @implementation  I  // expected-warning{{incomplete implementation}}