// 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
// Ensure that XML we generate is not invalid.
// RUN: FileCheck %s -check-prefix=WRONG < %t/out
// 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;
};
// CHECK: class Test {}
// CHECK: Test() : reserved(new Test::data())
// CHECK: unsigned int getID() const
// CHECK: ~Test()
// CHECK: Test::data *reserved
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 friend void TemplateFriend();
/**
* \brief Eee
*/
template friend class TemplateFriendClass;
};
// CHECK: friend class Test
// CHECK: friend void foo()
// CHECK: friend int int_func()
// CHECK: friend bool operator==(const Test &, const Test &)
// CHECK: friend template <typename T> void TemplateFriend()
// CHECK: friend template <typename T> class TemplateFriendClass
namespace test0 {
namespace ns {
void f(int);
}
struct A {
/**
* \brief Fff
*/
friend void ns::f(int a);
};
}
// CHECK: friend void f(int a)
namespace test1 {
template struct Outer {
void foo(T);
struct Inner {
/**
* \brief Ggg
*/
friend void Outer::foo(T);
};
};
}
// CHECK: friend void foo(T)
namespace test2 {
namespace foo {
void Func(int x);
}
class Bar {
/**
* \brief Hhh
*/
friend void ::test2::foo::Func(int x);
};
}
// CHECK: friend void Func(int x)
namespace test3 {
template class vector {
public:
vector(int i) {}
/**
* \brief Iii
*/
void f(const T& t = T()) {}
};
class A {
private:
/**
* \brief Jjj
*/
friend void vector::f(const A&);
};
}
// CHECK: void f(const T &t = T())
// CHECK: friend void f(const test3::A &)
class MyClass
{
/**
* \brief plain friend test.
*/
friend class MyClass;
};
// CHECK: friend class MyClass
template class valarray
{
private:
/**
* \brief template friend test.
*/
template friend class valarray;
};
// CHECK: template <class T> class valarray
// CHECK: friend template <class T> class valarray
class gslice
{
valarray __size_;
};