]> granicus.if.org Git - clang/commitdiff
Since default writable attribute is 'assign', allow
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 6 Nov 2009 22:59:12 +0000 (22:59 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 6 Nov 2009 22:59:12 +0000 (22:59 +0000)
specification of 'assign' (no warning to be issued),
when a continuation class makes a 'readonly' attribute
'readwrite' but also specifies the 'assign' attribute.
(this matches gcc's behavior and prevents exessive
 warnings)/

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

lib/Sema/SemaDeclObjC.cpp
test/SemaObjC/continuation-class-err.m

index 93f8d0dc37c14da14f1ccb734037e75d4b1dd9b0..455671596f2b844a5ad6ac4547f2859b6b91cfd1 100644 (file)
@@ -1911,8 +1911,7 @@ Sema::DeclPtrTy Sema::ActOnProperty(Scope *S, SourceLocation AtLoc,
           unsigned PIkind = PIDecl->getPropertyAttributes();
           if (isReadWrite && (PIkind & ObjCPropertyDecl::OBJC_PR_readonly)) {
             unsigned assignRetainCopyNonatomic = 
-              (ObjCPropertyDecl::OBJC_PR_assign |
-               ObjCPropertyDecl::OBJC_PR_retain |
+              (ObjCPropertyDecl::OBJC_PR_retain |
                ObjCPropertyDecl::OBJC_PR_copy |
                ObjCPropertyDecl::OBJC_PR_nonatomic);
             if ((Attributes & assignRetainCopyNonatomic) !=
index 262b786b5408216c44b72f4a7c5e9859b86f56b8..4559696b7f2d064c9f27280288483e2bd6d98d28 100644 (file)
@@ -7,11 +7,13 @@
 }
 @property(readonly) id object; // expected-note {{property declared here}}
 @property(readwrite, assign) id object1; // expected-note {{property declared here}}
+@property (readonly) int indentLevel;
 @end
 
 @interface ReadOnly ()
 @property(readwrite, copy) id object;  // expected-warning {{property attribute in continuation class does not match the primary class}}
 @property(readonly) id object1; // expected-error {{property declaration in continuation class of 'ReadOnly' is to change a 'readonly' property to 'readwrite'}}
+@property (readwrite, assign) int indentLevel; // OK. assign the the default in any case.
 @end
 
 @protocol Proto