[cfe-commits] r169903 - in /cfe/trunk: lib/Sema/SemaDeclObjC.cpp test/SemaObjC/incomplete-implementation.m

Douglas Gregor dgregor at apple.com
Tue Dec 11 10:53:07 PST 2012


Author: dgregor
Date: Tue Dec 11 12:53:07 2012
New Revision: 169903

URL: http://llvm.org/viewvc/llvm-project?rev=169903&view=rev
Log:
Don't complain about incomplete implementations for methods that are
unavailable due to availability attributes. <rdar://problem/12798237>

Modified:
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp
    cfe/trunk/test/SemaObjC/incomplete-implementation.m

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=169903&r1=169902&r2=169903&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Tue Dec 11 12:53:07 2012
@@ -1168,8 +1168,17 @@
 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;

Modified: cfe/trunk/test/SemaObjC/incomplete-implementation.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/incomplete-implementation.m?rev=169903&r1=169902&r2=169903&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/incomplete-implementation.m (original)
+++ cfe/trunk/test/SemaObjC/incomplete-implementation.m Tue Dec 11 12:53:07 2012
@@ -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}}





More information about the cfe-commits mailing list