From 8872ad1bd2c704437c119a57aa7f3cdae795d654 Mon Sep 17 00:00:00 2001 From: Alex Lorenz Date: Tue, 15 Aug 2017 12:40:01 +0000 Subject: [PATCH] [Sema] Silence -Wobjc-missing-property-synthesis for unavailable properties rdar://30296911 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@310916 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaObjCProperty.cpp | 2 +- test/SemaObjC/default-synthesize-1.m | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp index e1e85dfd5e..d0b59eb789 100644 --- a/lib/Sema/SemaObjCProperty.cpp +++ b/lib/Sema/SemaObjCProperty.cpp @@ -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); } diff --git a/test/SemaObjC/default-synthesize-1.m b/test/SemaObjC/default-synthesize-1.m index 731aa863e1..573434b3b3 100644 --- a/test/SemaObjC/default-synthesize-1.m +++ b/test/SemaObjC/default-synthesize-1.m @@ -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 + +@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 -- 2.40.0