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 | c88a70d885cd6dbf6e8bcb4e719407662139dfab (patch) | |
tree | f0b6fc357c6974ebba56e8a9d0b959a1888ffca3 /clang/lib/CodeGen/CGObjC.cpp | |
parent | 76a07f59d4351bb0f26ffb2f0e16b1396774fe73 (diff) | |
download | bcm5719-llvm-c88a70d885cd6dbf6e8bcb4e719407662139dfab.tar.gz bcm5719-llvm-c88a70d885cd6dbf6e8bcb4e719407662139dfab.zip |
objc2's ir-gen for nonfragile ivar access.
llvm-svn: 63578
Diffstat (limited to 'clang/lib/CodeGen/CGObjC.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGObjC.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index 9dc45efc687..3ebee12f0df 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/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)) { |