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