]> granicus.if.org Git - clang/commitdiff
No need to warn if 'unavailable' method/property
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 24 Jun 2011 20:31:37 +0000 (20:31 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 24 Jun 2011 20:31:37 +0000 (20:31 +0000)
is not implemented. // rdar://9651605

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133819 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaDeclObjC.cpp
lib/Sema/SemaObjCProperty.cpp
test/SemaObjC/no-warning-unavail-unimp.m [new file with mode: 0644]

index 3bbe421cd144b2cfcc9a8cbfef55ad56faf58cc2..3052b826b65330fb65db7850cf01adce6bd09e37 100644 (file)
@@ -1076,6 +1076,9 @@ 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>())
+    return;
   if (!IncompleteImpl) {
     Diag(ImpLoc, diag::warn_incomplete_impl);
     IncompleteImpl = true;
index 75ff0d119a49046ec13c22fdb5c7276fbf0bed7b..22f9b3e092be8bb4d73022b09541dcc501d994f3 100644 (file)
@@ -1273,7 +1273,7 @@ void Sema::DiagnoseUnimplementedProperties(Scope *S, ObjCImplDecl* IMPDecl,
     // 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(),
diff --git a/test/SemaObjC/no-warning-unavail-unimp.m b/test/SemaObjC/no-warning-unavail-unimp.m
new file mode 100644 (file)
index 0000000..9409322
--- /dev/null
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1  -fsyntax-only -verify %s
+// rdar://9651605
+
+@interface Foo
+@property (getter=getVal) int val __attribute__((unavailable));
+- Method __attribute__((unavailable));
++ CMethod __attribute__((unavailable));
+@end
+
+@implementation Foo
+@end
+