1 // RUN: %clang_cc1 -Wno-unused -fblocks -ast-dump -ast-dump-filter Test %s | FileCheck -strict-whitespace %s
9 @interface TestObjCIvarDecl : A
12 @implementation TestObjCIvarDecl {
14 @private int varPrivate;
15 @protected int varProtected;
16 @public int varPublic;
17 @package int varPackage;
20 // CHECK: ObjCImplementationDecl{{.*}} TestObjCIvarDecl
21 // CHECK-NEXT: ObjCInterface{{.*}} 'TestObjCIvarDecl'
22 // CHECK-NEXT: ObjCIvarDecl{{.*}} varDefault 'int' private
23 // CHECK-NEXT: ObjCIvarDecl{{.*}} varPrivate 'int' private
24 // CHECK-NEXT: ObjCIvarDecl{{.*}} varProtected 'int' protected
25 // CHECK-NEXT: ObjCIvarDecl{{.*}} varPublic 'int' public
26 // CHECK-NEXT: ObjCIvarDecl{{.*}} varPackage 'int' package
28 @interface testObjCMethodDecl : A {
30 - (int) TestObjCMethodDecl: (int)i, ...;
31 // CHECK: ObjCMethodDecl{{.*}} - TestObjCMethodDecl: 'int'
32 // CHECK-NEXT: ParmVarDecl{{.*}} i 'int'
36 @implementation testObjCMethodDecl
37 - (int) TestObjCMethodDecl: (int)i, ... {
40 // CHECK: ObjCMethodDecl{{.*}} - TestObjCMethodDecl: 'int'
41 // CHECK-NEXT: ImplicitParamDecl{{.*}} self
42 // CHECK-NEXT: ImplicitParamDecl{{.*}} _cmd
43 // CHECK-NEXT: ParmVarDecl{{.*}} i 'int'
45 // CHECK-NEXT: CompoundStmt
48 @protocol TestObjCProtocolDecl
51 // CHECK: ObjCProtocolDecl{{.*}} TestObjCProtocolDecl
52 // CHECK-NEXT: ObjCMethodDecl{{.*}} foo
54 @interface TestObjCClass : A <P>
57 // CHECK: ObjCInterfaceDecl{{.*}} TestObjCClass
58 // CHECK-NEXT: super ObjCInterface{{.*}} 'A'
59 // CHECK-NEXT: ObjCImplementation{{.*}} 'TestObjCClass'
60 // CHECK-NEXT: ObjCProtocol{{.*}} 'P'
61 // CHECK-NEXT: ObjCMethodDecl{{.*}} foo
63 @implementation TestObjCClass : A {
69 // CHECK: ObjCImplementationDecl{{.*}} TestObjCClass
70 // CHECK-NEXT: super ObjCInterface{{.*}} 'A'
71 // CHECK-NEXT: ObjCInterface{{.*}} 'TestObjCClass'
72 // CHECK-NEXT: ObjCIvarDecl{{.*}} i
73 // CHECK-NEXT: ObjCMethodDecl{{.*}} foo
75 @interface TestObjCClass (TestObjCCategoryDecl) <P>
78 // CHECK: ObjCCategoryDecl{{.*}} TestObjCCategoryDecl
79 // CHECK-NEXT: ObjCInterface{{.*}} 'TestObjCClass'
80 // CHECK-NEXT: ObjCCategoryImpl{{.*}} 'TestObjCCategoryDecl'
81 // CHECK-NEXT: ObjCProtocol{{.*}} 'P'
82 // CHECK-NEXT: ObjCMethodDecl{{.*}} bar
84 @interface TestGenericInterface<T> : A<P> {
87 // CHECK: ObjCInterfaceDecl{{.*}} TestGenericInterface
88 // CHECK-NEXT: -super ObjCInterface {{.+}} 'A'
89 // CHECK-NEXT: -ObjCProtocol {{.+}} 'P'
90 // CHECK-NEXT: -ObjCTypeParamDecl {{.+}} <col:33> col:33 T 'id':'id'
92 @implementation TestObjCClass (TestObjCCategoryDecl)
96 // CHECK: ObjCCategoryImplDecl{{.*}} TestObjCCategoryDecl
97 // CHECK-NEXT: ObjCInterface{{.*}} 'TestObjCClass'
98 // CHECK-NEXT: ObjCCategory{{.*}} 'TestObjCCategoryDecl'
99 // CHECK-NEXT: ObjCMethodDecl{{.*}} bar
101 @compatibility_alias TestObjCCompatibleAliasDecl A;
102 // CHECK: ObjCCompatibleAliasDecl{{.*}} TestObjCCompatibleAliasDecl
103 // CHECK-NEXT: ObjCInterface{{.*}} 'A'
105 @interface TestObjCProperty: A
106 @property(getter=getterFoo, setter=setterFoo:) int foo;
109 // CHECK: ObjCInterfaceDecl{{.*}} TestObjCProperty
110 // CHECK: ObjCPropertyDecl{{.*}} foo 'int' assign readwrite atomic unsafe_unretained
111 // CHECK-NEXT: getter ObjCMethod{{.*}} 'getterFoo'
112 // CHECK-NEXT: setter ObjCMethod{{.*}} 'setterFoo:'
113 // CHECK-NEXT: ObjCPropertyDecl{{.*}} bar 'int' assign readwrite atomic unsafe_unretained
114 // CHECK-NEXT: ObjCMethodDecl{{.*}} getterFoo
115 // CHECK-NEXT: ObjCMethodDecl{{.*}} setterFoo:
116 // CHECK-NEXT: ParmVarDecl{{.*}} foo
117 // CHECK-NEXT: ObjCMethodDecl{{.*}} bar
118 // CHECK-NEXT: ObjCMethodDecl{{.*}} setBar:
119 // CHECK-NEXT: ParmVarDecl{{.*}} bar
121 @implementation TestObjCProperty {
127 // CHECK: ObjCImplementationDecl{{.*}} TestObjCProperty
128 // CHECK: ObjCPropertyImplDecl{{.*}} foo synthesize
129 // CHECK-NEXT: ObjCProperty{{.*}} 'foo'
130 // CHECK-NEXT: ObjCIvar{{.*}} 'i' 'int'
131 // CHECK-NEXT: ObjCIvarDecl{{.*}} bar 'int' synthesize private
132 // CHECK-NEXT: ObjCPropertyImplDecl{{.*}} bar synthesize
133 // CHECK-NEXT: ObjCProperty{{.*}} 'bar'
134 // CHECK-NEXT: ObjCIvar{{.*}} 'bar' 'int'
136 void TestBlockDecl(int x) {
139 // CHECK: FunctionDecl{{.*}}TestBlockDecl
141 // CHECK-NEXT: ParmVarDecl{{.*}} y 'int'
143 // CHECK-NEXT: capture ParmVar{{.*}} 'x' 'int'
144 // CHECK-NEXT: CompoundStmt
151 __typeof__(B.foo) Test;
153 // CHECK: VarDecl{{.*}}Test 'typeof (B.foo)':'int'