From c72c57c9e9b69944e3e009cd5e209634839581d3 Mon Sep 17 00:00:00 2001 From: dim Date: Mon, 8 Apr 2013 18:45:10 +0000 Subject: Vendor import of clang trunk r178860: http://llvm.org/svn/llvm-project/cfe/trunk@178860 --- test/Index/comment-cplus-decls.cpp | 171 +++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 test/Index/comment-cplus-decls.cpp (limited to 'test/Index/comment-cplus-decls.cpp') diff --git a/test/Index/comment-cplus-decls.cpp b/test/Index/comment-cplus-decls.cpp new file mode 100644 index 0000000..de1c2c5 --- /dev/null +++ b/test/Index/comment-cplus-decls.cpp @@ -0,0 +1,171 @@ +// 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: void ~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_; +}; -- cgit v1.1