comment-cplus-template-decls.cpp 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 std=c++11 %s > %t/out
  4. // RUN: FileCheck %s < %t/out
  5. // Ensure that XML we generate is not invalid.
  6. // RUN: FileCheck %s -check-prefix=WRONG < %t/out
  7. // WRONG-NOT: CommentXMLInvalid
  8. // rdar://12378714
  9. /**
  10. * \brief Aaa
  11. */
  12. template<typename T> struct A {
  13. /**
  14. * \brief Bbb
  15. */
  16. A();
  17. /**
  18. * \brief Ccc
  19. */
  20. ~A();
  21. /**
  22. * \brief Ddd
  23. */
  24. void f() { }
  25. };
  26. // CHECK: <Declaration>template &lt;typename T&gt; struct A {}</Declaration>
  27. // CHECK: <Declaration>A&lt;T&gt;()</Declaration>
  28. // CHECK: <Declaration>~A&lt;T&gt;()</Declaration>
  29. /**
  30. * \Brief Eee
  31. */
  32. template <typename T> struct D : A<T> {
  33. /**
  34. * \brief
  35. */
  36. using A<T>::f;
  37. void f();
  38. };
  39. // CHECK: <Declaration>template &lt;typename T&gt; struct D : A&lt;T&gt; {}</Declaration>
  40. // CHECK: <Declaration>using A&lt;T&gt;::f</Declaration>
  41. struct Base {
  42. int foo;
  43. };
  44. /**
  45. * \brief
  46. */
  47. template<typename T> struct E : Base {
  48. /**
  49. * \brief
  50. */
  51. using Base::foo;
  52. };
  53. // CHECK: <Declaration>template &lt;typename T&gt; struct E : Base {}</Declaration>
  54. // CHECK: <Declaration>using Base::foo</Declaration>
  55. /// \tparam
  56. /// \param AAA Blah blah
  57. template<typename T>
  58. void func_template_1(T AAA);
  59. // CHECK: <Declaration>template &lt;typename T&gt; void func_template_1(T AAA)</Declaration>
  60. template<template<template<typename CCC> class DDD, class BBB> class AAA>
  61. void func_template_2();
  62. // FIXME: There is not Declaration field in the generated output.
  63. namespace rdar16128173 {
  64. // CHECK: <Declaration>template &lt;class PtrTy&gt; class OpaquePtr {}</Declaration>
  65. /// \brief Wrapper for void* pointer.
  66. /// \tparam PtrTy Either a pointer type like 'T*' or a type that behaves like
  67. /// a pointer.
  68. template <class PtrTy>
  69. class OpaquePtr {};
  70. // CHECK: <Declaration>typedef OpaquePtr&lt;int&gt; DeclGroupPtrTy</Declaration>
  71. typedef OpaquePtr<int> DeclGroupPtrTy;
  72. DeclGroupPtrTy blah;
  73. }