2012-12-05 08:38:44 +08:00
|
|
|
// 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 -target x86_64-apple-darwin10 %s > %t/out
|
|
|
|
// RUN: FileCheck %s < %t/out
|
2017-02-14 01:56:30 +08:00
|
|
|
// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 -std=c++98 %s > %t/98
|
|
|
|
// RUN: FileCheck %s < %t/98
|
|
|
|
// RUN: c-index-test -test-load-source all -comments-xml-schema=%S/../../bindings/xml/comment-xml-schema.rng -target x86_64-apple-darwin10 -std=c++11 %s > %t/11
|
|
|
|
// RUN: FileCheck %s < %t/11
|
2012-12-05 08:38:44 +08:00
|
|
|
|
|
|
|
// Ensure that XML we generate is not invalid.
|
|
|
|
// RUN: FileCheck %s -check-prefix=WRONG < %t/out
|
2017-02-14 01:56:30 +08:00
|
|
|
// RUN: FileCheck %s -check-prefix=WRONG < %t/98
|
|
|
|
// RUN: FileCheck %s -check-prefix=WRONG < %t/11
|
2012-12-05 08:38:44 +08:00
|
|
|
// WRONG-NOT: CommentXMLInvalid
|
|
|
|
// rdar://12378714
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief plain c++ class
|
|
|
|
*/
|
|
|
|
class Test
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
/**
|
|
|
|
* \brief plain c++ constructor
|
|
|
|
*/
|
|
|
|
Test () : reserved (new data()) {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief plain c++ member function
|
|
|
|
*/
|
|
|
|
unsigned getID() const
|
|
|
|
{
|
|
|
|
return reserved->objectID;
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* \brief plain c++ destructor
|
|
|
|
*/
|
|
|
|
~Test () {}
|
|
|
|
protected:
|
|
|
|
struct data {
|
|
|
|
unsigned objectID;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* \brief plain c++ data field
|
|
|
|
*/
|
|
|
|
data* reserved;
|
|
|
|
};
|
2013-01-10 21:24:24 +08:00
|
|
|
// CHECK: <Declaration>class Test {}</Declaration>
|
2017-11-16 09:28:25 +08:00
|
|
|
// CHECK: <Declaration>Test()</Declaration>
|
2012-12-05 08:38:44 +08:00
|
|
|
// CHECK: <Declaration>unsigned int getID() const</Declaration>
|
2017-02-14 01:56:30 +08:00
|
|
|
// CHECK: <Declaration>~Test(){{( noexcept)?}}</Declaration>
|
2012-12-05 08:38:44 +08:00
|
|
|
// CHECK: <Declaration>Test::data *reserved</Declaration>
|
|
|
|
|
|
|
|
|
|
|
|
class S {
|
|
|
|
/**
|
|
|
|
* \brief Aaa
|
|
|
|
*/
|
|
|
|
friend class Test;
|
|
|
|
/**
|
|
|
|
* \brief Bbb
|
|
|
|
*/
|
|
|
|
friend void foo() {}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Ccc
|
|
|
|
*/
|
|
|
|
friend int int_func();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Ddd
|
|
|
|
*/
|
|
|
|
friend bool operator==(const Test &, const Test &);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Eee
|
|
|
|
*/
|
|
|
|
template <typename T> friend void TemplateFriend();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* \brief Eee
|
|
|
|
*/
|
|
|
|
template <typename T> friend class TemplateFriendClass;
|
|
|
|
|
|
|
|
};
|
2012-12-22 05:43:05 +08:00
|
|
|
// CHECK: <Declaration>friend class Test</Declaration>
|
2012-12-05 08:38:44 +08:00
|
|
|
// CHECK: <Declaration>friend void foo()</Declaration>
|
|
|
|
// CHECK: <Declaration>friend int int_func()</Declaration>
|
|
|
|
// CHECK: <Declaration>friend bool operator==(const Test &, const Test &)</Declaration>
|
|
|
|
// CHECK: <Declaration>friend template <typename T> void TemplateFriend()</Declaration>
|
|
|
|
// CHECK: <Declaration>friend template <typename T> class TemplateFriendClass</Declaration>
|
|
|
|
|
|
|
|
namespace test0 {
|
|
|
|
namespace ns {
|
|
|
|
void f(int);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct A {
|
|
|
|
/**
|
|
|
|
* \brief Fff
|
|
|
|
*/
|
|
|
|
friend void ns::f(int a);
|
|
|
|
};
|
|
|
|
}
|
2017-04-12 00:46:03 +08:00
|
|
|
// CHECK: <Declaration>friend void ns::f(int a)</Declaration>
|
2012-12-05 08:38:44 +08:00
|
|
|
|
|
|
|
namespace test1 {
|
|
|
|
template <class T> struct Outer {
|
|
|
|
void foo(T);
|
|
|
|
struct Inner {
|
|
|
|
/**
|
|
|
|
* \brief Ggg
|
|
|
|
*/
|
|
|
|
friend void Outer::foo(T);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
2017-04-12 00:46:03 +08:00
|
|
|
// CHECK: <Declaration>friend void Outer<T>::foo(T)</Declaration>
|
2012-12-05 08:38:44 +08:00
|
|
|
|
|
|
|
namespace test2 {
|
|
|
|
namespace foo {
|
|
|
|
void Func(int x);
|
|
|
|
}
|
|
|
|
|
|
|
|
class Bar {
|
|
|
|
/**
|
|
|
|
* \brief Hhh
|
|
|
|
*/
|
|
|
|
friend void ::test2::foo::Func(int x);
|
|
|
|
};
|
|
|
|
}
|
2017-04-12 00:46:03 +08:00
|
|
|
// CHECK: <Declaration>friend void ::test2::foo::Func(int x)</Declaration>
|
2012-12-05 08:38:44 +08:00
|
|
|
|
|
|
|
namespace test3 {
|
|
|
|
template<class T> class vector {
|
|
|
|
public:
|
|
|
|
vector(int i) {}
|
|
|
|
/**
|
|
|
|
* \brief Iii
|
|
|
|
*/
|
|
|
|
void f(const T& t = T()) {}
|
|
|
|
};
|
|
|
|
class A {
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* \brief Jjj
|
|
|
|
*/
|
|
|
|
friend void vector<A>::f(const A&);
|
|
|
|
};
|
|
|
|
}
|
|
|
|
// CHECK: <Declaration>void f(const T &t = T())</Declaration>
|
2017-04-12 00:46:03 +08:00
|
|
|
// CHECK: <Declaration>friend void vector<A>::f(const test3::A &)</Declaration>
|
2012-12-22 05:43:05 +08:00
|
|
|
|
|
|
|
class MyClass
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* \brief plain friend test.
|
|
|
|
*/
|
|
|
|
friend class MyClass;
|
|
|
|
};
|
|
|
|
// CHECK: <Declaration>friend class MyClass</Declaration>
|
|
|
|
|
|
|
|
template<class _Tp> class valarray
|
|
|
|
{
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* \brief template friend test.
|
|
|
|
*/
|
|
|
|
template <class T> friend class valarray;
|
|
|
|
};
|
2013-01-08 02:45:48 +08:00
|
|
|
// CHECK: <Declaration>template <class T> class valarray</Declaration>
|
2012-12-22 05:43:05 +08:00
|
|
|
// CHECK: <Declaration>friend template <class T> class valarray</Declaration>
|
|
|
|
|
|
|
|
class gslice
|
|
|
|
{
|
|
|
|
valarray<unsigned> __size_;
|
|
|
|
};
|