Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Rewriter / rewrite-cast-ivar-access.mm
blob37ed7b3c1c876fd39b85ab0d0e9186bb22f6e392
1 // RUN: %clang_cc1 -x objective-c++ -fblocks -fms-extensions -rewrite-objc -fobjc-runtime=macosx-fragile-10.5 %s -o %t-rw.cpp
2 // RUN: FileCheck -check-prefix CHECK-LP --input-file=%t-rw.cpp %s
4 @interface F {
5   int supervar;
7 @end
9 @interface G : F {
10 @public
11   int ivar;
13 @end
15 @implementation G
16 - (void)foo:(F *)arg {
17         int q = arg->supervar;
18         int v = ((G *)arg)->ivar;
20 @end
22 void objc_assign_strongCast(id);
23 void __CFAssignWithWriteBarrier(void **location, void *value) {
24         objc_assign_strongCast((id)value);
27 @interface RealClass {
28         @public
29         int f;
31 @end
33 @implementation RealClass
34 @end
36 @interface Foo {
37         id reserved;
39 @end
41 @implementation Foo
42 - (void)bar {
43         ((RealClass*)reserved)->f = 99;
45 @end
47 // CHECK-LP: ((struct G_IMPL *)arg)->ivar
49 // CHECK-LP: objc_assign_strongCast((id)value)
51 // CHECK-LP: ((struct RealClass_IMPL *)((RealClass *)((struct Foo_IMPL *)self)->reserved))->f