[cfe-commits] r103279 - in /cfe/trunk: lib/CodeGen/CGExprCXX.cpp test/CodeGenObjCXX/property-objects.mm
Fariborz Jahanian
fjahanian at apple.com
Fri May 7 11:56:13 PDT 2010
Author: fjahanian
Date: Fri May 7 13:56:13 2010
New Revision: 103279
URL: http://llvm.org/viewvc/llvm-project?rev=103279&view=rev
Log:
Fixes a Code gen crash trying to use a dot-syntax for
a property of a c++ class object (radar 7957369).
Modified:
cfe/trunk/lib/CodeGen/CGExprCXX.cpp
cfe/trunk/test/CodeGenObjCXX/property-objects.mm
Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=103279&r1=103278&r2=103279&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Fri May 7 13:56:13 2010
@@ -273,8 +273,14 @@
const llvm::Type *Ty =
CGM.getTypes().GetFunctionType(CGM.getTypes().getFunctionInfo(MD),
FPT->isVariadic());
-
- llvm::Value *This = EmitLValue(E->getArg(0)).getAddress();
+ LValue LV = EmitLValue(E->getArg(0));
+ llvm::Value *This;
+ if (LV.isPropertyRef()) {
+ RValue RV = EmitLoadOfPropertyRefLValue(LV, E->getArg(0)->getType());
+ This = RV.isScalar() ? RV.getScalarVal() : RV.getAggregateAddr();
+ }
+ else
+ This = LV.getAddress();
llvm::Value *Callee;
if (MD->isVirtual() && !canDevirtualizeMemberFunctionCalls(E->getArg(0)))
Modified: cfe/trunk/test/CodeGenObjCXX/property-objects.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/property-objects.mm?rev=103279&r1=103278&r2=103279&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjCXX/property-objects.mm (original)
+++ cfe/trunk/test/CodeGenObjCXX/property-objects.mm Fri May 7 13:56:13 2010
@@ -18,3 +18,11 @@
@implementation I
@synthesize position;
@end
+
+int main() {
+ I *i;
+ S s1;
+ i.position = s1;
+ return 0;
+}
+
More information about the cfe-commits
mailing list