150
|
1 // Run lines are sensitive to line numbers and come below the code.
|
|
2
|
|
3 #ifndef HEADER
|
|
4 #define HEADER
|
|
5
|
|
6 /// Comment for 'functionBeforeImports'.
|
|
7 void functionBeforeImports(void);
|
|
8
|
|
9 #import <DocCommentsA/DocCommentsA.h>
|
|
10 #import <DocCommentsB/DocCommentsB.h>
|
|
11
|
|
12 @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 // rdar://14348912
|
|
37 // Check that we attach comments to enums declared using the NS_ENUM macro.
|
|
38 //===---
|
|
39
|
|
40 #define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
|
|
41
|
|
42 /// An_NS_ENUM_isdoxy1 IS_DOXYGEN_SINGLE
|
|
43 typedef NS_ENUM(int, An_NS_ENUM_isdoxy1) { Red, Green, Blue };
|
|
44
|
|
45 // In the implementation of attaching comments to enums declared using the
|
|
46 // NS_ENUM macro, it is tempting to use the fact that enum decl is embedded in
|
|
47 // the typedef. Make sure that the heuristic is strong enough that it does not
|
|
48 // attach unrelated comments in the following cases where tag decls are
|
|
49 // embedded in declarators.
|
|
50
|
|
51 #define DECLARE_FUNCTION() \
|
|
52 void functionFromMacro() { \
|
|
53 typedef struct Struct_notdoxy Struct_notdoxy; \
|
|
54 }
|
|
55
|
|
56 /// IS_DOXYGEN_NOT_ATTACHED
|
|
57 DECLARE_FUNCTION()
|
|
58
|
|
59 /// typedef_isdoxy1 IS_DOXYGEN_SINGLE
|
|
60 typedef struct Struct_notdoxy *typedef_isdoxy1;
|
|
61
|
|
62 #endif
|
|
63
|
|
64 // RUN: rm -rf %t
|
|
65 // RUN: mkdir %t
|
|
66 // RUN: mkdir %t/module-cache
|
|
67
|
|
68 // Check that we serialize comment source locations properly.
|
|
69 // RUN: %clang_cc1 -emit-pch -o %t/out.pch -F %S/Inputs/Frameworks %s
|
|
70 // RUN: %clang_cc1 -include-pch %t/out.pch -F %S/Inputs/Frameworks -fsyntax-only %s
|
|
71
|
|
72 // RUN: c-index-test -write-pch %t/out.pch -F %S/Inputs/Frameworks %s
|
|
73 // 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
|
|
74 // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s -F %S/Inputs/Frameworks -fmodules -fmodules-cache-path=%t/module-cache > %t/out.c-index-modules
|
|
75 // RUN: c-index-test -test-load-tu %t/out.pch all -F %S/Inputs/Frameworks > %t/out.c-index-pch
|
|
76
|
|
77 // RUN: FileCheck %s -check-prefix=WRONG < %t/out.c-index-direct
|
|
78 // RUN: FileCheck %s -check-prefix=WRONG < %t/out.c-index-modules
|
|
79 // RUN: FileCheck %s -check-prefix=WRONG < %t/out.c-index-pch
|
|
80
|
|
81 // Declarations without Doxygen comments should not pick up some Doxygen comments.
|
|
82 // WRONG-NOT: notdoxy{{.*}}Comment=
|
|
83 // WRONG-NOT: test{{.*}}Comment=
|
|
84
|
|
85 // Non-Doxygen comments should not be attached to anything.
|
|
86 // WRONG-NOT: NOT_DOXYGEN
|
|
87
|
|
88 // Some Doxygen comments are not attached to anything.
|
|
89 // WRONG-NOT: IS_DOXYGEN_NOT_ATTACHED
|
|
90
|
|
91 // Ensure we don't pick up extra comments.
|
|
92 // WRONG-NOT: IS_DOXYGEN_START{{.*}}IS_DOXYGEN_START{{.*}}BriefComment=
|
|
93 // WRONG-NOT: IS_DOXYGEN_END{{.*}}IS_DOXYGEN_END{{.*}}BriefComment=
|
|
94 //
|
|
95 // Ensure that XML is not invalid
|
|
96 // WRONG-NOT: CommentXMLInvalid
|
|
97
|
|
98 // RUN: FileCheck %s < %t/out.c-index-direct
|
|
99 // RUN: FileCheck %s < %t/out.c-index-modules
|
|
100 // RUN: FileCheck %s < %t/out.c-index-pch
|
|
101
|
|
102 // These CHECK lines are not located near the code on purpose. This test
|
|
103 // checks that documentation comments are attached to declarations correctly.
|
|
104 // Adding a non-documentation comment with CHECK line between every two
|
|
105 // documentation comments will only test a single code path.
|
|
106 //
|
|
107 // CHECK-DAG: annotate-comments-objc.m:7:6: FunctionDecl=functionBeforeImports:{{.*}} BriefComment=[Comment for 'functionBeforeImports'.]
|
|
108 // CHECK-DAG: DocCommentsA.h:2:6: FunctionDecl=functionFromDocCommentsA1:{{.*}} BriefComment=[Comment for 'functionFromDocCommentsA1'.]
|
|
109 // CHECK-DAG: DocCommentsA.h:7:6: FunctionDecl=functionFromDocCommentsA2:{{.*}} BriefComment=[Comment for 'functionFromDocCommentsA2'.]
|
|
110 // CHECK-DAG: DocCommentsB.h:2:6: FunctionDecl=functionFromDocCommentsB1:{{.*}} BriefComment=[Comment for 'functionFromDocCommentsB1'.]
|
|
111 // CHECK-DAG: DocCommentsB.h:7:6: FunctionDecl=functionFromDocCommentsB2:{{.*}} BriefComment=[Comment for 'functionFromDocCommentsB2'.]
|
|
112 // CHECK-DAG: DocCommentsC.h:2:6: FunctionDecl=functionFromDocCommentsC:{{.*}} BriefComment=[Comment for 'functionFromDocCommentsC'.]
|
|
113 // CHECK: annotate-comments-objc.m:23:50: ObjCPropertyDecl=property1_isdoxy1:{{.*}} property1_isdoxy1 IS_DOXYGEN_SINGLE
|
|
114 // CHECK: annotate-comments-objc.m:24:50: ObjCPropertyDecl=property1_isdoxy2:{{.*}} property1_isdoxy2 IS_DOXYGEN_SINGLE
|
|
115 // CHECK: annotate-comments-objc.m:25:50: ObjCPropertyDecl=property1_isdoxy3:{{.*}} property1_isdoxy3 IS_DOXYGEN_SINGLE
|
|
116 // CHECK: annotate-comments-objc.m:26:50: ObjCPropertyDecl=property1_isdoxy4:{{.*}} property1_isdoxy4 IS_DOXYGEN_SINGLE
|
|
117 // CHECK: annotate-comments-objc.m:29:9: ObjCInstanceMethodDecl=method1_isdoxy1:{{.*}} method1_isdoxy1 IS_DOXYGEN_SINGLE
|
|
118 // CHECK: annotate-comments-objc.m:30:9: ObjCInstanceMethodDecl=method1_isdoxy2:{{.*}} method1_isdoxy2 IS_DOXYGEN_SINGLE
|
|
119 // CHECK: annotate-comments-objc.m:31:9: ObjCInstanceMethodDecl=method1_isdoxy3:{{.*}} method1_isdoxy3 IS_DOXYGEN_SINGLE
|
|
120 // CHECK: annotate-comments-objc.m:32:9: ObjCInstanceMethodDecl=method1_isdoxy4:{{.*}} method1_isdoxy4 IS_DOXYGEN_SINGLE
|
|
121 // CHECK: annotate-comments-objc.m:43:22: EnumDecl=An_NS_ENUM_isdoxy1:{{.*}} An_NS_ENUM_isdoxy1 IS_DOXYGEN_SINGLE
|
|
122 // CHECK: annotate-comments-objc.m:43:22: TypedefDecl=An_NS_ENUM_isdoxy1:{{.*}} An_NS_ENUM_isdoxy1 IS_DOXYGEN_SINGLE
|
|
123 // CHECK: annotate-comments-objc.m:43:22: EnumDecl=An_NS_ENUM_isdoxy1:{{.*}} An_NS_ENUM_isdoxy1 IS_DOXYGEN_SINGLE
|
|
124 // CHECK: annotate-comments-objc.m:60:32: TypedefDecl=typedef_isdoxy1:{{.*}} typedef_isdoxy1 IS_DOXYGEN_SINGLE
|
|
125
|