]> granicus.if.org Git - clang/commitdiff
test for writing modern ivar of struct type.
authorFariborz Jahanian <fjahanian@apple.com>
Fri, 24 Feb 2012 18:17:50 +0000 (18:17 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Fri, 24 Feb 2012 18:17:50 +0000 (18:17 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@151378 91177308-0d34-0410-b5e6-96231b3b80d8

test/Rewriter/rewrite-modern-struct-ivar.mm [new file with mode: 0644]

diff --git a/test/Rewriter/rewrite-modern-struct-ivar.mm b/test/Rewriter/rewrite-modern-struct-ivar.mm
new file mode 100644 (file)
index 0000000..5ab02d4
--- /dev/null
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -E %s -o %t.mm
+// RUN: %clang_cc1 -fblocks -rewrite-objc -fms-extensions %t.mm -o %t-rw.cpp 
+// RUN: FileCheck --input-file=%t-rw.cpp %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp
+
+struct S {
+    int i1;
+    double d1;
+    void (^block1)();
+};
+
+@interface I
+{
+  struct S struct_ivar;
+
+  struct S *pstruct_ivar;
+}
+@end
+
+@implementation I
+- (struct S) dMeth{ return struct_ivar; }
+@end
+  
+// CHECK: return (*(struct S *)((char *)self + OBJC_IVAR_$_I_struct_ivar));