diff options
Diffstat (limited to 'test/Rewriter/rewrite-modern-struct-ivar.mm')
-rw-r--r-- | test/Rewriter/rewrite-modern-struct-ivar.mm | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/test/Rewriter/rewrite-modern-struct-ivar.mm b/test/Rewriter/rewrite-modern-struct-ivar.mm index 09c02dffab..4a137aeff6 100644 --- a/test/Rewriter/rewrite-modern-struct-ivar.mm +++ b/test/Rewriter/rewrite-modern-struct-ivar.mm @@ -1,7 +1,7 @@ // 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 +// RUN: %clang_cc1 -fsyntax-only -Wno-address-of-temporary -Wno-c++11-narrowing -std=c++11 -D"Class=void*" -D"id=void*" -D"SEL=void*" -D"__declspec(X)=" %t-rw.cpp struct S { int i1; @@ -20,5 +20,33 @@ struct S { @implementation I - (struct S) dMeth{ return struct_ivar; } @end - + // CHECK: return (*(struct S *)((char *)self + OBJC_IVAR_$_I$struct_ivar)); + +// rdar://11323187 +@interface Foo{ + @protected + struct { + int x:1; + int y:1; + } bar; + + struct _S { + int x:1; + int y:1; + } s; + +} +@end +@implementation Foo +- (void)x { + bar.x = 0; + bar.y = 1; + + s.x = 0; + s.y = 1; +} +@end + +// CHECK: (*(decltype(((Foo_IMPL *)0U)->bar) *)((char *)self + OBJC_IVAR_$_Foo$bar)).x = 0; +// CHECK: (*(decltype(((Foo_IMPL *)0U)->s) *)((char *)self + OBJC_IVAR_$_Foo$s)).x = 0; |