aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaObjCProperty.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-09-07 16:24:21 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-09-07 16:24:21 +0000
commitedc08821d3f73514291b339db29aca1a17485e39 (patch)
tree4afbd130e65756fb1aa802c0c828cf72a9c7af65 /lib/Sema/SemaObjCProperty.cpp
parent5770bb707db9169c258859a9e7c935f99a32d64c (diff)
objc-gc: More sema work for properties declared 'weak'
in GC mode. // rdar://10073896 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139235 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaObjCProperty.cpp')
-rw-r--r--lib/Sema/SemaObjCProperty.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index 9695b811ee..9f50dea233 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -594,12 +594,18 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
ObjCPropertyDecl::PropertyAttributeKind kind
= property->getPropertyAttributes();
QualType PropType = Context.getCanonicalType(property->getType());
- bool PropertyIsGCWeak = (kind & ObjCPropertyDecl::OBJC_PR_weak &&
- !getLangOptions().ObjCAutoRefCount &&
- getLangOptions().getGCMode() !=
- LangOptions::NonGC);
- if (PropertyIsGCWeak && !PropType.isObjCGCStrong())
- PropType = Context.getObjCGCQualType(PropType, Qualifiers::Weak);
+
+ if ((kind & ObjCPropertyDecl::OBJC_PR_weak) &&
+ !getLangOptions().ObjCAutoRefCount &&
+ getLangOptions().getGCMode() != LangOptions::NonGC) {
+ if (PropType.isObjCGCStrong()) {
+ Diag(PropertyLoc,
+ diag::err_gc_weak_property_strong_type);
+ Diag(property->getLocation(), diag::note_property_declare);
+ }
+ else
+ PropType = Context.getObjCGCQualType(PropType, Qualifiers::Weak);
+ }
QualType PropertyIvarType = PropType;
if (PropType->isReferenceType())
PropertyIvarType = cast<ReferenceType>(PropType)->getPointeeType();
@@ -721,6 +727,7 @@ Decl *Sema::ActOnPropertyImplDecl(Scope *S,
getLangOptions().getGCMode() != LangOptions::NonGC)) {
Diag(PropertyLoc, diag::error_weak_property)
<< property->getDeclName() << Ivar->getDeclName();
+ Diag(Ivar->getLocation(), diag::note_ivar_decl);
// Fall thru - see previous comment
}
// Fall thru - see previous comment