[llvm-branch-commits] [cfe-branch] r73487 - /cfe/branches/Apple/Dib/test/CodeGenObjC/property-complex.m

Daniel Dunbar daniel at zuster.org
Tue Jun 16 09:03:12 PDT 2009


Author: ddunbar
Date: Tue Jun 16 11:03:12 2009
New Revision: 73487

URL: http://llvm.org/viewvc/llvm-project?rev=73487&view=rev
Log:
Merge in 73158 (<rdar://problem/6957814>):

------------------------------------------------------------------------
r73158 | ddunbar | 2009-06-09 21:38:50 -0700 (Tue, 09 Jun 2009) | 2 lines

Support complex properties, ivars and message expressions.

------------------------------------------------------------------------

Added:
    cfe/branches/Apple/Dib/test/CodeGenObjC/property-complex.m

Added: cfe/branches/Apple/Dib/test/CodeGenObjC/property-complex.m
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/Apple/Dib/test/CodeGenObjC/property-complex.m?rev=73487&view=auto

==============================================================================
--- cfe/branches/Apple/Dib/test/CodeGenObjC/property-complex.m (added)
+++ cfe/branches/Apple/Dib/test/CodeGenObjC/property-complex.m Tue Jun 16 11:03:12 2009
@@ -0,0 +1,61 @@
+// RUN: clang-cc -triple i386-apple-darwin9 -emit-llvm -S -o - %s &&
+// RUN: clang-cc -triple x86_64-apple-darwin9 -emit-llvm -S -o - %s
+
+ at interface I0 {
+ at public
+  _Complex float iv0;
+}
+
+ at property(assign) _Complex float p0;
+
+-(_Complex float) im0;
+-(void) setIm0: (_Complex float) a0;
+ at end
+
+ at implementation I0 
+ at dynamic p0;
+
+-(id) init {
+  self->iv0 = 5.0 + 2.0i;
+  return self;
+}
+
+-(_Complex float) im0 {
+  printf("im0: %.2f + %.2fi\n", __real iv0, __imag iv0);
+  return iv0 + (.1 + .2i);
+}
+-(void) setIm0: (_Complex float) a0 {
+  printf("setIm0: %.2f + %.2fi\n", __real a0, __imag a0);
+  iv0 = a0 + (.3 + .4i);
+}
+
+-(_Complex float) p0 {
+  printf("p0: %.2f + %.2fi\n", __real iv0, __imag iv0);
+  return iv0 + (.5 + .6i);
+}
+-(void) setP0: (_Complex float) a0 {
+  printf("setP0: %.2f + %.2fi\n", __real a0, __imag a0);
+  iv0 = a0 + (.7 + .8i);
+}
+ at end
+
+void f0(I0 *a0) {
+    float l0 = __real a0.im0;
+    float l1 = __imag a0->iv0;
+    _Complex float l2 = (a0.im0 = a0.im0);
+    _Complex float l3 = a0->iv0;
+    _Complex float l4 = (a0->iv0 = a0->iv0);
+    _Complex float l5 = a0->iv0;
+    _Complex float l6 = (a0.p0 = a0.p0);
+    _Complex float l7 = a0->iv0;
+    _Complex float l8 = [a0 im0];
+    printf("l0: %.2f + %.2fi\n", __real l0, __imag l0);
+    printf("l1: %.2f + %.2fi\n", __real l1, __imag l1);
+    printf("l2: %.2f + %.2fi\n", __real l2, __imag l2);
+    printf("l3: %.2f + %.2fi\n", __real l3, __imag l3);
+    printf("l4: %.2f + %.2fi\n", __real l4, __imag l4);
+    printf("l5: %.2f + %.2fi\n", __real l5, __imag l5);
+    printf("l6: %.2f + %.2fi\n", __real l6, __imag l6);
+    printf("l7: %.2f + %.2fi\n", __real l7, __imag l7);
+    printf("l8: %.2f + %.2fi\n", __real l8, __imag l8);
+}





More information about the llvm-branch-commits mailing list