r310916 - [Sema] Silence -Wobjc-missing-property-synthesis for unavailable properties
Alex Lorenz via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 15 05:40:01 PDT 2017
Author: arphaman
Date: Tue Aug 15 05:40:01 2017
New Revision: 310916
URL: http://llvm.org/viewvc/llvm-project?rev=310916&view=rev
Log:
[Sema] Silence -Wobjc-missing-property-synthesis for unavailable properties
rdar://30296911
Modified:
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/test/SemaObjC/default-synthesize-1.m
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=310916&r1=310915&r2=310916&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Tue Aug 15 05:40:01 2017
@@ -1895,7 +1895,7 @@ void Sema::DefaultSynthesizeProperties(S
/* 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);
}
Modified: cfe/trunk/test/SemaObjC/default-synthesize-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/default-synthesize-1.m?rev=310916&r1=310915&r2=310916&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/default-synthesize-1.m (original)
+++ cfe/trunk/test/SemaObjC/default-synthesize-1.m Tue Aug 15 05:40:01 2017
@@ -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
@@ -141,3 +141,17 @@
return _description; // expected-error {{use of undeclared identifier '_description'}}
}
@end
+
+ at interface DontWarnOnUnavailable
+
+// No warning expected:
+ at property (nonatomic, readonly) int un1 __attribute__((unavailable));
+ at property (readwrite) int un2 __attribute__((availability(macos, unavailable)));
+
+ at property (readwrite) int un3 __attribute__((availability(ios, unavailable))); // expected-warning {{auto property synthesis is synthesizing property not explicitly synthesized}}
+
+ at end
+
+ at implementation DontWarnOnUnavailable // expected-note {{detected while default synthesizing properties in class implementation}}
+
+ at end
More information about the cfe-commits
mailing list