summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjC.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-09-13 18:31:23 +0000
committerJohn McCall <rjmccall@apple.com>2011-09-13 18:31:23 +0000
commit43192863370c121c86d49dc403fd6ff669aa5d97 (patch)
tree138a50bc03599e47f77073775c8aa90fe3abaf5b /clang/lib/CodeGen/CGObjC.cpp
parent2fd89a0956b316e4ae56924c58e346657ad3690d (diff)
downloadbcm5719-llvm-43192863370c121c86d49dc403fd6ff669aa5d97.tar.gz
bcm5719-llvm-43192863370c121c86d49dc403fd6ff669aa5d97.zip
Refactoring, mostly to give ObjCPropertyDecls stronger invariants for
their semantic attributes and then to take advantage of that. llvm-svn: 139615
Diffstat (limited to 'clang/lib/CodeGen/CGObjC.cpp')
-rw-r--r--clang/lib/CodeGen/CGObjC.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index 1572b4b3cfa..8f5e1fb761d 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/lib/CodeGen/CGObjC.cpp
@@ -443,10 +443,10 @@ namespace {
PropertyImplStrategy::PropertyImplStrategy(CodeGenModule &CGM,
const ObjCPropertyImplDecl *propImpl) {
const ObjCPropertyDecl *prop = propImpl->getPropertyDecl();
- ObjCPropertyDecl::PropertyAttributeKind attrs = prop->getPropertyAttributes();
+ ObjCPropertyDecl::SetterKind setterKind = prop->getSetterKind();
- IsCopy = (attrs & ObjCPropertyDecl::OBJC_PR_copy);
- IsAtomic = !(attrs & ObjCPropertyDecl::OBJC_PR_nonatomic);
+ IsCopy = (setterKind == ObjCPropertyDecl::Copy);
+ IsAtomic = prop->isAtomic();
HasStrong = false; // doesn't matter here.
// Evaluate the ivar's size and alignment.
@@ -456,14 +456,14 @@ PropertyImplStrategy::PropertyImplStrategy(CodeGenModule &CGM,
= CGM.getContext().getTypeInfoInChars(ivarType);
// If we have a copy property, we always have to use getProperty/setProperty.
+ // TODO: we could actually use setProperty and an expression for non-atomics.
if (IsCopy) {
Kind = GetSetProperty;
return;
}
- // Handle retain/strong.
- if (attrs & (ObjCPropertyDecl::OBJC_PR_retain
- | ObjCPropertyDecl::OBJC_PR_strong)) {
+ // Handle retain.
+ if (setterKind == ObjCPropertyDecl::Retain) {
// In GC-only, there's nothing special that needs to be done.
if (CGM.getLangOptions().getGC() == LangOptions::GCOnly) {
// fallthrough
@@ -663,9 +663,8 @@ CodeGenFunction::generateObjCGetterBody(const ObjCImplementationDecl *classImpl,
args.add(RValue::get(self), getContext().getObjCIdType());
args.add(RValue::get(cmd), getContext().getObjCSelType());
args.add(RValue::get(ivarOffset), getContext().getPointerDiffType());
-
- assert(strategy.isAtomic());
- args.add(RValue::get(Builder.getTrue()), getContext().BoolTy);
+ args.add(RValue::get(Builder.getInt1(strategy.isAtomic())),
+ getContext().BoolTy);
// FIXME: We shouldn't need to get the function info here, the
// runtime already should have computed it to build the function.
OpenPOWER on IntegriCloud