[cfe-commits] r103440 - in /cfe/trunk: lib/CodeGen/CGExpr.cpp lib/CodeGen/CGExprCXX.cpp test/CodeGenObjCXX/property-objects.mm

Fariborz Jahanian fjahanian at apple.com
Mon May 10 15:57:35 PDT 2010


Author: fjahanian
Date: Mon May 10 17:57:35 2010
New Revision: 103440

URL: http://llvm.org/viewvc/llvm-project?rev=103440&view=rev
Log:
Objective-C++ Code gen. Handle code gen. for property
reference dot-syntax notation in a varierty of cases.
Fixes radar 7964490.


Modified:
    cfe/trunk/lib/CodeGen/CGExpr.cpp
    cfe/trunk/lib/CodeGen/CGExprCXX.cpp
    cfe/trunk/test/CodeGenObjCXX/property-objects.mm

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=103440&r1=103439&r2=103440&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon May 10 17:57:35 2010
@@ -1670,7 +1670,16 @@
                             MakeQualifiers(E->getType()));
   }
 
-  case CastExpr::CK_NoOp:
+  case CastExpr::CK_NoOp: {
+    LValue LV = EmitLValue(E->getSubExpr());
+    // FIXME. assign a meaningfull cast kind.
+    if (LV.isPropertyRef()) {
+      RValue RV = EmitLoadOfPropertyRefLValue(LV, E->getSubExpr()->getType());
+      llvm::Value *V = RV.isScalar() ? RV.getScalarVal() : RV.getAggregateAddr();
+      return LValue::MakeAddr(V, MakeQualifiers(E->getSubExpr()->getType()));
+    }
+    return LV;
+  }
   case CastExpr::CK_ConstructorConversion:
   case CastExpr::CK_UserDefinedConversion:
   case CastExpr::CK_AnyPointerToObjCPointerCast:

Modified: cfe/trunk/lib/CodeGen/CGExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprCXX.cpp?rev=103440&r1=103439&r2=103440&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprCXX.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprCXX.cpp Mon May 10 17:57:35 2010
@@ -261,7 +261,16 @@
     if (ClassDecl->hasTrivialCopyAssignment()) {
       assert(!ClassDecl->hasUserDeclaredCopyAssignment() &&
              "EmitCXXOperatorMemberCallExpr - user declared copy assignment");
-      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());
+        assert (!RV.isScalar() && "EmitCXXOperatorMemberCallExpr");
+        This = RV.getAggregateAddr();
+      }
+      else
+        This = LV.getAddress();
+      
       llvm::Value *Src = EmitLValue(E->getArg(1)).getAddress();
       QualType Ty = E->getType();
       EmitAggregateCopy(This, Src, Ty);

Modified: cfe/trunk/test/CodeGenObjCXX/property-objects.mm
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjCXX/property-objects.mm?rev=103440&r1=103439&r2=103440&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjCXX/property-objects.mm (original)
+++ cfe/trunk/test/CodeGenObjCXX/property-objects.mm Mon May 10 17:57:35 2010
@@ -1,6 +1,7 @@
 // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
 // CHECK: call void @_ZN1SC1ERKS_
 // CHECK: call %class.S* @_ZN1SaSERKS_
+// CHECK: call %class.S* @_ZN6CGRectaSERKS_
 
 class S {
 public:
@@ -9,14 +10,26 @@
 	S ();
 };
 
+struct CGRect {
+	CGRect & operator = (const CGRect &);
+};
+
 @interface I {
   S position;
+  CGRect bounds;
 }
 @property(assign, nonatomic) S position;
+ at property CGRect bounds;
+- (void) initWithOwner;
 @end
 
 @implementation I
 @synthesize position;
+ at synthesize bounds;
+- (void)initWithOwner {
+  CGRect labelLayerFrame = self.bounds;
+  labelLayerFrame = self.bounds;
+}
 @end
 
 int main() {





More information about the cfe-commits mailing list