summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2010-09-10 18:56:35 +0000
committerFariborz Jahanian <fjahanian@apple.com>2010-09-10 18:56:35 +0000
commitf93ac894147ea2752897ed58317fcd822f46ff6e (patch)
tree335b9c387742e288c85bdc5c156476f597dd9f2a /clang/lib
parente26fffc597002c5fcc8e352a5886253da5c9fe7e (diff)
downloadbcm5719-llvm-f93ac894147ea2752897ed58317fcd822f46ff6e.tar.gz
bcm5719-llvm-f93ac894147ea2752897ed58317fcd822f46ff6e.zip
IRGen fix for using property-dot syntax to pass
reference object to a c++ member function. fixes radar 8409336. llvm-svn: 113602
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CGExprCXX.cpp10
-rw-r--r--clang/lib/CodeGen/CGObjC.cpp3
2 files changed, 11 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGExprCXX.cpp b/clang/lib/CodeGen/CGExprCXX.cpp
index 9a98281771f..acdbe065561 100644
--- a/clang/lib/CodeGen/CGExprCXX.cpp
+++ b/clang/lib/CodeGen/CGExprCXX.cpp
@@ -100,7 +100,15 @@ RValue CodeGenFunction::EmitCXXMemberCallExpr(const CXXMemberCallExpr *CE,
This = EmitScalarExpr(ME->getBase());
else {
LValue BaseLV = EmitLValue(ME->getBase());
- This = BaseLV.getAddress();
+ if (BaseLV.isPropertyRef() || BaseLV.isKVCRef()) {
+ QualType QT = ME->getBase()->getType();
+ RValue RV =
+ BaseLV.isPropertyRef() ? EmitLoadOfPropertyRefLValue(BaseLV, QT)
+ : EmitLoadOfKVCRefLValue(BaseLV, QT);
+ This = RV.isScalar() ? RV.getScalarVal() : RV.getAggregateAddr();
+ }
+ else
+ This = BaseLV.getAddress();
}
if (MD->isTrivial()) {
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index 6a6d63df8f5..5b0c2630a08 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/lib/CodeGen/CGObjC.cpp
@@ -555,7 +555,8 @@ RValue CodeGenFunction::EmitObjCPropertyGet(const Expr *Exp,
else
Receiver = EmitScalarExpr(KE->getBase());
return CGM.getObjCRuntime().
- GenerateMessageSend(*this, Return, Exp->getType(), S,
+ GenerateMessageSend(*this, Return,
+ KE->getGetterMethod()->getResultType(), S,
Receiver,
CallArgList(), KE->getInterfaceDecl());
}
OpenPOWER on IntegriCloud