aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-02-20 01:14:43 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-02-20 01:14:43 +0000
commit4f54526a31458c19aad19e5d3fb4ba2a5275ecb6 (patch)
treecc44f14b9d9c1737e975d9037a3becac06f8252a /lib/CodeGen
parentbdc3d0034d5b637b211abd01a936267df27118cc (diff)
More objc gc's ir-gen fixes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65097 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen')
-rw-r--r--lib/CodeGen/CGExpr.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp
index aa1585b2db..5da0de9cbb 100644
--- a/lib/CodeGen/CGExpr.cpp
+++ b/lib/CodeGen/CGExpr.cpp
@@ -626,8 +626,12 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
else {
llvm::Value *V = LocalDeclMap[VD];
assert(V && "BlockVarDecl not entered in LocalDeclMap?");
- LV = LValue::MakeAddr(V, E->getType().getCVRQualifiers(),
- getContext().getObjCGCAttrKind(E->getType()));
+ // local variables do not get their gc attribute set.
+ QualType::GCAttrTypes attr = QualType::GCNone;
+ // local static?
+ if (VD->getStorageClass() == VarDecl::Static)
+ attr = getContext().getObjCGCAttrKind(E->getType());
+ LV = LValue::MakeAddr(V, E->getType().getCVRQualifiers(), attr);
}
return LV;
} else if (VD && VD->isFileVarDecl()) {
@@ -665,7 +669,8 @@ LValue CodeGenFunction::EmitUnaryOpLValue(const UnaryOperator *E) {
{
QualType T = E->getSubExpr()->getType()->getAsPointerType()->getPointeeType();
return LValue::MakeAddr(EmitScalarExpr(E->getSubExpr()),
- ExprTy->getAsPointerType()->getPointeeType().getCVRQualifiers(),
+ ExprTy->getAsPointerType()->getPointeeType()
+ .getCVRQualifiers(),
getContext().getObjCGCAttrKind(T));
}
case UnaryOperator::Real: