diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2009-02-03 00:09:52 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2009-02-03 00:09:52 +0000 |
commit | 45012a7ef5abf1042c893f3f2fa5c23cb5485ea9 (patch) | |
tree | b46917390c26e701aeeafdcd05ccafc5d3fcbbe0 /lib/CodeGen/CGObjC.cpp | |
parent | 40a6be686e5d5bb4198f1affda574e8a4b3a7710 (diff) |
objc2's ir-gen for nonfragile ivar access.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63578 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjC.cpp')
-rw-r--r-- | lib/CodeGen/CGObjC.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index 9dc45efc68..3ebee12f0d 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -194,7 +194,8 @@ void CodeGenFunction::GenerateObjCGetter(ObjCImplementationDecl *IMP, } else { FieldDecl *Field = IMP->getClassInterface()->lookupFieldDeclForIvar(getContext(), Ivar); - LValue LV = EmitLValueForIvar(LoadObjCSelf(), Ivar, Field, 0); + LValue LV = EmitLValueForIvar(TypeOfSelfObject(), + LoadObjCSelf(), Ivar, Field, 0); if (hasAggregateLLVMType(Ivar->getType())) { EmitAggregateCopy(ReturnValue, LV.getAddress(), Ivar->getType()); } @@ -294,6 +295,14 @@ llvm::Value *CodeGenFunction::LoadObjCSelf() { return Builder.CreateLoad(LocalDeclMap[OMD->getSelfDecl()], "self"); } +QualType CodeGenFunction::TypeOfSelfObject() { + const ObjCMethodDecl *OMD = cast<ObjCMethodDecl>(CurFuncDecl); + ImplicitParamDecl *selfDecl = OMD->getSelfDecl(); + const PointerType *PTy = + cast<PointerType>(getContext().getCanonicalType(selfDecl->getType())); + return PTy->getPointeeType(); +} + RValue CodeGenFunction::EmitObjCPropertyGet(const Expr *Exp) { // FIXME: Split it into two separate routines. if (const ObjCPropertyRefExpr *E = dyn_cast<ObjCPropertyRefExpr>(Exp)) { |