blob: 600b6f907c73e7195ce8b9de2bd5fa45d4c113af [file] [log] [blame]
Dmitri Gribenko46dd39e2013-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
Dmitri Gribenko9ee0e302014-03-27 15:40:39 +00006/// Comment for 'functionBeforeImports'.
7void functionBeforeImports(void);
8
9#import <DocCommentsA/DocCommentsA.h>
10#import <DocCommentsB/DocCommentsB.h>
11
Dmitri Gribenko46dd39e2013-08-19 07:10:13 +000012@class NSString;
13
14//===---
15// rdar://14258334
16// Check that we attach comments to properties correctly.
17//===---
18
19@interface MyClass {
20}
21
22/// property1_isdoxy1 IS_DOXYGEN_SINGLE
23@property (nonatomic, copy, readwrite) NSString *property1_isdoxy1;
24@property (nonatomic, copy, readwrite) NSString *property1_isdoxy2; ///< property1_isdoxy2 IS_DOXYGEN_SINGLE
25@property (nonatomic, copy, readwrite) NSString *property1_isdoxy3; /**< property1_isdoxy3 IS_DOXYGEN_SINGLE */
26@property (nonatomic, copy, readwrite) NSString *property1_isdoxy4; /*!< property1_isdoxy4 IS_DOXYGEN_SINGLE */
27
28/// method1_isdoxy1 IS_DOXYGEN_SINGLE
29- (void)method1_isdoxy1;
30- (void)method1_isdoxy2; /*!< method1_isdoxy2 IS_DOXYGEN_SINGLE */
31- (void)method1_isdoxy3; /*!< method1_isdoxy3 IS_DOXYGEN_SINGLE */
32- (void)method1_isdoxy4; /*!< method1_isdoxy4 IS_DOXYGEN_SINGLE */
33@end
34
35
36#endif
37
38// RUN: rm -rf %t
39// RUN: mkdir %t
40
41// Check that we serialize comment source locations properly.
Dmitri Gribenko9ee0e302014-03-27 15:40:39 +000042// RUN: %clang_cc1 -emit-pch -o %t/out.pch -F %S/Inputs/Frameworks %s
43// RUN: %clang_cc1 -include-pch %t/out.pch -F %S/Inputs/Frameworks -fsyntax-only %s
Dmitri Gribenko46dd39e2013-08-19 07:10:13 +000044
Dmitri Gribenko9ee0e302014-03-27 15:40:39 +000045// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s -F %S/Inputs/Frameworks > %t/out.c-index-direct
46// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s -F %S/Inputs/Frameworks -fmodules > %t/out.c-index-modules
47// RUN: c-index-test -test-load-tu %t/out.pch all -F %S/Inputs/Frameworks > %t/out.c-index-pch
Dmitri Gribenko46dd39e2013-08-19 07:10:13 +000048
49// RUN: FileCheck %s -check-prefix=WRONG < %t/out.c-index-direct
Dmitri Gribenko9ee0e302014-03-27 15:40:39 +000050// RUN: FileCheck %s -check-prefix=WRONG < %t/out.c-index-modules
Dmitri Gribenko46dd39e2013-08-19 07:10:13 +000051// RUN: FileCheck %s -check-prefix=WRONG < %t/out.c-index-pch
52
53// Declarations without Doxygen comments should not pick up some Doxygen comments.
54// WRONG-NOT: notdoxy{{.*}}Comment=
55// WRONG-NOT: test{{.*}}Comment=
56
57// Non-Doxygen comments should not be attached to anything.
58// WRONG-NOT: NOT_DOXYGEN
59
60// Some Doxygen comments are not attached to anything.
61// WRONG-NOT: IS_DOXYGEN_NOT_ATTACHED
62
63// Ensure we don't pick up extra comments.
64// WRONG-NOT: IS_DOXYGEN_START{{.*}}IS_DOXYGEN_START{{.*}}BriefComment=
65// WRONG-NOT: IS_DOXYGEN_END{{.*}}IS_DOXYGEN_END{{.*}}BriefComment=
66//
67// Ensure that XML is not invalid
68// WRONG-NOT: CommentXMLInvalid
69
70// RUN: FileCheck %s < %t/out.c-index-direct
Dmitri Gribenko9ee0e302014-03-27 15:40:39 +000071// RUN: FileCheck %s < %t/out.c-index-modules
Dmitri Gribenko46dd39e2013-08-19 07:10:13 +000072// RUN: FileCheck %s < %t/out.c-index-pch
73
74// These CHECK lines are not located near the code on purpose. This test
75// checks that documentation comments are attached to declarations correctly.
76// Adding a non-documentation comment with CHECK line between every two
77// documentation comments will only test a single code path.
78//
Dmitri Gribenko9ee0e302014-03-27 15:40:39 +000079// CHECK-DAG: annotate-comments-objc.m:7:6: FunctionDecl=functionBeforeImports:{{.*}} BriefComment=[Comment for 'functionBeforeImports'.]
80// CHECK-DAG: DocCommentsA.h:2:6: FunctionDecl=functionFromDocCommentsA1:{{.*}} BriefComment=[Comment for 'functionFromDocCommentsA1'.]
81// CHECK-DAG: DocCommentsA.h:7:6: FunctionDecl=functionFromDocCommentsA2:{{.*}} BriefComment=[Comment for 'functionFromDocCommentsA2'.]
82// CHECK-DAG: DocCommentsB.h:2:6: FunctionDecl=functionFromDocCommentsB1:{{.*}} BriefComment=[Comment for 'functionFromDocCommentsB1'.]
83// CHECK-DAG: DocCommentsB.h:7:6: FunctionDecl=functionFromDocCommentsB2:{{.*}} BriefComment=[Comment for 'functionFromDocCommentsB2'.]
84// CHECK-DAG: DocCommentsC.h:2:6: FunctionDecl=functionFromDocCommentsC:{{.*}} BriefComment=[Comment for 'functionFromDocCommentsC'.]
85// CHECK: annotate-comments-objc.m:23:50: ObjCPropertyDecl=property1_isdoxy1:{{.*}} property1_isdoxy1 IS_DOXYGEN_SINGLE
86// CHECK: annotate-comments-objc.m:24:50: ObjCPropertyDecl=property1_isdoxy2:{{.*}} property1_isdoxy2 IS_DOXYGEN_SINGLE
87// CHECK: annotate-comments-objc.m:25:50: ObjCPropertyDecl=property1_isdoxy3:{{.*}} property1_isdoxy3 IS_DOXYGEN_SINGLE
88// CHECK: annotate-comments-objc.m:26:50: ObjCPropertyDecl=property1_isdoxy4:{{.*}} property1_isdoxy4 IS_DOXYGEN_SINGLE
89// CHECK: annotate-comments-objc.m:29:9: ObjCInstanceMethodDecl=method1_isdoxy1:{{.*}} method1_isdoxy1 IS_DOXYGEN_SINGLE
90// CHECK: annotate-comments-objc.m:30:9: ObjCInstanceMethodDecl=method1_isdoxy2:{{.*}} method1_isdoxy2 IS_DOXYGEN_SINGLE
91// CHECK: annotate-comments-objc.m:31:9: ObjCInstanceMethodDecl=method1_isdoxy3:{{.*}} method1_isdoxy3 IS_DOXYGEN_SINGLE
92// CHECK: annotate-comments-objc.m:32:9: ObjCInstanceMethodDecl=method1_isdoxy4:{{.*}} method1_isdoxy4 IS_DOXYGEN_SINGLE
Dmitri Gribenko46dd39e2013-08-19 07:10:13 +000093