Fariborz Jahanian | 482b4fd | 2012-12-04 00:47:33 +0000 | [diff] [blame] | 1 | // RUN: rm -rf %t |
| 2 | // RUN: mkdir %t |
NAKAMURA Takumi | 60ef8b7 | 2012-12-04 01:03:31 +0000 | [diff] [blame] | 3 | // RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 %s > %t/out |
Fariborz Jahanian | 482b4fd | 2012-12-04 00:47:33 +0000 | [diff] [blame] | 4 | // RUN: FileCheck %s < %t/out |
| 5 | |
| 6 | // Ensure that XML we generate is not invalid. |
| 7 | // RUN: FileCheck %s -check-prefix=WRONG < %t/out |
| 8 | // WRONG-NOT: CommentXMLInvalid |
| 9 | |
| 10 | // rdar://12378714 |
| 11 | |
| 12 | /** |
| 13 | * \brief This is a protocol definition |
| 14 | */ |
| 15 | @protocol MyProto |
| 16 | @optional |
| 17 | /** |
| 18 | * \brief MethodMyProto method |
| 19 | * \param[in] anObject input value |
| 20 | * \param[in] range output value is unsigned int |
| 21 | * \result return index |
| 22 | */ |
| 23 | - (unsigned int)MethodMyProto:(id)anObject inRange:(unsigned int)range; |
| 24 | /** |
| 25 | * \brief PropertyMyProto - This is protocol's property. |
| 26 | */ |
| 27 | @property (copy) id PropertyMyProto; |
| 28 | /** |
| 29 | * \brief ClassMethodMyProto |
| 30 | */ |
| 31 | + ClassMethodMyProto; |
| 32 | @end |
Nico Weber | 1abe6ea | 2013-01-09 21:15:03 +0000 | [diff] [blame] | 33 | // CHECK: <Declaration>@protocol MyProto\n@end</Declaration> |
Fariborz Jahanian | 154120c | 2012-12-20 19:54:13 +0000 | [diff] [blame] | 34 | // CHECK: <Declaration>- (unsigned int)MethodMyProto:(id)anObject inRange:(unsigned int)range;</Declaration> |
Nico Weber | b530fa3 | 2013-01-10 00:25:19 +0000 | [diff] [blame^] | 35 | // CHECK: <Declaration>@optional\n@property(readwrite, copy, atomic) id PropertyMyProto;</Declaration> |
Fariborz Jahanian | 154120c | 2012-12-20 19:54:13 +0000 | [diff] [blame] | 36 | // CHECK: <Declaration>+ (id)ClassMethodMyProto;</Declaration> |
Fariborz Jahanian | 482b4fd | 2012-12-04 00:47:33 +0000 | [diff] [blame] | 37 | |
| 38 | /** |
| 39 | * \brief NSObject is the root class. |
| 40 | */ |
| 41 | @interface NSObject { |
| 42 | /** |
| 43 | * \brief IvarNSObject |
| 44 | */ |
| 45 | id IvarNSObject; |
| 46 | } |
| 47 | @end |
Fariborz Jahanian | 154120c | 2012-12-20 19:54:13 +0000 | [diff] [blame] | 48 | // CHECK: Declaration>@interface NSObject {\n id IvarNSObject;\n}\n@end</Declaration> |
Fariborz Jahanian | 482b4fd | 2012-12-04 00:47:33 +0000 | [diff] [blame] | 49 | // CHECK: <Declaration>id IvarNSObject</Declaration> |
| 50 | |
| 51 | /** |
| 52 | * \brief MyClass - primary class. |
| 53 | */ |
| 54 | @interface MyClass : NSObject<MyProto> |
| 55 | { |
| 56 | /** |
| 57 | * \brief IvarMyClass - IvarMyClass of values. |
| 58 | */ |
| 59 | id IvarMyClass; |
| 60 | } |
| 61 | /** |
| 62 | * \brief MethodMyClass is instance method. |
| 63 | */ |
| 64 | - MethodMyClass; |
| 65 | |
| 66 | /** |
| 67 | * \brief ClassMethodMyClass is class method. |
| 68 | */ |
| 69 | + ClassMethodMyClass; |
| 70 | |
| 71 | /** |
| 72 | * \brief PropertyMyClass - This is class's property. |
| 73 | */ |
| 74 | @property (copy) id PropertyMyClass; |
| 75 | @end |
| 76 | // CHECK: <Declaration>@interface MyClass : NSObject<MyProto> {\n id IvarMyClass;\n}\n@end</Declaration> |
| 77 | // CHECK: <Declaration>id IvarMyClass</Declaration> |
Fariborz Jahanian | 154120c | 2012-12-20 19:54:13 +0000 | [diff] [blame] | 78 | // CHECK: <Declaration>- (id)MethodMyClass;</Declaration> |
| 79 | // CHECK: <Declaration>+ (id)ClassMethodMyClass;</Declaration> |
| 80 | // CHECK: <Declaration>@property(readwrite, copy, atomic) id PropertyMyClass;</Declaration |
Fariborz Jahanian | 482b4fd | 2012-12-04 00:47:33 +0000 | [diff] [blame] | 81 | |
| 82 | /** |
Fariborz Jahanian | c2ef5ad | 2012-12-04 18:25:34 +0000 | [diff] [blame] | 83 | * \brief - This is class extension of MyClass |
| 84 | */ |
| 85 | @interface MyClass() |
| 86 | { |
| 87 | /** |
| 88 | * \brief IvarMyClassExtension - IvarMyClassExtension private to class extension |
| 89 | */ |
| 90 | id IvarMyClassExtension; |
| 91 | } |
| 92 | @end |
Fariborz Jahanian | 154120c | 2012-12-20 19:54:13 +0000 | [diff] [blame] | 93 | // CHECK: <Declaration>@interface MyClass() {\n id IvarMyClassExtension;\n}\n@end</Declaration> |
Fariborz Jahanian | c2ef5ad | 2012-12-04 18:25:34 +0000 | [diff] [blame] | 94 | // CHECK: <Declaration>id IvarMyClassExtension</Declaration> |
| 95 | |
| 96 | |
| 97 | /** |
Fariborz Jahanian | 482b4fd | 2012-12-04 00:47:33 +0000 | [diff] [blame] | 98 | * \brief MyClass (Category) is private to MyClass. |
| 99 | */ |
| 100 | @interface MyClass (Category) |
| 101 | /** |
| 102 | * \brief This is private to MyClass |
| 103 | */ |
| 104 | - (void)MethodMyClassCategory; |
| 105 | |
| 106 | /** |
| 107 | * \brief PropertyMyClassCategory - This is class's private property. |
| 108 | */ |
| 109 | @property (copy) id PropertyMyClassCategory; |
| 110 | @end |
Nico Weber | fa49c18 | 2013-01-09 20:36:10 +0000 | [diff] [blame] | 111 | // CHECK: <Declaration>@interface MyClass(Category)\n@end</Declaration> |
Fariborz Jahanian | 154120c | 2012-12-20 19:54:13 +0000 | [diff] [blame] | 112 | // CHECK: <Declaration>- (void)MethodMyClassCategory;</Declaration> |
| 113 | // CHECK: <Declaration>@property(readwrite, copy, atomic) id PropertyMyClassCategory;</Declaration> |
| 114 | // CHECK: <Declaration>- (id)PropertyMyClassCategory;</Declaration> |
| 115 | // CHECK: <Declaration>- (void)setPropertyMyClassCategory:(id)arg;</Declaration> |
Fariborz Jahanian | 482b4fd | 2012-12-04 00:47:33 +0000 | [diff] [blame] | 116 | |
| 117 | /// @implementation's |
| 118 | |
| 119 | /** |
| 120 | * \brief implementation of MyClass class. |
| 121 | */ |
| 122 | @implementation MyClass { |
| 123 | /** |
| 124 | * \brief IvarPrivateToMyClassImpl. |
| 125 | */ |
| 126 | id IvarPrivateToMyClassImpl; |
| 127 | } |
| 128 | /** |
| 129 | * \brief MethodMyClass is instance method implementation. |
| 130 | */ |
| 131 | - MethodMyClass { |
| 132 | return 0; |
| 133 | } |
| 134 | |
| 135 | /** |
| 136 | * \brief ClassMethodMyClass is class method implementation. |
| 137 | */ |
| 138 | + ClassMethodMyClass { |
| 139 | return 0; |
| 140 | } |
| 141 | @end |
Fariborz Jahanian | 154120c | 2012-12-20 19:54:13 +0000 | [diff] [blame] | 142 | // CHECK: <Declaration>@implementation MyClass {\n id IvarPrivateToMyClassImpl;\n id _PropertyMyClass;\n}\n@end</Declaration> |
Fariborz Jahanian | 482b4fd | 2012-12-04 00:47:33 +0000 | [diff] [blame] | 143 | // CHECK: <Declaration>id IvarPrivateToMyClassImpl</Declaration> |
Fariborz Jahanian | 154120c | 2012-12-20 19:54:13 +0000 | [diff] [blame] | 144 | // CHECK: <Declaration>- (id)MethodMyClass;</Declaration> |
| 145 | // CHECK: <Declaration>+ (id)ClassMethodMyClass;</Declaration> |
Fariborz Jahanian | 482b4fd | 2012-12-04 00:47:33 +0000 | [diff] [blame] | 146 | |
| 147 | /** |
| 148 | * \brief MyClass (Category) is implementation of private to MyClass. |
| 149 | */ |
| 150 | @implementation MyClass (Category) |
| 151 | /** |
| 152 | * \brief This is private to MyClass |
| 153 | */ |
| 154 | - (void)MethodMyClassCategory {} |
| 155 | /** |
| 156 | * \brief property getter |
| 157 | */ |
| 158 | - (id) PropertyMyClassCategory { return 0; } |
| 159 | |
| 160 | /** |
| 161 | * \brief property setter |
| 162 | */ |
| 163 | - (void) setPropertyMyClassCategory : (id) arg {} |
| 164 | @end |
Nico Weber | 50767d8 | 2013-01-09 23:25:37 +0000 | [diff] [blame] | 165 | // CHECK: <Declaration>@implementation MyClass(Category)\n@end</Declaration> |
Fariborz Jahanian | 154120c | 2012-12-20 19:54:13 +0000 | [diff] [blame] | 166 | // CHECK: <Declaration>- (void)MethodMyClassCategory;</Declaration> |
| 167 | // CHECK: <Declaration>- (id)PropertyMyClassCategory;</Declaration> |
| 168 | // CHECK: <Declaration>- (void)setPropertyMyClassCategory:(id)arg;</Declaration> |
Fariborz Jahanian | 482b4fd | 2012-12-04 00:47:33 +0000 | [diff] [blame] | 169 | |
| 170 | /** |
| 171 | * \brief NSObject implementation |
| 172 | */ |
| 173 | @implementation NSObject |
| 174 | @end |
Nico Weber | 50767d8 | 2013-01-09 23:25:37 +0000 | [diff] [blame] | 175 | // CHECK: <Declaration>@implementation NSObject\n@end</Declaration> |