]> granicus.if.org Git - clang/commitdiff
[Sema] Silence -Wobjc-missing-property-synthesis for unavailable properties
authorAlex Lorenz <arphaman@gmail.com>
Tue, 15 Aug 2017 12:40:01 +0000 (12:40 +0000)
committerAlex Lorenz <arphaman@gmail.com>
Tue, 15 Aug 2017 12:40:01 +0000 (12:40 +0000)
rdar://30296911

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

lib/Sema/SemaObjCProperty.cpp
test/SemaObjC/default-synthesize-1.m

index e1e85dfd5e55eb298c6ab2f168e519cce2873bb9..d0b59eb7895141ad2983b55f2551c238d139ce54 100644 (file)
@@ -1895,7 +1895,7 @@ void Sema::DefaultSynthesizeProperties(Scope *S, ObjCImplDecl *IMPDecl,
                             /* property = */ Prop->getIdentifier(),
                             /* ivar = */ Prop->getDefaultSynthIvarName(Context),
                             Prop->getLocation(), Prop->getQueryKind()));
-    if (PIDecl) {
+    if (PIDecl && !Prop->isUnavailable()) {
       Diag(Prop->getLocation(), diag::warn_missing_explicit_synthesis);
       Diag(IMPDecl->getLocation(), diag::note_while_in_implementation);
     }
index 731aa863e103a9b0a7e83734f076f19b05b35c34..573434b3b324d9b9c9f6f038ae440d77482e3f3d 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -Wobjc-missing-property-synthesis -verify -Wno-objc-root-class %s
+// RUN: %clang_cc1 -fsyntax-only -Wobjc-missing-property-synthesis -verify -Wno-objc-root-class -triple=x86_64-apple-macos10.10 %s
 // rdar://11295716
 
 @interface NSObject 
     return _description; // expected-error {{use of undeclared identifier '_description'}}
 }
 @end
+
+@interface DontWarnOnUnavailable
+
+// No warning expected:
+@property (nonatomic, readonly) int un1 __attribute__((unavailable));
+@property (readwrite) int un2 __attribute__((availability(macos, unavailable)));
+
+@property (readwrite) int un3 __attribute__((availability(ios, unavailable))); // expected-warning {{auto property synthesis is synthesizing property not explicitly synthesized}}
+
+@end
+
+@implementation DontWarnOnUnavailable // expected-note {{detected while default synthesizing properties in class implementation}}
+
+@end