aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-02-18 18:52:41 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-02-18 18:52:41 +0000
commit5934e75d98d99374f72722a69c5eefe026f35c74 (patch)
tree64958fe4386f71f5afd0a81d701b350e824fb22c /lib/CodeGen/CGExpr.cpp
parent609b3ab97bdbdb46941c7ee5549269eb0a660412 (diff)
Start generating gc'able code using the new
objc gc type attributes. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64935 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r--lib/CodeGen/CGExpr.cpp41
1 files changed, 16 insertions, 25 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index 4e60cc518b..ae8d4b433a 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -609,22 +609,17 @@ void CodeGenFunction::EmitStoreThroughExtVectorComponentLValue(RValue Src,
static void SetVarDeclObjCAttribute(ASTContext &Ctx, const Decl *VD,
const QualType &Ty, LValue &LV)
{
-#if 0
-// FIXME. ObjCGCAttr no more.
- if (const ObjCGCAttr *A = VD->getAttr<ObjCGCAttr>()) {
- ObjCGCAttr::GCAttrTypes attrType = A->getType();
- LValue::SetObjCType(attrType == ObjCGCAttr::Weak,
- attrType == ObjCGCAttr::Strong, LV);
- }
- else
-#endif
if (Ctx.getLangOptions().ObjC1 &&
- Ctx.getLangOptions().getGCMode() != LangOptions::NonGC) {
+ Ctx.getLangOptions().getGCMode() != LangOptions::NonGC) {
+ QualType::GCAttrTypes attr = Ty.getObjCGCAttr();
+ if (attr != QualType::GCNone)
+ LValue::SetObjCType(attr == QualType::Weak,
+ attr == QualType::Strong, LV);
// Default behavious under objective-c's gc is for objective-c pointers
// be treated as though they were declared as __strong.
- if (Ctx.isObjCObjectPointerType(Ty))
+ else if (Ctx.isObjCObjectPointerType(Ty))
LValue::SetObjCType(false, true, LV);
- }
+ }
}
LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
@@ -929,21 +924,17 @@ LValue CodeGenFunction::EmitLValueForField(llvm::Value* BaseValue,
LValue LV =
LValue::MakeAddr(V,
Field->getType().getCVRQualifiers()|CVRQualifiers);
-#if 0
-// FIXME. ObjCGCAttr is no more.
- if (const ObjCGCAttr *A = Field->getAttr<ObjCGCAttr>()) {
- ObjCGCAttr::GCAttrTypes attrType = A->getType();
- // __weak attribute on a field is ignored.
- LValue::SetObjCType(false, attrType == ObjCGCAttr::Strong, LV);
- }
- else
-#endif
if (CGM.getLangOptions().ObjC1 &&
- CGM.getLangOptions().getGCMode() != LangOptions::NonGC) {
- QualType ExprTy = Field->getType();
- if (getContext().isObjCObjectPointerType(ExprTy))
+ CGM.getLangOptions().getGCMode() != LangOptions::NonGC) {
+ QualType Ty = Field->getType();
+ QualType::GCAttrTypes attr = Ty.getObjCGCAttr();
+ if (attr != QualType::GCNone)
+ // __weak attribute on a field is ignored.
+ LValue::SetObjCType(false, attr == QualType::Strong, LV);
+ else if (getContext().isObjCObjectPointerType(Ty))
LValue::SetObjCType(false, true, LV);
- }
+
+ }
return LV;
}