[cfe-commits] r164053 - in /cfe/trunk: lib/Sema/SemaObjCProperty.cpp test/SemaObjC/property-in-class-extension-1.m test/SemaObjCXX/property-synthesis-error.mm

Fariborz Jahanian fjahanian at apple.com
Mon Sep 17 13:57:19 PDT 2012


Author: fjahanian
Date: Mon Sep 17 15:57:19 2012
New Revision: 164053

URL: http://llvm.org/viewvc/llvm-project?rev=164053&view=rev
Log:
objective-C: peroform property attribute consistency
checking on property declared in class extension.
// rdar://12214070

Modified:
    cfe/trunk/lib/Sema/SemaObjCProperty.cpp
    cfe/trunk/test/SemaObjC/property-in-class-extension-1.m
    cfe/trunk/test/SemaObjCXX/property-synthesis-error.mm

Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=164053&r1=164052&r2=164053&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Mon Sep 17 15:57:19 2012
@@ -349,6 +349,7 @@
       Diag(AtLoc, 
           diag::err_type_mismatch_continuation_class) << PDecl->getType();
       Diag(PIDecl->getLocation(), diag::note_property_declare);
+      return 0;
     }
   }
     
@@ -409,6 +410,7 @@
     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 @@
   PDecl->setSetterMethodDecl(PIDecl->getSetterMethodDecl());
   if (ASTMutationListener *L = Context.getASTMutationListener())
     L->AddedObjCPropertyInClassExtension(PDecl, PIDecl, CDecl);
-  return 0;
+  return PDecl;
 }
 
 ObjCPropertyDecl *Sema::CreatePropertyDecl(Scope *S,

Modified: cfe/trunk/test/SemaObjC/property-in-class-extension-1.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/property-in-class-extension-1.m?rev=164053&r1=164052&r2=164053&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/property-in-class-extension-1.m (original)
+++ cfe/trunk/test/SemaObjC/property-in-class-extension-1.m Mon Sep 17 15:57:19 2012
@@ -35,15 +35,29 @@
 
 @property (nonatomic, copy) NSString* addingMemoryModel;
 @property (nonatomic, copy) NSString* matchingMemoryModel;
- at property () NSString* addingNoNewMemoryModel;
- at property () NSString* none;
- at property (readwrite) NSString* none1;
+ at 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}}
+ at 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}}
+ at property (readwrite, retain) NSString* none1;
 
 @property (retain) NSString* changeMemoryModel; // expected-warning {{property attribute in class extension does not match the primary class}}
- at property () __weak id weak_prop;
- at property (readwrite) __weak id weak_prop1;
+ at 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}}
+ at 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}}
 
- at property () NSString* assignProperty;
+ at property (assign, readwrite) NSString* assignProperty;
 @property (assign) NSString* readonlyProp;
 @end
 
+// rdar://12214070
+ at interface radar12214070
+ at property (nonatomic, atomic, readonly) float propertyName; // expected-error {{property attributes 'atomic' and 'nonatomic' are mutually exclusive}}
+ at end
+
+ at interface radar12214070 ()
+ at 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}}
+ at end
+

Modified: cfe/trunk/test/SemaObjCXX/property-synthesis-error.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjCXX/property-synthesis-error.mm?rev=164053&r1=164052&r2=164053&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjCXX/property-synthesis-error.mm (original)
+++ cfe/trunk/test/SemaObjCXX/property-synthesis-error.mm Mon Sep 17 15:57:19 2012
@@ -16,7 +16,7 @@
 
 @interface MyClass ()
 
- at property (readwrite) NSMutableArray * array;
+ at property (readwrite, retain) NSMutableArray * array;
 
 @end
 





More information about the cfe-commits mailing list