aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaObjCProperty.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2010-10-21 18:49:42 +0000
committerTed Kremenek <kremenek@apple.com>2010-10-21 18:49:42 +0000
commit788f489a37bf1150deb9378cec6a6eb902d0d1b2 (patch)
tree280d00395485ca054343297ad38ccb2e9bfdfd2b /lib/Sema/SemaObjCProperty.cpp
parentee1c08c88649aaea9dd53272a726cd23de533215 (diff)
Tweak diagnostics for redeclaration of a @property in a class extension where the redelcaration and original
declaration have the 'readwrite' attribute. This is a common case, and we can issue a more lucid diagnostic. Fixes <rdar://problem/7629420>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@117045 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaObjCProperty.cpp')
-rw-r--r--lib/Sema/SemaObjCProperty.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index 251af22415..1e7c1f8508 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -187,7 +187,16 @@ Sema::HandlePropertyInClassExtension(Scope *S, ObjCCategoryDecl *CDecl,
PIDecl->setPropertyAttributes(ObjCPropertyDecl::OBJC_PR_copy);
PIDecl->setSetterName(SetterSel);
} else {
- Diag(AtLoc, diag::err_use_continuation_class)
+ // Tailor the diagnostics for the common case where a readwrite
+ // property is declared both in the @interface and the continuation.
+ // This is a common error where the user often intended the original
+ // declaration to be readonly.
+ unsigned diag =
+ (Attributes & ObjCDeclSpec::DQ_PR_readwrite) &&
+ (PIkind & ObjCPropertyDecl::OBJC_PR_readwrite)
+ ? diag::err_use_continuation_class_redeclaration_readwrite
+ : diag::err_use_continuation_class;
+ Diag(AtLoc, diag)
<< CCPrimary->getDeclName();
Diag(PIDecl->getLocation(), diag::note_property_declare);
}