brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.2 KiB · 5f09b60 Raw
165 lines · plain
1// Test without serialization:2// RUN: %clang_cc1 -Wno-unused -fblocks -ast-dump -ast-dump-filter Test %s \3// RUN: | FileCheck --strict-whitespace %s4//5// Test with serialization:6// RUN: %clang_cc1 -Wno-unused -fblocks -emit-pch -o %t %s7// RUN: %clang_cc1 -x objective-c -Wno-unused -fblocks -include-pch %t \8// RUN: -ast-dump-all -ast-dump-filter Test /dev/null \9// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \10// RUN: | FileCheck --strict-whitespace %s11 12@protocol P13@end14 15@interface A16@end17 18@interface TestObjCIvarDecl : A19@end20 21@implementation TestObjCIvarDecl {22  int varDefault;23  @private int varPrivate;24  @protected int varProtected;25  @public int varPublic;26  @package int varPackage;27}28@end29// CHECK:      ObjCImplementationDecl{{.*}} TestObjCIvarDecl30// CHECK-NEXT:   ObjCInterface{{.*}} 'TestObjCIvarDecl'31// CHECK-NEXT:   ObjCIvarDecl{{.*}} varDefault 'int' private32// CHECK-NEXT:   ObjCIvarDecl{{.*}} varPrivate 'int' private33// CHECK-NEXT:   ObjCIvarDecl{{.*}} varProtected 'int' protected34// CHECK-NEXT:   ObjCIvarDecl{{.*}} varPublic 'int' public35// CHECK-NEXT:   ObjCIvarDecl{{.*}} varPackage 'int' package36 37@interface testObjCMethodDecl : A {38}39- (int) TestObjCMethodDecl: (int)i, ...;40// CHECK:      ObjCMethodDecl{{.*}} - TestObjCMethodDecl: 'int' variadic41// CHECK-NEXT:   ParmVarDecl{{.*}} i 'int'42@end43 44@implementation testObjCMethodDecl45- (int) TestObjCMethodDecl: (int)i, ... {46  return 0;47}48// CHECK:      ObjCMethodDecl{{.*}} - TestObjCMethodDecl: 'int' variadic49// CHECK-NEXT:   ImplicitParamDecl{{.*}} self50// CHECK-NEXT:   ImplicitParamDecl{{.*}} _cmd51// CHECK-NEXT:   ParmVarDecl{{.*}} i 'int'52// CHECK-NEXT:   CompoundStmt53@end54 55@protocol TestObjCProtocolDecl56- (void) foo;57@end58// CHECK:      ObjCProtocolDecl{{.*}} TestObjCProtocolDecl59// CHECK-NEXT:   ObjCMethodDecl{{.*}} foo60 61@interface TestObjCClass : A <P>62- (void) foo;63@end64// CHECK:      ObjCInterfaceDecl{{.*}} TestObjCClass65// CHECK-NEXT:   super ObjCInterface{{.*}} 'A'66// CHECK-NEXT:   ObjCImplementation{{.*}} 'TestObjCClass'67// CHECK-NEXT:   ObjCProtocol{{.*}} 'P'68// CHECK-NEXT:   ObjCMethodDecl{{.*}} foo69 70@implementation TestObjCClass : A {71  int i;72}73- (void) foo {74}75@end76// CHECK:      ObjCImplementationDecl{{.*}} TestObjCClass77// CHECK-NEXT:   super ObjCInterface{{.*}} 'A'78// CHECK-NEXT:   ObjCInterface{{.*}} 'TestObjCClass'79// CHECK-NEXT:   ObjCIvarDecl{{.*}} i80// CHECK-NEXT:   ObjCMethodDecl{{.*}} foo81 82@interface TestObjCClass (TestObjCCategoryDecl) <P>83- (void) bar;84@end85// CHECK:      ObjCCategoryDecl{{.*}} TestObjCCategoryDecl86// CHECK-NEXT:   ObjCInterface{{.*}} 'TestObjCClass'87// CHECK-NEXT:   ObjCCategoryImpl{{.*}} 'TestObjCCategoryDecl'88// CHECK-NEXT:   ObjCProtocol{{.*}} 'P'89// CHECK-NEXT:   ObjCMethodDecl{{.*}} bar90 91@interface TestGenericInterface<T> : A<P> {92}93@end94// CHECK:      ObjCInterfaceDecl{{.*}} TestGenericInterface95// CHECK-NEXT:   -super ObjCInterface {{.+}} 'A'96// CHECK-NEXT:   -ObjCProtocol {{.+}} 'P'97// CHECK-NEXT:   -ObjCTypeParamDecl {{.+}} <col:33> col:33 T 'id'98 99@implementation TestObjCClass (TestObjCCategoryDecl)100- (void) bar {101}102@end103// CHECK:      ObjCCategoryImplDecl{{.*}} TestObjCCategoryDecl104// CHECK-NEXT:   ObjCInterface{{.*}} 'TestObjCClass'105// CHECK-NEXT:   ObjCCategory{{.*}} 'TestObjCCategoryDecl'106// CHECK-NEXT:   ObjCMethodDecl{{.*}} bar107 108@compatibility_alias TestObjCCompatibleAliasDecl A;109// CHECK:      ObjCCompatibleAliasDecl{{.*}} TestObjCCompatibleAliasDecl110// CHECK-NEXT:   ObjCInterface{{.*}} 'A'111 112@interface TestObjCProperty: A113@property(getter=getterFoo, setter=setterFoo:) int foo;114@property int bar;115@end116// CHECK:      ObjCInterfaceDecl{{.*}} TestObjCProperty117// CHECK:        ObjCPropertyDecl{{.*}} foo 'int' assign readwrite atomic unsafe_unretained118// CHECK-NEXT:     getter ObjCMethod{{.*}} 'getterFoo'119// CHECK-NEXT:     setter ObjCMethod{{.*}} 'setterFoo:'120// CHECK-NEXT:   ObjCPropertyDecl{{.*}} bar 'int' assign readwrite atomic unsafe_unretained121// CHECK-NEXT:   ObjCMethodDecl{{.*}} getterFoo122// CHECK-NEXT:   ObjCMethodDecl{{.*}} setterFoo:123// CHECK-NEXT:     ParmVarDecl{{.*}} foo124// CHECK-NEXT:   ObjCMethodDecl{{.*}} bar125// CHECK-NEXT:   ObjCMethodDecl{{.*}} setBar:126// CHECK-NEXT:     ParmVarDecl{{.*}} bar127 128@implementation TestObjCProperty {129  int i;130}131@synthesize foo=i;132@synthesize bar;133@end134// CHECK:      ObjCImplementationDecl{{.*}} TestObjCProperty135// CHECK:        ObjCPropertyImplDecl{{.*}} foo synthesize136// CHECK-NEXT:     ObjCProperty{{.*}} 'foo'137// CHECK-NEXT:     ObjCIvar{{.*}} 'i' 'int'138// CHECK-NEXT:   ObjCIvarDecl{{.*}} bar 'int' synthesize private139// CHECK-NEXT:   ObjCPropertyImplDecl{{.*}} bar synthesize140// CHECK-NEXT:     ObjCProperty{{.*}} 'bar'141// CHECK-NEXT:     ObjCIvar{{.*}} 'bar' 'int'142 143void TestBlockDecl(int x) {144  ^(int y, ...){ x; };145  int z;146}147// CHECK:      FunctionDecl{{.*}}TestBlockDecl148// CHECK:      BlockDecl {{.+}} <col:3, col:21> col:3 variadic149// CHECK-NEXT:   ParmVarDecl{{.*}} y 'int'150// CHECK-NEXT:   capture ParmVar{{.*}} 'x' 'int'151// CHECK-NEXT:   CompoundStmt152// CHECK-NEXT:     ImplicitCastExpr153// CHECK-NEXT:       DeclRefExpr{{.*}} 'x'154// CHECK-NEXT: DeclStmt155// CHECK-NEXT:   VarDecl{{.*}} z156 157@interface B158+ (int) foo;159@end160 161void f(void) {162  __typeof__(B.foo) Test;163}164// CHECK: VarDecl{{.*}}Test 'typeof (B.foo)':'int'165