[cfe-commits] r133819 - in /cfe/trunk: lib/Sema/SemaDeclObjC.cpp lib/Sema/SemaObjCProperty.cpp test/SemaObjC/no-warning-unavail-unimp.m

Fariborz Jahanian fjahanian at apple.com
Fri Jun 24 13:31:38 PDT 2011


Author: fjahanian
Date: Fri Jun 24 15:31:37 2011
New Revision: 133819

URL: http://llvm.org/viewvc/llvm-project?rev=133819&view=rev
Log:
No need to warn if 'unavailable' method/property 
is not implemented. // rdar://9651605

Added:
    cfe/trunk/test/SemaObjC/no-warning-unavail-unimp.m
Modified:
    cfe/trunk/lib/Sema/SemaDeclObjC.cpp
    cfe/trunk/lib/Sema/SemaObjCProperty.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=133819&r1=133818&r2=133819&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Fri Jun 24 15:31:37 2011
@@ -1076,6 +1076,9 @@
 
 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>())
+    return;
   if (!IncompleteImpl) {
     Diag(ImpLoc, diag::warn_incomplete_impl);
     IncompleteImpl = true;

Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=133819&r1=133818&r2=133819&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Fri Jun 24 15:31:37 2011
@@ -1273,7 +1273,7 @@
     // Is there a matching propery synthesize/dynamic?
     if (Prop->isInvalidDecl() ||
         Prop->getPropertyImplementation() == ObjCPropertyDecl::Optional ||
-        PropImplMap.count(Prop))
+        PropImplMap.count(Prop) || Prop->hasAttr<UnavailableAttr>())
       continue;
     if (!InsMap.count(Prop->getGetterName())) {
       Diag(Prop->getLocation(),

Added: cfe/trunk/test/SemaObjC/no-warning-unavail-unimp.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/no-warning-unavail-unimp.m?rev=133819&view=auto
==============================================================================
--- cfe/trunk/test/SemaObjC/no-warning-unavail-unimp.m (added)
+++ cfe/trunk/test/SemaObjC/no-warning-unavail-unimp.m Fri Jun 24 15:31:37 2011
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1  -fsyntax-only -verify %s
+// rdar://9651605
+
+ at interface Foo
+ at property (getter=getVal) int val __attribute__((unavailable));
+- Method __attribute__((unavailable));
++ CMethod __attribute__((unavailable));
+ at end
+
+ at implementation Foo
+ at end
+





More information about the cfe-commits mailing list