]> granicus.if.org Git - clang/commitdiff
[arcmt] Now that properties are strong by default, avoid adding redundant '(strong)'
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 8 Nov 2011 05:56:11 +0000 (05:56 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Tue, 8 Nov 2011 05:56:11 +0000 (05:56 +0000)
property attribute.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144078 91177308-0d34-0410-b5e6-96231b3b80d8

lib/ARCMigrate/TransProperties.cpp
test/ARCMT/GC.m
test/ARCMT/GC.m.result

index 050512fbbecdb3d3792a59e8f4cd5c16e6334e19..7e890ef608ffc6cdb6cbd6718256c07d126da963 100644 (file)
@@ -287,8 +287,10 @@ private:
   void maybeAddStrongAttr(PropsTy &props, SourceLocation atLoc) const {
     ObjCPropertyDecl::PropertyAttributeKind propAttrs = getPropertyAttrs(props);
 
-    if (!(propAttrs & ObjCPropertyDecl::OBJC_PR_readonly) ||
-        !hasAllIvarsBacked(props)) {
+    if (!(propAttrs & ObjCPropertyDecl::OBJC_PR_readonly))
+      return; // 'strong' by default.
+
+    if (!hasAllIvarsBacked(props)) {
       addAttribute("strong", atLoc);
     }
 
index 28846792ad4379db043a5598c8051f7e8ae224c2..d657387a03ea239cd8beecd1e6d991d7c24303f2 100644 (file)
@@ -57,15 +57,17 @@ __attribute__((objc_arc_weak_reference_unavailable))
 
 @interface I4Impl {
   I4Impl *pds2;
+  I4Impl *pds3;
 }
 @property (assign) I4Impl *__weak pw1, *__weak pw2;
 @property (assign) I4Impl *__strong ps;
 @property (assign) I4Impl * pds;
 @property (assign) I4Impl * pds2;
+@property (readwrite) I4Impl * pds3;
 @end
 
 @implementation I4Impl
-@synthesize pw1, pw2, ps, pds, pds2;
+@synthesize pw1, pw2, ps, pds, pds2, pds3;
 
 -(void)test1:(CFTypeRef *)cft {
   id x = NSMakeCollectable(cft);
index aaa5ee5b5693a3c800fd2327452134fbac193bae..96437b8973bd768e0a32cdec53a99a021cdab6d0 100644 (file)
@@ -52,15 +52,17 @@ __attribute__((objc_arc_weak_reference_unavailable))
 
 @interface I4Impl {
   I4Impl *pds2;
+  I4Impl *pds3;
 }
 @property (weak) I4Impl * pw1, * pw2;
 @property  I4Impl * ps;
 @property  I4Impl * pds;
 @property  I4Impl * pds2;
+@property (readwrite) I4Impl * pds3;
 @end
 
 @implementation I4Impl
-@synthesize pw1, pw2, ps, pds, pds2;
+@synthesize pw1, pw2, ps, pds, pds2, pds3;
 
 -(void)test1:(CFTypeRef *)cft {
   id x = CFBridgingRelease(cft);