From 6d657c4809d9128be88705d32768de007b988212 Mon Sep 17 00:00:00 2001 From: Fariborz Jahanian Date: Tue, 18 Nov 2008 20:18:11 +0000 Subject: Some basic support toward objective-c's GC code gen. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59543 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGExpr.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib/CodeGen/CGExpr.cpp') diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 5f5001732c..993562592b 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -492,8 +492,14 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) { return LValue::MakeAddr(V, E->getType().getCVRQualifiers()); } } else if (VD && VD->isFileVarDecl()) { - return LValue::MakeAddr(CGM.GetAddrOfGlobalVar(VD), - E->getType().getCVRQualifiers()); + LValue LV = LValue::MakeAddr(CGM.GetAddrOfGlobalVar(VD), + E->getType().getCVRQualifiers()); + if (VD->getAttr()) + { + ObjCGCAttr::GCAttrTypes attrType = (VD->getAttr())->getType(); + LValue::SetObjCGCAttrs(attrType == ObjCGCAttr::Weak, attrType == ObjCGCAttr::Strong, LV); + } + return LV; } else if (const FunctionDecl *FD = dyn_cast(E->getDecl())) { return LValue::MakeAddr(CGM.GetAddrOfFunction(FD), E->getType().getCVRQualifiers()); -- cgit v1.2.3