blob: 9f56cd8b1b8375a38478b893c2847c4181ea65e8 [file] [log] [blame]
Fariborz Jahanian33eb59a2012-02-24 18:17:50 +00001// 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
NAKAMURA Takumi9ff009f2012-05-01 10:52:06 +00004// 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
Fariborz Jahanian33eb59a2012-02-24 18:17:50 +00005
6struct 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
Fariborz Jahanian27fc81b2012-04-27 22:48:54 +000023
Fariborz Jahanian7cb2a1b2012-03-20 17:13:39 +000024// CHECK: return (*(struct S *)((char *)self + OBJC_IVAR_$_I$struct_ivar));
Fariborz Jahanian27fc81b2012-04-27 22:48:54 +000025
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;
Fariborz Jahanian8fba8942012-04-30 23:20:30 +000052// CHECK: (*(struct _S *)((char *)self + OBJC_IVAR_$_Foo$s)).x = 0;