diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-02-19 00:48:05 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-02-19 00:48:05 +0000 |
commit | c1debf333186f1307cd7d086c3db3e39d7da0a12 (patch) | |
tree | 65d39b226f5a399c9d7f1300b421c1187146d6d9 /lib/CodeGen/CGExpr.cpp | |
parent | ccb8f089d72ed8a01f9e13bcd0de3d2a8cd4af93 (diff) |
Some code simplification. ir gen for gc'able array
of objects in objc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64992 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r-- | lib/CodeGen/CGExpr.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 69429e08e6..6e7d936c7e 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -610,9 +610,7 @@ static void SetDeclObjCGCAttrInLvalue(ASTContext &Ctx, const QualType &Ty, LValue &LV) { QualType::GCAttrTypes attr = Ctx.getObjCGCAttrKind(Ty); - if (attr != QualType::GCNone) - LValue::SetObjCType(attr == QualType::Weak, - attr == QualType::Strong, LV); + LValue::SetObjCType(attr, LV); } LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) { @@ -767,11 +765,13 @@ LValue CodeGenFunction::EmitArraySubscriptExpr(const ArraySubscriptExpr *E) { BaseTypeSize)); } - QualType ExprTy = getContext().getCanonicalType(E->getBase()->getType()); + QualType T = E->getBase()->getType(); + QualType ExprTy = getContext().getCanonicalType(T); + T = T->getAsPointerType()->getPointeeType(); return LValue::MakeAddr(Builder.CreateGEP(Base, Idx, "arrayidx"), - ExprTy->getAsPointerType()->getPointeeType() - .getCVRQualifiers()); + ExprTy->getAsPointerType()->getPointeeType().getCVRQualifiers(), + getContext().getObjCGCAttrKind(T)); } static @@ -921,11 +921,13 @@ LValue CodeGenFunction::EmitLValueForField(llvm::Value* BaseValue, CGM.getLangOptions().getGCMode() != LangOptions::NonGC) { QualType Ty = Field->getType(); QualType::GCAttrTypes attr = Ty.getObjCGCAttr(); - if (attr != QualType::GCNone) + if (attr != QualType::GCNone) { // __weak attribute on a field is ignored. - LValue::SetObjCType(false, attr == QualType::Strong, LV); + if (attr == QualType::Strong) + LValue::SetObjCType(QualType::Strong, LV); + } else if (getContext().isObjCObjectPointerType(Ty)) - LValue::SetObjCType(false, true, LV); + LValue::SetObjCType(QualType::Strong, LV); } return LV; |