diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2012-12-04 00:47:33 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2012-12-04 00:47:33 +0000 |
commit | 482b4fd1aabb880887f3982ae13fbbaadb0c7d8e (patch) | |
tree | 7f8f2f625d12c05aa9d5b5c3fcc797ace74daa79 /test/Index/comment-objc-decls.m | |
parent | cdeb7d57a4867c28e3e6a8c391cba6f13c781fa6 (diff) |
Testing objective-C declarations embedded in
<declaration> tag of Comment XML and fixed a
missing declaration of ivars private to @implementation
as result of the testing. // rdar://12378714
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@169193 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Index/comment-objc-decls.m')
-rw-r--r-- | test/Index/comment-objc-decls.m | 160 |
1 files changed, 160 insertions, 0 deletions
diff --git a/test/Index/comment-objc-decls.m b/test/Index/comment-objc-decls.m new file mode 100644 index 0000000000..ec989b2101 --- /dev/null +++ b/test/Index/comment-objc-decls.m @@ -0,0 +1,160 @@ +// RUN: rm -rf %t +// RUN: mkdir %t +// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng %s > %t/out +// RUN: FileCheck %s < %t/out + +// Ensure that XML we generate is not invalid. +// RUN: FileCheck %s -check-prefix=WRONG < %t/out +// WRONG-NOT: CommentXMLInvalid + +// rdar://12378714 + +/** + * \brief This is a protocol definition +*/ +@protocol MyProto +@optional +/** + * \brief MethodMyProto method + * \param[in] anObject input value + * \param[in] range output value is unsigned int + * \result return index + */ +- (unsigned int)MethodMyProto:(id)anObject inRange:(unsigned int)range; +/** + * \brief PropertyMyProto - This is protocol's property. +*/ +@property (copy) id PropertyMyProto; +/** + * \brief ClassMethodMyProto +*/ ++ ClassMethodMyProto; +@end +// CHECK: <Declaration>@protocol MyProto\n@end</Declaration> +// CHECK: <Declaration>- (unsigned int) MethodMyProto:(id)anObject inRange:(unsigned int)range</Declaration> +// CHECK: <Declaration>@optional\n@property ( readwrite,copy,atomic ) id PropertyMyProto</Declaration> +// CHECK: <Declaration>+ (id) ClassMethodMyProto</Declaration> + +/** + * \brief NSObject is the root class. +*/ +@interface NSObject { +/** + * \brief IvarNSObject +*/ + id IvarNSObject; +} +@end +// CHECK: Declaration>@interface NSObject{\n id IvarNSObject;\n}\n@end</Declaration> +// CHECK: <Declaration>id IvarNSObject</Declaration> + +/** + * \brief MyClass - primary class. +*/ +@interface MyClass : NSObject<MyProto> +{ +/** + * \brief IvarMyClass - IvarMyClass of values. +*/ + id IvarMyClass; +} +/** + * \brief MethodMyClass is instance method. +*/ +- MethodMyClass; + +/** + * \brief ClassMethodMyClass is class method. +*/ ++ ClassMethodMyClass; + +/** + * \brief PropertyMyClass - This is class's property. +*/ +@property (copy) id PropertyMyClass; +@end +// CHECK: <Declaration>@interface MyClass : NSObject<MyProto> {\n id IvarMyClass;\n}\n@end</Declaration> +// CHECK: <Declaration>id IvarMyClass</Declaration> +// CHECK: <Declaration>- (id) MethodMyClass</Declaration> +// CHECK: <Declaration>+ (id) ClassMethodMyClass</Declaration> +// CHECK: <Declaration>@property ( readwrite,copy,atomic ) id PropertyMyClass</Declaration + +/** + * \brief MyClass (Category) is private to MyClass. +*/ +@interface MyClass (Category) +/** + * \brief This is private to MyClass + */ +- (void)MethodMyClassCategory; + +/** + * \brief PropertyMyClassCategory - This is class's private property. +*/ +@property (copy) id PropertyMyClassCategory; +@end +// CHECK: <Declaration>@interface MyClass(Category)\n@end</Declaration> +// CHECK: <Declaration>- (void) MethodMyClassCategory</Declaration> +// CHECK: <Declaration>@property ( readwrite,copy,atomic ) id PropertyMyClassCategory</Declaration> +// CHECK: <Declaration>- (id) PropertyMyClassCategory</Declaration> +// CHECK: <Declaration>- (void) setPropertyMyClassCategory:(id)arg</Declaration> + +/// @implementation's + +/** + * \brief implementation of MyClass class. +*/ +@implementation MyClass { +/** + * \brief IvarPrivateToMyClassImpl. +*/ + id IvarPrivateToMyClassImpl; +} +/** + * \brief MethodMyClass is instance method implementation. +*/ +- MethodMyClass { + return 0; +} + +/** + * \brief ClassMethodMyClass is class method implementation. +*/ ++ ClassMethodMyClass { + return 0; +} +@end +// CHECK: <Declaration>@implementation MyClass{\n id IvarPrivateToMyClassImpl;\n id _PropertyMyClass;\n}\n@end</Declaration> +// CHECK: <Declaration>id IvarPrivateToMyClassImpl</Declaration> +// CHECK: <Declaration>- (id) MethodMyClass</Declaration> +// CHECK: <Declaration>+ (id) ClassMethodMyClass</Declaration> + +/** + * \brief MyClass (Category) is implementation of private to MyClass. +*/ +@implementation MyClass (Category) +/** + * \brief This is private to MyClass + */ +- (void)MethodMyClassCategory {} +/** + * \brief property getter +*/ +- (id) PropertyMyClassCategory { return 0; } + +/** + * \brief property setter +*/ +- (void) setPropertyMyClassCategory : (id) arg {} +@end +// CHECK: <Declaration>@implementation MyClass(Category)\n@end</Declaration> +// CHECK: <Declaration>- (void) MethodMyClassCategory</Declaration> +// CHECK: <Declaration>- (id) PropertyMyClassCategory</Declaration> +// CHECK: <Declaration>- (void) setPropertyMyClassCategory:(id)arg</Declaration> + +/** + * \brief NSObject implementation +*/ +@implementation NSObject +@end +// CHECK: <Declaration>@implementation NSObject@end</Declaration> |