1 | // RUN: %clang_cc1 -E %s -o %t.mm |
2 | // RUN: %clang_cc1 -fblocks -rewrite-objc -fms-extensions %t.mm -o %t-rw.cpp |
3 | // RUN: FileCheck --input-file=%t-rw.cpp %s |
4 | // RUN: %clang_cc1 -fsyntax-only -Werror -Wno-address-of-temporary -Wno-c++11-narrowing -std=c++11 -D"Class=void*" -D"id=void*" -D"SEL=void*" -U__declspec -D"__declspec(X)=" %t-rw.cpp |
5 | |
6 | struct S { |
7 | int i1; |
8 | double d1; |
9 | void (^block1)(); |
10 | }; |
11 | |
12 | @interface I |
13 | { |
14 | struct S struct_ivar; |
15 | |
16 | struct S *pstruct_ivar; |
17 | } |
18 | @end |
19 | |
20 | @implementation I |
21 | - (struct S) dMeth{ return struct_ivar; } |
22 | @end |
23 | |
24 | // CHECK: return (*(struct S *)((char *)self + OBJC_IVAR_$_I$struct_ivar)); |
25 | |
26 | // rdar://11323187 |
27 | @interface Foo{ |
28 | @protected |
29 | struct { |
30 | int x:1; |
31 | int y:1; |
32 | } bar; |
33 | |
34 | struct _S { |
35 | int x:1; |
36 | int y:1; |
37 | } s; |
38 | |
39 | } |
40 | @end |
41 | @implementation Foo |
42 | - (void)x { |
43 | bar.x = 0; |
44 | bar.y = 1; |
45 | |
46 | s.x = 0; |
47 | s.y = 1; |
48 | } |
49 | @end |
50 | |
51 | // CHECK: (*(decltype(((Foo_IMPL *)0U)->bar) *)((char *)self + OBJC_IVAR_$_Foo$bar)).x = 0; |
52 | // CHECK: (*(struct _S *)((char *)self + OBJC_IVAR_$_Foo$s)).x = 0; |
53 | |