aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDeclObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2008-12-06 01:12:43 +0000
committerFariborz Jahanian <fjahanian@apple.com>2008-12-06 01:12:43 +0000
commit567c8df3646208e0a5816c57191ca36930f50ed3 (patch)
tree22d4e0550d04dde7f5f35fb1b24912f0d286e32a /lib/Sema/SemaDeclObjC.cpp
parent5c37de788529cd9180f22069970737a7208bd625 (diff)
Patch to diagnose a variety of misuse of property
attributes. Example would be, readonly, assign or assign, copy, etc. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60620 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDeclObjC.cpp')
-rw-r--r--lib/Sema/SemaDeclObjC.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/Sema/SemaDeclObjC.cpp b/lib/Sema/SemaDeclObjC.cpp
index 03c803054c..19769b82e3 100644
--- a/lib/Sema/SemaDeclObjC.cpp
+++ b/lib/Sema/SemaDeclObjC.cpp
@@ -1229,12 +1229,22 @@ void Sema::CheckObjCPropertyAttributes(QualType PropertyTy,
unsigned &Attributes) {
// FIXME: Improve the reported location.
- // readonly and readwrite conflict.
+ // readonly and readwrite/assign/retain/copy conflict.
if ((Attributes & ObjCDeclSpec::DQ_PR_readonly) &&
- (Attributes & ObjCDeclSpec::DQ_PR_readwrite)) {
+ (Attributes & (ObjCDeclSpec::DQ_PR_readwrite |
+ ObjCDeclSpec::DQ_PR_assign |
+ ObjCDeclSpec::DQ_PR_copy |
+ ObjCDeclSpec::DQ_PR_retain))) {
+ const char * which = (Attributes & ObjCDeclSpec::DQ_PR_readwrite) ?
+ "readwrite" :
+ (Attributes & ObjCDeclSpec::DQ_PR_assign) ?
+ "assign" :
+ (Attributes & ObjCDeclSpec::DQ_PR_copy) ?
+ "copy" : "retain";
+
Diag(Loc, diag::err_objc_property_attr_mutually_exclusive)
- << "readonly" << "readwrite";
- Attributes &= ~ObjCDeclSpec::DQ_PR_readonly;
+ << "readonly" << which;
+ return;
}
// Check for copy or retain on non-object types.