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