Home | History | Annotate | Download | only in Index
      1 // RUN: rm -rf %t
      2 // RUN: mkdir %t
      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
      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:(nullable id)anObject inRange:(unsigned int)range;
     24 /**
     25  * \brief PropertyMyProto - This is protocol's property.
     26 */
     27 @property (copy, nonnull) id PropertyMyProto;
     28 /**
     29  * \brief ClassMethodMyProto
     30 */
     31 + ClassMethodMyProto;
     32 @end
     33 // CHECK: <Declaration>@protocol MyProto\n@end</Declaration>
     34 // CHECK: <Declaration>- (unsigned int)MethodMyProto:(nullable id)anObject inRange:(unsigned int)range;</Declaration>
     35 // CHECK: <Declaration>@optional\n@property(readwrite, copy, atomic, nonnull) id PropertyMyProto;</Declaration>
     36 // CHECK: <Declaration>+ (id)ClassMethodMyProto;</Declaration>
     37 
     38 /**
     39  * \brief NSObject is the root class.
     40 */
     41 @interface NSObject {
     42 /**
     43  * \brief IvarNSObject
     44 */
     45   id IvarNSObject;
     46 }
     47 @end
     48 // CHECK: Declaration>@interface NSObject {\n  id IvarNSObject;\n}\n@end</Declaration>
     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 &lt;MyProto&gt; {\n    id IvarMyClass;\n}\n@end</Declaration>
     77 // CHECK: <Declaration>id IvarMyClass</Declaration>
     78 // CHECK: <Declaration>- (id)MethodMyClass;</Declaration>
     79 // CHECK: <Declaration>+ (id)ClassMethodMyClass;</Declaration>
     80 // CHECK: <Declaration>@property(readwrite, copy, atomic) id PropertyMyClass;</Declaration
     81 
     82 /**
     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
     93 // CHECK: <Declaration>@interface MyClass () {\n  id IvarMyClassExtension;\n}\n@end</Declaration>
     94 // CHECK: <Declaration>id IvarMyClassExtension</Declaration>
     95 
     96 
     97 /**
     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
    111 // CHECK: <Declaration>@interface MyClass (Category)\n@end</Declaration>
    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>
    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
    142 // CHECK: <Declaration>@implementation MyClass {\n  id IvarPrivateToMyClassImpl;\n  id _PropertyMyClass;\n}\n@end</Declaration>
    143 // CHECK: <Declaration>id IvarPrivateToMyClassImpl</Declaration>
    144 // CHECK: <Declaration>- (id)MethodMyClass;</Declaration>
    145 // CHECK: <Declaration>+ (id)ClassMethodMyClass;</Declaration>
    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
    165 // CHECK: <Declaration>@implementation MyClass (Category)\n@end</Declaration>
    166 // CHECK: <Declaration>- (void)MethodMyClassCategory;</Declaration>
    167 // CHECK: <Declaration>- (id)PropertyMyClassCategory;</Declaration>
    168 // CHECK: <Declaration>- (void)setPropertyMyClassCategory:(id)arg;</Declaration>
    169 
    170 /**
    171  * \brief NSObject implementation
    172 */
    173 @implementation NSObject
    174 @end
    175 // CHECK: <Declaration>@implementation NSObject\n@end</Declaration>
    176