etc/services - sync with NetBSD-8
[minix.git] / external / bsd / llvm / dist / clang / test / Index / comment-cplus-decls.cpp
blob002482ed0f35e3dcfa795d55f082bcc4466a700a
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
6 // Ensure that XML we generate is not invalid.
7 // RUN: FileCheck %s -check-prefix=WRONG < %t/out
8 // WRONG-NOT: CommentXMLInvalid
9 // rdar://12378714
11 /**
12 * \brief plain c++ class
14 class Test
16 public:
17 /**
18 * \brief plain c++ constructor
20 Test () : reserved (new data()) {}
22 /**
23 * \brief plain c++ member function
25 unsigned getID() const
27 return reserved->objectID;
29 /**
30 * \brief plain c++ destructor
32 ~Test () {}
33 protected:
34 struct data {
35 unsigned objectID;
37 /**
38 * \brief plain c++ data field
40 data* reserved;
42 // CHECK: <Declaration>class Test {}</Declaration>
43 // CHECK: <Declaration>Test() : reserved(new Test::data())</Declaration>
44 // CHECK: <Declaration>unsigned int getID() const</Declaration>
45 // CHECK: <Declaration>~Test()</Declaration>
46 // CHECK: <Declaration>Test::data *reserved</Declaration>
49 class S {
50 /**
51 * \brief Aaa
53 friend class Test;
54 /**
55 * \brief Bbb
57 friend void foo() {}
59 /**
60 * \brief Ccc
62 friend int int_func();
64 /**
65 * \brief Ddd
67 friend bool operator==(const Test &, const Test &);
69 /**
70 * \brief Eee
72 template <typename T> friend void TemplateFriend();
74 /**
75 * \brief Eee
77 template <typename T> friend class TemplateFriendClass;
80 // CHECK: <Declaration>friend class Test</Declaration>
81 // CHECK: <Declaration>friend void foo()</Declaration>
82 // CHECK: <Declaration>friend int int_func()</Declaration>
83 // CHECK: <Declaration>friend bool operator==(const Test &amp;, const Test &amp;)</Declaration>
84 // CHECK: <Declaration>friend template &lt;typename T&gt; void TemplateFriend()</Declaration>
85 // CHECK: <Declaration>friend template &lt;typename T&gt; class TemplateFriendClass</Declaration>
87 namespace test0 {
88 namespace ns {
89 void f(int);
92 struct A {
93 /**
94 * \brief Fff
96 friend void ns::f(int a);
99 // CHECK: <Declaration>friend void f(int a)</Declaration>
101 namespace test1 {
102 template <class T> struct Outer {
103 void foo(T);
104 struct Inner {
106 * \brief Ggg
108 friend void Outer::foo(T);
112 // CHECK: <Declaration>friend void foo(T)</Declaration>
114 namespace test2 {
115 namespace foo {
116 void Func(int x);
119 class Bar {
121 * \brief Hhh
123 friend void ::test2::foo::Func(int x);
126 // CHECK: <Declaration>friend void Func(int x)</Declaration>
128 namespace test3 {
129 template<class T> class vector {
130 public:
131 vector(int i) {}
133 * \brief Iii
135 void f(const T& t = T()) {}
137 class A {
138 private:
140 * \brief Jjj
142 friend void vector<A>::f(const A&);
145 // CHECK: <Declaration>void f(const T &amp;t = T())</Declaration>
146 // CHECK: <Declaration>friend void f(const test3::A &amp;)</Declaration>
148 class MyClass
151 * \brief plain friend test.
153 friend class MyClass;
155 // CHECK: <Declaration>friend class MyClass</Declaration>
157 template<class _Tp> class valarray
159 private:
161 * \brief template friend test.
163 template <class T> friend class valarray;
165 // CHECK: <Declaration>template &lt;class T&gt; class valarray</Declaration>
166 // CHECK: <Declaration>friend template &lt;class T&gt; class valarray</Declaration>
168 class gslice
170 valarray<unsigned> __size_;