// 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
// Test to search overridden methods for documentation when overriding method has none. rdar://12378793
// Ensure that XML we generate is not invalid.
// RUN: FileCheck %s -check-prefix=WRONG < %t/out
// WRONG-NOT: CommentXMLInvalid
@protocol P
- (void)METH:(id)PPP;
@end
@interface Root
/**
* \param[in] AAA ZZZ
*/
- (void)METH:(id)AAA;
@end
// CHECK: FullCommentAsXML=[METH:c:objc(cs)Root(im)METH:- (void)METH:(id)AAA;AAA0in ZZZ]
@interface Sub : Root
@end
@interface Sub (CAT)
- (void)METH:(id)BBB;
@end
// CHECK: FullCommentAsXML=[METH:c:objc(cs)Root(im)METH:- (void)METH:(id)BBB;BBB0in ZZZ]
@implementation Sub(CAT)
- (void)METH:(id)III {}
@end
// CHECK: FullCommentAsXML=[METH:c:objc(cs)Root(im)METH:- (void)METH:(id)III;III0in ZZZ]
@interface Redec : Root
@end
@interface Redec()
/**
* \param[in] AAA input value
* \param[out] CCC output value is int
* \param[in] BBB 2nd input value is double
*/
- (void)EXT_METH:(id)AAA : (double)BBB : (int)CCC;
@end
// CHECK: FullCommentAsXML=[EXT_METH:::c:objc(cs)Redec(im)EXT_METH:::- (void)EXT_METH:(id)AAA:(double)BBB:(int)CCC;AAA0in input value BBB1in 2nd input value is doubleCCC2out output value is int ]
@implementation Redec
- (void)EXT_METH:(id)PPP : (double)QQQ : (int)RRR {}
@end
// CHECK: FullCommentAsXML=[EXT_METH:::c:objc(cs)Redec(im)EXT_METH:::- (void)EXT_METH:(id)PPP:(double)QQQ:(int)RRR;PPP0in input value QQQ1in 2nd input value is doubleRRR2out output value is int ]
struct Base {
/// \brief Does something.
/// \param AAA argument to foo_pure.
virtual void foo_pure(int AAA) = 0;
// CHECK: FullCommentAsXML=[foo_purec:@S@Base@F@foo_pure#I#virtual void foo_pure(int AAA) = 0 Does something. AAA0in argument to foo_pure.]
/// \brief Does something.
/// \param BBB argument to defined virtual.
virtual void foo_inline(int BBB) {}
// CHECK: FullCommentAsXML=[foo_inlinec:@S@Base@F@foo_inline#I#virtual void foo_inline(int BBB) Does something. BBB0in argument to defined virtual.]
/// \brief Does something.
/// \param CCC argument to undefined virtual.
virtual void foo_outofline(int CCC);
// CHECK: FullCommentAsXML=[foo_outoflinec:@S@Base@F@foo_outofline#I#virtual void foo_outofline(int CCC) Does something. CCC0in argument to undefined virtual.]
};
void Base::foo_outofline(int RRR) {}
// CHECK: FullCommentAsXML=[foo_outoflinec:@S@Base@F@foo_outofline#I#void Base::foo_outofline(int RRR) Does something. RRR0in argument to undefined virtual.]
struct Derived : public Base {
virtual void foo_pure(int PPP);
// CHECK: FullCommentAsXML=[foo_purec:@S@Base@F@foo_pure#I#virtual void foo_pure(int PPP) Does something. PPP0in argument to foo_pure.]
virtual void foo_inline(int QQQ) {}
// CHECK: FullCommentAsXML=[foo_inlinec:@S@Base@F@foo_inline#I#virtual void foo_inline(int QQQ) Does something. QQQ0in argument to defined virtual.]
};
/// \brief Does something.
/// \param DDD a value.
void foo(int DDD);
// CHECK: FullCommentAsXML=[fooc:@F@foo#I#void foo(int DDD) Does something. DDD0in a value.]
void foo(int SSS) {}
// CHECK: FullCommentAsXML=[fooc:@F@foo#I#void foo(int SSS) Does something. SSS0in a value.]
/// \brief Does something.
/// \param EEE argument to function decl.
void foo1(int EEE);
// CHECK: FullCommentAsXML=[foo1c:@F@foo1#I#void foo1(int EEE) Does something. EEE0in argument to function decl.]
void foo1(int TTT);
// CHECK: FullCommentAsXML=[foo1c:@F@foo1#I#void foo1(int TTT) Does something. TTT0in argument to function decl.]
/// \brief Documentation
/// \tparam BBB The type, silly.
/// \tparam AAA The type, silly as well.
template
void foo(AAA, BBB);
// CHECK: FullCommentAsXML=[fooc:@FT@>2#T#Tfoo#t0.0#t0.1#v#template <typename AAA, typename BBB> void foo(AAA, BBB) Documentation AAA0 The type, silly as well.BBB1 The type, silly. ]
template
void foo(PPP, QQQ);
// CHECK: FullCommentAsXML=[fooc:@FT@>2#T#Tfoo#t0.0#t0.1#v#template <typename PPP, typename QQQ> void foo(PPP, QQQ) Documentation PPP0 The type, silly as well.QQQ1 The type, silly. ]