diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2008-11-21 18:14:01 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2008-11-21 18:14:01 +0000 |
commit | 2ab1968eb400331ffe47c560583326e4034aed4a (patch) | |
tree | cc11fbd18b298ff11dbb768e326e4a774ab3e849 /lib/CodeGen/CGExpr.cpp | |
parent | dc518e2a0ff07d6d3d22cd6ac9e8eb0cf5807cc1 (diff) |
Fields of ivars of struct types are considered ivars
themselves for gc API generation purposes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59828 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGExpr.cpp')
-rw-r--r-- | lib/CodeGen/CGExpr.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/CodeGen/CGExpr.cpp b/lib/CodeGen/CGExpr.cpp index 21ac806c62..4f2bd4871b 100644 --- a/lib/CodeGen/CGExpr.cpp +++ b/lib/CodeGen/CGExpr.cpp @@ -732,6 +732,7 @@ EmitExtVectorElementExpr(const ExtVectorElementExpr *E) { LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) { bool isUnion = false; + bool isIvar = false; Expr *BaseExpr = E->getBase(); llvm::Value *BaseValue = NULL; unsigned CVRQualifiers=0; @@ -747,6 +748,8 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) { } else { LValue BaseLV = EmitLValue(BaseExpr); + if (BaseLV.isObjCIvar()) + isIvar = true; // FIXME: this isn't right for bitfields. BaseValue = BaseLV.getAddress(); if (BaseExpr->getType()->isUnionType()) @@ -755,7 +758,9 @@ LValue CodeGenFunction::EmitMemberExpr(const MemberExpr *E) { } FieldDecl *Field = E->getMemberDecl(); - return EmitLValueForField(BaseValue, Field, isUnion, CVRQualifiers); + LValue MemExpLV = EmitLValueForField(BaseValue, Field, isUnion, CVRQualifiers); + LValue::SetObjCIvar(MemExpLV, isIvar); + return MemExpLV; } LValue CodeGenFunction::EmitLValueForField(llvm::Value* BaseValue, @@ -937,7 +942,7 @@ LValue CodeGenFunction::EmitLValueForIvar(llvm::Value *BaseValue, llvm::Value *V = Builder.CreateStructGEP(BaseValue, Index, "tmp"); LValue LV = LValue::MakeAddr(V, Ivar->getType().getCVRQualifiers()|CVRQualifiers); SetVarDeclObjCAttribute(getContext(), Ivar, Ivar->getType(), LV); - LValue::SetObjCIvar(LV); + LValue::SetObjCIvar(LV, true); return LV; } |