aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaObjCProperty.cpp4
-rw-r--r--test/SemaObjC/property-in-class-extension-1.m12
2 files changed, 7 insertions, 9 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index 131c48f012..0f6ae4c7c7 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -2159,7 +2159,9 @@ void Sema::CheckObjCPropertyAttributes(Decl *PDecl,
// issue any warning.
if (isAnyClassTy && getLangOpts().getGC() == LangOptions::NonGC)
;
- else {
+ else if (propertyInPrimaryClass) {
+ // Don't issue warning on property with no life time in class
+ // extension as it is inherited from property in primary class.
// Skip this warning in gc-only mode.
if (getLangOpts().getGC() != LangOptions::GCOnly)
Diag(Loc, diag::warn_objc_property_no_assignment_attribute);
diff --git a/test/SemaObjC/property-in-class-extension-1.m b/test/SemaObjC/property-in-class-extension-1.m
index 18eae24cc1..ab461ef6c1 100644
--- a/test/SemaObjC/property-in-class-extension-1.m
+++ b/test/SemaObjC/property-in-class-extension-1.m
@@ -35,17 +35,13 @@
@property (nonatomic, copy) NSString* addingMemoryModel;
@property (nonatomic, copy) NSString* matchingMemoryModel;
-@property () NSString* addingNoNewMemoryModel; // expected-warning {{no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed}} \
- // expected-warning {{default property attribute 'assign' not appropriate for non-GC object}}
-@property () NSString* none; // expected-warning {{no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed}} \
- // expected-warning {{default property attribute 'assign' not appropriate for non-GC object}}
+@property () NSString* addingNoNewMemoryModel;
+@property () NSString* none;
@property (readwrite, retain) NSString* none1;
@property (retain) NSString* changeMemoryModel; // expected-warning {{property attribute in class extension does not match the primary class}}
-@property () __weak id weak_prop; // expected-warning {{no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed}} \
- // expected-warning {{default property attribute 'assign' not appropriate for non-GC object}}
-@property (readwrite) __weak id weak_prop1; // expected-warning {{no 'assign', 'retain', or 'copy' attribute is specified - 'assign' is assumed}}\
- // expected-warning {{default property attribute 'assign' not appropriate for non-GC object}}
+@property () __weak id weak_prop;
+@property (readwrite) __weak id weak_prop1;
@property (assign, readwrite) NSString* assignProperty;
@property (assign) NSString* readonlyProp;