summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2009-02-21 00:30:43 +0000
committerFariborz Jahanian <fjahanian@apple.com>2009-02-21 00:30:43 +0000
commit10bec1099cf395c970460f7665c2d5a802eb1a53 (patch)
treee3a325db6d0f6fe051e7c8f84c691d0c101b492a /clang/lib/CodeGen/CGExpr.cpp
parent3c81dabd76accd809295f94f6d6e2eb9ad45dce0 (diff)
downloadbcm5719-llvm-10bec1099cf395c970460f7665c2d5a802eb1a53.tar.gz
bcm5719-llvm-10bec1099cf395c970460f7665c2d5a802eb1a53.zip
Handle case of none gc'able objects regardless of their
type. llvm-svn: 65205
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index ea0fc554641..a9db6db0d9b 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -405,7 +405,7 @@ void CodeGenFunction::EmitStoreThroughLValue(RValue Src, LValue Dst,
assert(0 && "Unknown LValue type");
}
- if (Dst.isObjCWeak()) {
+ if (Dst.isObjCWeak() && !Dst.isNonGC()) {
// load of a __weak object.
llvm::Value *LvalueDst = Dst.getAddress();
llvm::Value *src = Src.getScalarVal();
@@ -413,7 +413,7 @@ void CodeGenFunction::EmitStoreThroughLValue(RValue Src, LValue Dst,
return;
}
- if (Dst.isObjCStrong()) {
+ if (Dst.isObjCStrong() && !Dst.isNonGC()) {
// load of a __strong object.
llvm::Value *LvalueDst = Dst.getAddress();
llvm::Value *src = Src.getScalarVal();
@@ -629,10 +629,11 @@ LValue CodeGenFunction::EmitDeclRefLValue(const DeclRefExpr *E) {
// local variables do not get their gc attribute set.
QualType::GCAttrTypes attr = QualType::GCNone;
// local static?
- if (VD->getStorageClass() == VarDecl::Static)
+ if (!VD->hasLocalStorage())
attr = getContext().getObjCGCAttrKind(E->getType());
LV = LValue::MakeAddr(V, E->getType().getCVRQualifiers(), attr);
}
+ LValue::SetObjCNonGC(LV, VD->hasLocalStorage());
return LV;
} else if (VD && VD->isFileVarDecl()) {
LValue LV = LValue::MakeAddr(CGM.GetAddrOfGlobalVar(VD),
@@ -834,6 +835,7 @@ EmitExtVectorElementExpr(const ExtVectorElementExpr *E) {
LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
bool isUnion = false;
bool isIvar = false;
+ bool isNonGC = false;
Expr *BaseExpr = E->getBase();
llvm::Value *BaseValue = NULL;
unsigned CVRQualifiers=0;
@@ -857,6 +859,8 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
LValue BaseLV = EmitLValue(BaseExpr);
if (BaseLV.isObjCIvar())
isIvar = true;
+ if (BaseLV.isNonGC())
+ isNonGC = true;
// FIXME: this isn't right for bitfields.
BaseValue = BaseLV.getAddress();
if (BaseExpr->getType()->isUnionType())
@@ -870,6 +874,7 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) {
LValue MemExpLV = EmitLValueForField(BaseValue, Field, isUnion,
CVRQualifiers);
LValue::SetObjCIvar(MemExpLV, isIvar);
+ LValue::SetObjCNonGC(MemExpLV, isNonGC);
return MemExpLV;
}
OpenPOWER on IntegriCloud