xref: /minix3/external/bsd/llvm/dist/clang/test/Index/annotate-comments-objc.m (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc// Run lines are sensitive to line numbers and come below the code.
2*f4a2713aSLionel Sambuc
3*f4a2713aSLionel Sambuc#ifndef HEADER
4*f4a2713aSLionel Sambuc#define HEADER
5*f4a2713aSLionel Sambuc
6*f4a2713aSLionel Sambuc@class NSString;
7*f4a2713aSLionel Sambuc
8*f4a2713aSLionel Sambuc//===---
9*f4a2713aSLionel Sambuc// rdar://14258334
10*f4a2713aSLionel Sambuc// Check that we attach comments to properties correctly.
11*f4a2713aSLionel Sambuc//===---
12*f4a2713aSLionel Sambuc
13*f4a2713aSLionel Sambuc@interface MyClass {
14*f4a2713aSLionel Sambuc}
15*f4a2713aSLionel Sambuc
16*f4a2713aSLionel Sambuc/// property1_isdoxy1 IS_DOXYGEN_SINGLE
17*f4a2713aSLionel Sambuc@property (nonatomic, copy, readwrite) NSString *property1_isdoxy1;
18*f4a2713aSLionel Sambuc@property (nonatomic, copy, readwrite) NSString *property1_isdoxy2; ///< property1_isdoxy2 IS_DOXYGEN_SINGLE
19*f4a2713aSLionel Sambuc@property (nonatomic, copy, readwrite) NSString *property1_isdoxy3; /**< property1_isdoxy3 IS_DOXYGEN_SINGLE */
20*f4a2713aSLionel Sambuc@property (nonatomic, copy, readwrite) NSString *property1_isdoxy4; /*!< property1_isdoxy4 IS_DOXYGEN_SINGLE */
21*f4a2713aSLionel Sambuc
22*f4a2713aSLionel Sambuc/// method1_isdoxy1 IS_DOXYGEN_SINGLE
23*f4a2713aSLionel Sambuc- (void)method1_isdoxy1;
24*f4a2713aSLionel Sambuc- (void)method1_isdoxy2; /*!< method1_isdoxy2 IS_DOXYGEN_SINGLE */
25*f4a2713aSLionel Sambuc- (void)method1_isdoxy3; /*!< method1_isdoxy3 IS_DOXYGEN_SINGLE */
26*f4a2713aSLionel Sambuc- (void)method1_isdoxy4; /*!< method1_isdoxy4 IS_DOXYGEN_SINGLE */
27*f4a2713aSLionel Sambuc@end
28*f4a2713aSLionel Sambuc
29*f4a2713aSLionel Sambuc
30*f4a2713aSLionel Sambuc#endif
31*f4a2713aSLionel Sambuc
32*f4a2713aSLionel Sambuc// RUN: rm -rf %t
33*f4a2713aSLionel Sambuc// RUN: mkdir %t
34*f4a2713aSLionel Sambuc
35*f4a2713aSLionel Sambuc// Check that we serialize comment source locations properly.
36*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -emit-pch -o %t/out.pch %s
37*f4a2713aSLionel Sambuc// RUN: %clang_cc1 -include-pch %t/out.pch -fsyntax-only %s
38*f4a2713aSLionel Sambuc
39*f4a2713aSLionel Sambuc// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s > %t/out.c-index-direct
40*f4a2713aSLionel Sambuc// RUN: c-index-test -test-load-tu %t/out.pch all > %t/out.c-index-pch
41*f4a2713aSLionel Sambuc
42*f4a2713aSLionel Sambuc// RUN: FileCheck %s -check-prefix=WRONG < %t/out.c-index-direct
43*f4a2713aSLionel Sambuc// RUN: FileCheck %s -check-prefix=WRONG < %t/out.c-index-pch
44*f4a2713aSLionel Sambuc
45*f4a2713aSLionel Sambuc// Declarations without Doxygen comments should not pick up some Doxygen comments.
46*f4a2713aSLionel Sambuc// WRONG-NOT: notdoxy{{.*}}Comment=
47*f4a2713aSLionel Sambuc// WRONG-NOT: test{{.*}}Comment=
48*f4a2713aSLionel Sambuc
49*f4a2713aSLionel Sambuc// Non-Doxygen comments should not be attached to anything.
50*f4a2713aSLionel Sambuc// WRONG-NOT: NOT_DOXYGEN
51*f4a2713aSLionel Sambuc
52*f4a2713aSLionel Sambuc// Some Doxygen comments are not attached to anything.
53*f4a2713aSLionel Sambuc// WRONG-NOT: IS_DOXYGEN_NOT_ATTACHED
54*f4a2713aSLionel Sambuc
55*f4a2713aSLionel Sambuc// Ensure we don't pick up extra comments.
56*f4a2713aSLionel Sambuc// WRONG-NOT: IS_DOXYGEN_START{{.*}}IS_DOXYGEN_START{{.*}}BriefComment=
57*f4a2713aSLionel Sambuc// WRONG-NOT: IS_DOXYGEN_END{{.*}}IS_DOXYGEN_END{{.*}}BriefComment=
58*f4a2713aSLionel Sambuc//
59*f4a2713aSLionel Sambuc// Ensure that XML is not invalid
60*f4a2713aSLionel Sambuc// WRONG-NOT: CommentXMLInvalid
61*f4a2713aSLionel Sambuc
62*f4a2713aSLionel Sambuc// RUN: FileCheck %s < %t/out.c-index-direct
63*f4a2713aSLionel Sambuc// RUN: FileCheck %s < %t/out.c-index-pch
64*f4a2713aSLionel Sambuc
65*f4a2713aSLionel Sambuc// These CHECK lines are not located near the code on purpose.  This test
66*f4a2713aSLionel Sambuc// checks that documentation comments are attached to declarations correctly.
67*f4a2713aSLionel Sambuc// Adding a non-documentation comment with CHECK line between every two
68*f4a2713aSLionel Sambuc// documentation comments will only test a single code path.
69*f4a2713aSLionel Sambuc//
70*f4a2713aSLionel Sambuc// CHECK: annotate-comments-objc.m:17:50: ObjCPropertyDecl=property1_isdoxy1:{{.*}} property1_isdoxy1 IS_DOXYGEN_SINGLE
71*f4a2713aSLionel Sambuc// CHECK: annotate-comments-objc.m:18:50: ObjCPropertyDecl=property1_isdoxy2:{{.*}} property1_isdoxy2 IS_DOXYGEN_SINGLE
72*f4a2713aSLionel Sambuc// CHECK: annotate-comments-objc.m:19:50: ObjCPropertyDecl=property1_isdoxy3:{{.*}} property1_isdoxy3 IS_DOXYGEN_SINGLE
73*f4a2713aSLionel Sambuc// CHECK: annotate-comments-objc.m:20:50: ObjCPropertyDecl=property1_isdoxy4:{{.*}} property1_isdoxy4 IS_DOXYGEN_SINGLE
74*f4a2713aSLionel Sambuc// CHECK: annotate-comments-objc.m:23:9: ObjCInstanceMethodDecl=method1_isdoxy1:{{.*}} method1_isdoxy1 IS_DOXYGEN_SINGLE
75*f4a2713aSLionel Sambuc// CHECK: annotate-comments-objc.m:24:9: ObjCInstanceMethodDecl=method1_isdoxy2:{{.*}} method1_isdoxy2 IS_DOXYGEN_SINGLE
76*f4a2713aSLionel Sambuc// CHECK: annotate-comments-objc.m:25:9: ObjCInstanceMethodDecl=method1_isdoxy3:{{.*}} method1_isdoxy3 IS_DOXYGEN_SINGLE
77*f4a2713aSLionel Sambuc// CHECK: annotate-comments-objc.m:26:9: ObjCInstanceMethodDecl=method1_isdoxy4:{{.*}} method1_isdoxy4 IS_DOXYGEN_SINGLE
78*f4a2713aSLionel Sambuc
79