aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaObjCProperty.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-09-06 23:32:40 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-09-06 23:32:40 +0000
commit4019f7d384ab0d993ffd345f38ff0fa3a84e750b (patch)
tree748bb5a7c66e81c2024306319103ec63ea11a7fc /lib/Sema/SemaObjCProperty.cpp
parentc79a0d22f84e86ad1f9dcb23ec1081aaf5ae4f20 (diff)
objc-gc: Adds support for "weak" property attribute under GC.
// rdar://10073896 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@139203 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaObjCProperty.cpp')
-rw-r--r--lib/Sema/SemaObjCProperty.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/Sema/SemaObjCProperty.cpp b/lib/Sema/SemaObjCProperty.cpp
index 84052fd9d8..bf4939d9fd 100644
--- a/lib/Sema/SemaObjCProperty.cpp
+++ b/lib/Sema/SemaObjCProperty.cpp
@@ -594,6 +594,12 @@ 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 = Context.getObjCGCQualType(PropType, Qualifiers::Weak);
QualType PropertyIvarType = PropType;
if (PropType->isReferenceType())
PropertyIvarType = cast<ReferenceType>(PropType)->getPointeeType();