aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaObjCProperty.cpp4
-rw-r--r--test/SemaObjC/property-in-class-extension-1.m26
-rw-r--r--test/SemaObjCXX/property-synthesis-error.mm2
3 files changed, 24 insertions, 8 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index 4d2fb777e2..131c48f012 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -349,6 +349,7 @@ Sema::HandlePropertyInClassExtension(Scope *S,
Diag(AtLoc,
diag::err_type_mismatch_continuation_class) << PDecl->getType();
Diag(PIDecl->getLocation(), diag::note_property_declare);
+ return 0;
}
}
@@ -409,6 +410,7 @@ Sema::HandlePropertyInClassExtension(Scope *S,
Diag(AtLoc, diag)
<< CCPrimary->getDeclName();
Diag(PIDecl->getLocation(), diag::note_property_declare);
+ return 0;
}
*isOverridingProperty = true;
// Make sure setter decl is synthesized, and added to primary class's list.
@@ -417,7 +419,7 @@ Sema::HandlePropertyInClassExtension(Scope *S,
PDecl->setSetterMethodDecl(PIDecl->getSetterMethodDecl());
if (ASTMutationListener *L = Context.getASTMutationListener())
L->AddedObjCPropertyInClassExtension(PDecl, PIDecl, CDecl);
- return 0;
+ return PDecl;
}
ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S,
diff --git a/test/SemaObjC/property-in-class-extension-1.m b/test/SemaObjC/property-in-class-extension-1.m
index dfa5e718a4..18eae24cc1 100644
--- a/test/SemaObjC/property-in-class-extension-1.m
+++ b/test/SemaObjC/property-in-class-extension-1.m
@@ -35,15 +35,29 @@
@property (nonatomic, copy) NSString* addingMemoryModel;
@property (nonatomic, copy) NSString* matchingMemoryModel;
-@property () NSString* addingNoNewMemoryModel;
-@property () NSString* none;
-@property (readwrite) NSString* none1;
+@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 (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;
-@property (readwrite) __weak id weak_prop1;
+@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 () NSString* assignProperty;
+@property (assign, readwrite) NSString* assignProperty;
@property (assign) NSString* readonlyProp;
@end
+// rdar://12214070
+@interface radar12214070
+@property (nonatomic, atomic, readonly) float propertyName; // expected-error {{property attributes 'atomic' and 'nonatomic' are mutually exclusive}}
+@end
+
+@interface radar12214070 ()
+@property (atomic, nonatomic, readonly, readwrite) float propertyName; // expected-error {{property attributes 'readonly' and 'readwrite' are mutually exclusive}} \
+ // expected-error {{property attributes 'atomic' and 'nonatomic' are mutually exclusive}}
+@end
+
diff --git a/test/SemaObjCXX/property-synthesis-error.mm b/test/SemaObjCXX/property-synthesis-error.mm
index 4f64a3a338..1d93523b4c 100644
--- a/test/SemaObjCXX/property-synthesis-error.mm
+++ b/test/SemaObjCXX/property-synthesis-error.mm
@@ -16,7 +16,7 @@
@interface MyClass ()
-@property (readwrite) NSMutableArray * array;
+@property (readwrite, retain) NSMutableArray * array;
@end