[cfe-commits] r62123 - in /cfe/trunk: lib/CodeGen/CGExpr.cpp test/CodeGenObjC/property-agrr-getter.m

Fariborz Jahanian fjahanian at apple.com
Mon Jan 12 15:27:26 PST 2009


Author: fjahanian
Date: Mon Jan 12 17:27:26 2009
New Revision: 62123

URL: http://llvm.org/viewvc/llvm-project?rev=62123&view=rev
Log:
Patch to implement code gen for aggrgate-valued property used
to access a field of its type.

Added:
    cfe/trunk/test/CodeGenObjC/property-agrr-getter.m
Modified:
    cfe/trunk/lib/CodeGen/CGExpr.cpp

Modified: cfe/trunk/lib/CodeGen/CGExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExpr.cpp?rev=62123&r1=62122&r2=62123&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CGExpr.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExpr.cpp Mon Jan 12 17:27:26 2009
@@ -802,6 +802,14 @@
       isUnion = true;
     CVRQualifiers = PTy->getPointeeType().getCVRQualifiers();
   }
+  else if (BaseExpr->getStmtClass() == Expr::ObjCPropertyRefExprClass ||
+           BaseExpr->getStmtClass() == Expr::ObjCKVCRefExprClass) {
+    RValue RV = EmitObjCPropertyGet(BaseExpr);
+    BaseValue = RV.getAggregateAddr();
+    if (BaseExpr->getType()->isUnionType())
+      isUnion = true;
+    CVRQualifiers = BaseExpr->getType().getCVRQualifiers();
+  }
   else {
     LValue BaseLV = EmitLValue(BaseExpr);
     if (BaseLV.isObjCIvar())

Added: cfe/trunk/test/CodeGenObjC/property-agrr-getter.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/property-agrr-getter.m?rev=62123&view=auto

==============================================================================
--- cfe/trunk/test/CodeGenObjC/property-agrr-getter.m (added)
+++ cfe/trunk/test/CodeGenObjC/property-agrr-getter.m Mon Jan 12 17:27:26 2009
@@ -0,0 +1,17 @@
+// RUN: clang -emit-llvm -o %t %s
+
+typedef struct {
+  unsigned f0;
+} s0;
+
+ at interface A
+- (s0) f0;
+ at end
+
+ at implementation A
+-(s0) f0{}
+- (unsigned) bar {
+  return self.f0.f0;
+}
+ at end
+





More information about the cfe-commits mailing list