[cfe-commits] r113602 - in /cfe/trunk: lib/CodeGen/CGExprCXX.cpp lib/CodeGen/CGObjC.cpp test/CodeGenObjCXX/property-dot-reference.mm
Fariborz Jahanian
fjahanian at apple.com
Fri Sep 10 11:56:35 PDT 2010
Author: fjahanian
Date: Fri Sep 10 13:56:35 2010
New Revision: 113602
URL: http://llvm.org/viewvc/llvm-project?rev=113602&view=rev
Log:
IRGen fix for using property-dot syntax to pass
reference object to a c++ member function.
fixes radar 8409336.
Added:
cfe/trunk/test/CodeGenObjCXX/property-dot-reference.mm
Modified:
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/lib/CodeGen/CGObjC.cpp
Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=113602&r1=113601&r2=113602&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Fri Sep 10 13:56:35 2010
@@ -100,7 +100,15 @@
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()) {
Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=113602&r1=113601&r2=113602&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Fri Sep 10 13:56:35 2010
@@ -555,7 +555,8 @@
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());
}
Added: cfe/trunk/test/CodeGenObjCXX/property-dot-reference.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/property-dot-reference.mm?rev=113602&view=auto
==============================================================================
--- cfe/trunk/test/CodeGenObjCXX/property-dot-reference.mm (added)
+++ cfe/trunk/test/CodeGenObjCXX/property-dot-reference.mm Fri Sep 10 13:56:35 2010
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fexceptions -o - %s | FileCheck %s
+// rdar://8409336
+
+struct TFENode {
+void GetURL() const;
+};
+
+ at interface TNodeIconAndNameCell
+- (const TFENode&) node;
+ at end
+
+ at implementation TNodeIconAndNameCell
+- (const TFENode&) node {
+// CHECK: call %struct.TFENode* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend
+// CHECK-NEXT: call void @_ZNK7TFENode6GetURLEv(%struct.TFENode* %{{.*}})
+ self.node.GetURL();
+} // expected-warning {{control reaches end of non-void function}}
+ at end
More information about the cfe-commits
mailing list