• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Test without serialization:
2// RUN: %clang_cc1 -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 \
3// RUN: -ast-dump -ast-dump-filter Test %s \
4// RUN: | FileCheck --strict-whitespace %s
5//
6// Test with serialization:
7// RUN: %clang_cc1 -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 \
8// RUN: -emit-pch -o %t %s
9// RUN: %clang_cc1 -x objective-c -fdouble-square-bracket-attributes -triple x86_64-apple-macosx10.10.0 \
10// RUN: -include-pch %t -ast-dump-all -ast-dump-filter Test /dev/null \
11// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
12// RUN: | FileCheck --strict-whitespace %s
13
14@interface NSObject
15@end
16
17[[clang::objc_exception]]
18@interface Test1 {
19// CHECK: ObjCInterfaceDecl{{.*}} Test1
20// CHECK-NEXT: ObjCExceptionAttr{{.*}}
21  [[clang::iboutlet]] NSObject *Test2;
22// CHECK: ObjCIvarDecl{{.*}} Test2
23// CHECK-NEXT: IBOutletAttr
24}
25@property (readonly) [[clang::objc_returns_inner_pointer]] void *Test3, *Test4;
26// CHECK: ObjCPropertyDecl{{.*}} Test3 'void *' readonly
27// CHECK-NEXT: ObjCReturnsInnerPointerAttr
28// CHECK-NEXT: ObjCPropertyDecl{{.*}} Test4 'void *' readonly
29// CHECK-NEXT: ObjCReturnsInnerPointerAttr
30
31@property (readonly) [[clang::iboutlet]] NSObject *Test5;
32// CHECK: ObjCPropertyDecl{{.*}} Test5 'NSObject *' readonly
33// CHECK-NEXT: IBOutletAttr
34
35// CHECK: ObjCMethodDecl{{.*}} implicit{{.*}} Test3
36// CHECK-NEXT: ObjCReturnsInnerPointerAttr
37// CHECK: ObjCMethodDecl{{.*}} implicit{{.*}} Test4
38// CHECK-NEXT: ObjCReturnsInnerPointerAttr
39// CHECK: ObjCMethodDecl{{.*}} implicit{{.*}} Test5
40// CHECK-NOT: IBOutletAttr
41@end
42
43[[clang::objc_runtime_name("name")]] @protocol Test6;
44// CHECK: ObjCProtocolDecl{{.*}} Test6
45// CHECK-NEXT: ObjCRuntimeNameAttr{{.*}} "name"
46
47[[clang::objc_protocol_requires_explicit_implementation]]
48@protocol Test7
49// CHECK: ObjCProtocolDecl{{.*}} Test7
50// CHECK-NEXT: ObjCExplicitProtocolImplAttr
51@end
52
53@interface Test8
54// CHECK: ObjCInterfaceDecl{{.*}} Test8
55-(void)Test9 [[clang::ns_consumes_self]];
56// CHECK: ObjCMethodDecl{{.*}} Test9 'void'
57// CHECK-NEXT: NSConsumesSelfAttr
58-(void) [[clang::ns_consumes_self]] Test10: (int)Test11;
59// CHECK: ObjCMethodDecl{{.*}} Test10: 'void'
60// CHECK-NEXT: |-ParmVarDecl{{.*}} Test11 'int'
61// CHECK-NEXT: `-NSConsumesSelfAttr
62-(void)Test12: (int *) [[clang::noescape]] Test13  to:(int)Test14 [[clang::ns_consumes_self]];
63// CHECK: ObjCMethodDecl{{.*}} Test12:to: 'void'
64// CHECK-NEXT: |-ParmVarDecl{{.*}} Test13 'int *'
65// CHECK-NEXT: | `-NoEscapeAttr
66// CHECK-NEXT: |-ParmVarDecl{{.*}} Test14 'int'
67// CHECK-NEXT: `-NSConsumesSelfAttr
68@end
69