xref: /minix3/external/bsd/llvm/dist/clang/test/Rewriter/rewrite-modern-ivar-access.mm (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -fblocks -rewrite-objc -fms-extensions %s -o %t-rw.cpp
2*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -Werror -fsyntax-only -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
3*f4a2713aSLionel Sambuc
4*f4a2713aSLionel Sambucstruct OUTSIDE {
5*f4a2713aSLionel Sambuc  int i_OUTSIDE;
6*f4a2713aSLionel Sambuc  double d_OUTSIDE;
7*f4a2713aSLionel Sambuc};
8*f4a2713aSLionel Sambuc
9*f4a2713aSLionel Sambuc
10*f4a2713aSLionel Sambuc@interface I1 {
11*f4a2713aSLionel Sambuc@protected
12*f4a2713aSLionel Sambuc  struct OUTSIDE ivar_I1;
13*f4a2713aSLionel Sambuc
14*f4a2713aSLionel Sambuc  struct INNER_I1 {
15*f4a2713aSLionel Sambuc    int i_INNER_I1;
16*f4a2713aSLionel Sambuc    double d_INNER_I1;
17*f4a2713aSLionel Sambuc  };
18*f4a2713aSLionel Sambuc
19*f4a2713aSLionel Sambuc  struct INNER_I1 ivar_I2;
20*f4a2713aSLionel Sambuc
21*f4a2713aSLionel Sambuc  struct OUTSIDE ivar_I3;
22*f4a2713aSLionel Sambuc
23*f4a2713aSLionel Sambuc  struct {
24*f4a2713aSLionel Sambuc    int i_noname;
25*f4a2713aSLionel Sambuc    double d_noname;
26*f4a2713aSLionel Sambuc  } NONAME_I4;
27*f4a2713aSLionel Sambuc
28*f4a2713aSLionel Sambuc  struct {
29*f4a2713aSLionel Sambuc    int i_noname;
30*f4a2713aSLionel Sambuc    double d_noname;
31*f4a2713aSLionel Sambuc  } NONAME_I5;
32*f4a2713aSLionel Sambuc}
33*f4a2713aSLionel Sambuc@end
34*f4a2713aSLionel Sambuc
35*f4a2713aSLionel Sambuc@implementation I1
36*f4a2713aSLionel Sambuc- (void) I1_Meth {
37*f4a2713aSLionel Sambuc  ivar_I1.i_OUTSIDE = 0;
38*f4a2713aSLionel Sambuc
39*f4a2713aSLionel Sambuc  ivar_I2.i_INNER_I1 = 1;
40*f4a2713aSLionel Sambuc
41*f4a2713aSLionel Sambuc  ivar_I3.i_OUTSIDE = 2;
42*f4a2713aSLionel Sambuc
43*f4a2713aSLionel Sambuc  NONAME_I4.i_noname = 3;
44*f4a2713aSLionel Sambuc
45*f4a2713aSLionel Sambuc  NONAME_I5.i_noname = 4;
46*f4a2713aSLionel Sambuc}
47*f4a2713aSLionel Sambuc@end
48*f4a2713aSLionel Sambuc
49*f4a2713aSLionel Sambuc@interface INTF2 {
50*f4a2713aSLionel Sambuc@protected
51*f4a2713aSLionel Sambuc  struct OUTSIDE ivar_INTF2;
52*f4a2713aSLionel Sambuc
53*f4a2713aSLionel Sambuc  struct {
54*f4a2713aSLionel Sambuc    int i_noname;
55*f4a2713aSLionel Sambuc    double d_noname;
56*f4a2713aSLionel Sambuc  } NONAME_INTF4;
57*f4a2713aSLionel Sambuc
58*f4a2713aSLionel Sambuc
59*f4a2713aSLionel Sambuc  struct OUTSIDE ivar_INTF3;
60*f4a2713aSLionel Sambuc
61*f4a2713aSLionel Sambuc  struct INNER_I1 ivar_INTF4;
62*f4a2713aSLionel Sambuc
63*f4a2713aSLionel Sambuc  struct {
64*f4a2713aSLionel Sambuc    int i_noname;
65*f4a2713aSLionel Sambuc    double d_noname;
66*f4a2713aSLionel Sambuc  } NONAME_INTF5;
67*f4a2713aSLionel Sambuc
68*f4a2713aSLionel Sambuc  struct INNER_INTF2 {
69*f4a2713aSLionel Sambuc    int i_INNER_INTF2;
70*f4a2713aSLionel Sambuc    double d_INNER_INTF2;
71*f4a2713aSLionel Sambuc  };
72*f4a2713aSLionel Sambuc
73*f4a2713aSLionel Sambuc  struct INNER_INTF2 ivar_INTF6, ivar_INTF7;
74*f4a2713aSLionel Sambuc
75*f4a2713aSLionel Sambuc  struct INNER_INTF3 {
76*f4a2713aSLionel Sambuc    int i;
77*f4a2713aSLionel Sambuc  } X1,X2,X3;
78*f4a2713aSLionel Sambuc
79*f4a2713aSLionel Sambuc}
80*f4a2713aSLionel Sambuc@end
81*f4a2713aSLionel Sambuc
82*f4a2713aSLionel Sambuc@implementation INTF2
83*f4a2713aSLionel Sambuc- (void) I2_Meth {
84*f4a2713aSLionel Sambuc  ivar_INTF2.i_OUTSIDE = 0;
85*f4a2713aSLionel Sambuc
86*f4a2713aSLionel Sambuc  ivar_INTF4.i_INNER_I1 = 1;
87*f4a2713aSLionel Sambuc
88*f4a2713aSLionel Sambuc  ivar_INTF3.i_OUTSIDE = 2;
89*f4a2713aSLionel Sambuc
90*f4a2713aSLionel Sambuc  NONAME_INTF4.i_noname = 3;
91*f4a2713aSLionel Sambuc
92*f4a2713aSLionel Sambuc  NONAME_INTF5.i_noname = 4;
93*f4a2713aSLionel Sambuc  ivar_INTF6.i_INNER_INTF2 = 5;
94*f4a2713aSLionel Sambuc  ivar_INTF7.i_INNER_INTF2 = 5;
95*f4a2713aSLionel Sambuc  X1.i = X2.i = X3.i = 1;
96*f4a2713aSLionel Sambuc}
97*f4a2713aSLionel Sambuc@end
98*f4a2713aSLionel Sambuc
99