Dmitri Gribenko | 46dd39e | 2013-08-19 07:10:13 +0000 | [diff] [blame] | 1 | // Run lines are sensitive to line numbers and come below the code. |
| 2 | |
| 3 | #ifndef HEADER |
| 4 | #define HEADER |
| 5 | |
Dmitri Gribenko | 9ee0e30 | 2014-03-27 15:40:39 +0000 | [diff] [blame] | 6 | /// Comment for 'functionBeforeImports'. |
| 7 | void functionBeforeImports(void); |
| 8 | |
| 9 | #import <DocCommentsA/DocCommentsA.h> |
| 10 | #import <DocCommentsB/DocCommentsB.h> |
| 11 | |
Dmitri Gribenko | 46dd39e | 2013-08-19 07:10:13 +0000 | [diff] [blame] | 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 | #endif |
| 37 | |
| 38 | // RUN: rm -rf %t |
| 39 | // RUN: mkdir %t |
Dmitri Gribenko | abfa261 | 2014-03-27 16:15:30 +0000 | [diff] [blame^] | 40 | // RUN: mkdir %t/module-cache |
Dmitri Gribenko | 46dd39e | 2013-08-19 07:10:13 +0000 | [diff] [blame] | 41 | |
| 42 | // Check that we serialize comment source locations properly. |
Dmitri Gribenko | 9ee0e30 | 2014-03-27 15:40:39 +0000 | [diff] [blame] | 43 | // RUN: %clang_cc1 -emit-pch -o %t/out.pch -F %S/Inputs/Frameworks %s |
| 44 | // RUN: %clang_cc1 -include-pch %t/out.pch -F %S/Inputs/Frameworks -fsyntax-only %s |
Dmitri Gribenko | 46dd39e | 2013-08-19 07:10:13 +0000 | [diff] [blame] | 45 | |
Dmitri Gribenko | 9ee0e30 | 2014-03-27 15:40:39 +0000 | [diff] [blame] | 46 | // 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 |
Dmitri Gribenko | abfa261 | 2014-03-27 16:15:30 +0000 | [diff] [blame^] | 47 | // 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 |
Dmitri Gribenko | 9ee0e30 | 2014-03-27 15:40:39 +0000 | [diff] [blame] | 48 | // RUN: c-index-test -test-load-tu %t/out.pch all -F %S/Inputs/Frameworks > %t/out.c-index-pch |
Dmitri Gribenko | 46dd39e | 2013-08-19 07:10:13 +0000 | [diff] [blame] | 49 | |
| 50 | // RUN: FileCheck %s -check-prefix=WRONG < %t/out.c-index-direct |
Dmitri Gribenko | 9ee0e30 | 2014-03-27 15:40:39 +0000 | [diff] [blame] | 51 | // RUN: FileCheck %s -check-prefix=WRONG < %t/out.c-index-modules |
Dmitri Gribenko | 46dd39e | 2013-08-19 07:10:13 +0000 | [diff] [blame] | 52 | // RUN: FileCheck %s -check-prefix=WRONG < %t/out.c-index-pch |
| 53 | |
| 54 | // Declarations without Doxygen comments should not pick up some Doxygen comments. |
| 55 | // WRONG-NOT: notdoxy{{.*}}Comment= |
| 56 | // WRONG-NOT: test{{.*}}Comment= |
| 57 | |
| 58 | // Non-Doxygen comments should not be attached to anything. |
| 59 | // WRONG-NOT: NOT_DOXYGEN |
| 60 | |
| 61 | // Some Doxygen comments are not attached to anything. |
| 62 | // WRONG-NOT: IS_DOXYGEN_NOT_ATTACHED |
| 63 | |
| 64 | // Ensure we don't pick up extra comments. |
| 65 | // WRONG-NOT: IS_DOXYGEN_START{{.*}}IS_DOXYGEN_START{{.*}}BriefComment= |
| 66 | // WRONG-NOT: IS_DOXYGEN_END{{.*}}IS_DOXYGEN_END{{.*}}BriefComment= |
| 67 | // |
| 68 | // Ensure that XML is not invalid |
| 69 | // WRONG-NOT: CommentXMLInvalid |
| 70 | |
| 71 | // RUN: FileCheck %s < %t/out.c-index-direct |
Dmitri Gribenko | 9ee0e30 | 2014-03-27 15:40:39 +0000 | [diff] [blame] | 72 | // RUN: FileCheck %s < %t/out.c-index-modules |
Dmitri Gribenko | 46dd39e | 2013-08-19 07:10:13 +0000 | [diff] [blame] | 73 | // RUN: FileCheck %s < %t/out.c-index-pch |
| 74 | |
| 75 | // These CHECK lines are not located near the code on purpose. This test |
| 76 | // checks that documentation comments are attached to declarations correctly. |
| 77 | // Adding a non-documentation comment with CHECK line between every two |
| 78 | // documentation comments will only test a single code path. |
| 79 | // |
Dmitri Gribenko | 9ee0e30 | 2014-03-27 15:40:39 +0000 | [diff] [blame] | 80 | // CHECK-DAG: annotate-comments-objc.m:7:6: FunctionDecl=functionBeforeImports:{{.*}} BriefComment=[Comment for 'functionBeforeImports'.] |
| 81 | // CHECK-DAG: DocCommentsA.h:2:6: FunctionDecl=functionFromDocCommentsA1:{{.*}} BriefComment=[Comment for 'functionFromDocCommentsA1'.] |
| 82 | // CHECK-DAG: DocCommentsA.h:7:6: FunctionDecl=functionFromDocCommentsA2:{{.*}} BriefComment=[Comment for 'functionFromDocCommentsA2'.] |
| 83 | // CHECK-DAG: DocCommentsB.h:2:6: FunctionDecl=functionFromDocCommentsB1:{{.*}} BriefComment=[Comment for 'functionFromDocCommentsB1'.] |
| 84 | // CHECK-DAG: DocCommentsB.h:7:6: FunctionDecl=functionFromDocCommentsB2:{{.*}} BriefComment=[Comment for 'functionFromDocCommentsB2'.] |
| 85 | // CHECK-DAG: DocCommentsC.h:2:6: FunctionDecl=functionFromDocCommentsC:{{.*}} BriefComment=[Comment for 'functionFromDocCommentsC'.] |
| 86 | // CHECK: annotate-comments-objc.m:23:50: ObjCPropertyDecl=property1_isdoxy1:{{.*}} property1_isdoxy1 IS_DOXYGEN_SINGLE |
| 87 | // CHECK: annotate-comments-objc.m:24:50: ObjCPropertyDecl=property1_isdoxy2:{{.*}} property1_isdoxy2 IS_DOXYGEN_SINGLE |
| 88 | // CHECK: annotate-comments-objc.m:25:50: ObjCPropertyDecl=property1_isdoxy3:{{.*}} property1_isdoxy3 IS_DOXYGEN_SINGLE |
| 89 | // CHECK: annotate-comments-objc.m:26:50: ObjCPropertyDecl=property1_isdoxy4:{{.*}} property1_isdoxy4 IS_DOXYGEN_SINGLE |
| 90 | // CHECK: annotate-comments-objc.m:29:9: ObjCInstanceMethodDecl=method1_isdoxy1:{{.*}} method1_isdoxy1 IS_DOXYGEN_SINGLE |
| 91 | // CHECK: annotate-comments-objc.m:30:9: ObjCInstanceMethodDecl=method1_isdoxy2:{{.*}} method1_isdoxy2 IS_DOXYGEN_SINGLE |
| 92 | // CHECK: annotate-comments-objc.m:31:9: ObjCInstanceMethodDecl=method1_isdoxy3:{{.*}} method1_isdoxy3 IS_DOXYGEN_SINGLE |
| 93 | // CHECK: annotate-comments-objc.m:32:9: ObjCInstanceMethodDecl=method1_isdoxy4:{{.*}} method1_isdoxy4 IS_DOXYGEN_SINGLE |
Dmitri Gribenko | 46dd39e | 2013-08-19 07:10:13 +0000 | [diff] [blame] | 94 | |