brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · d6c64ea Raw
52 lines · plain
1// RUN: %clang_cc1 -E %s -o %t.mm2// RUN: %clang_cc1 -fblocks -rewrite-objc -fms-extensions %t.mm -o %t-rw.cpp 3// RUN: FileCheck --input-file=%t-rw.cpp %s4// 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.cpp5 6struct S {7    int i1;8    double d1;9    void (^block1)();10};11 12@interface I13{14  struct S struct_ivar;15 16  struct S *pstruct_ivar;17}18@end19 20@implementation I21- (struct S) dMeth{ return struct_ivar; }22@end23 24// CHECK: return (*(struct S *)((char *)self + OBJC_IVAR_$_I$struct_ivar));25 26@interface Foo{27    @protected 28    struct {29        int x:1;30        int y:1;31    } bar;32 33    struct _S {34        int x:1;35        int y:1;36    } s;37 38}39@end40@implementation Foo41- (void)x {42  bar.x = 0;43  bar.y = -1;44 45  s.x = 0;46  s.y = -1;47}48@end49 50// CHECK: (*(decltype(((Foo_IMPL *)0U)->bar) *)((char *)self + OBJC_IVAR_$_Foo$bar)).x = 0;51// CHECK: (*(struct _S *)((char *)self + OBJC_IVAR_$_Foo$s)).x = 0;52