aboutsummaryrefslogtreecommitdiff
path: root/test/Misc/ast-print-out-of-line-func.cpp
blob: 7d42f1f4037fe7184ebe2c56a8f699e16084c891 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// RUN: %clang_cc1 -ast-print -std=c++14 %s | FileCheck %s

namespace ns {

struct Wrapper {
class Inner {
  Inner();
  Inner(int);
  ~Inner();

  void operator += (int);

  template<typename T>
  void member();

  static void staticMember();

  operator int();

  operator ns::Wrapper();
  // CHECK: operator ns::Wrapper()
};
};

Wrapper::Inner::Inner() { }
// CHECK: Wrapper::Inner::Inner()

void Wrapper::Inner::operator +=(int) { }
// CHECK: void Wrapper::Inner::operator+=(int)

}

ns::Wrapper::Inner::Inner(int) { }
// CHECK: ns::Wrapper::Inner::Inner(int)

ns::Wrapper::Inner::~Inner() { }
// CHECK: ns::Wrapper::Inner::~Inner()

template<typename T>
void ::ns::Wrapper::Inner::member() { }
// CHECK: template <typename T> void ::ns::Wrapper::Inner::member()

ns::Wrapper::Inner::operator int() { return 0; }
// CHECK: ns::Wrapper::Inner::operator int()

ns::Wrapper::Inner::operator ::ns::Wrapper() { return ns::Wrapper(); }
// CHECK: ns::Wrapper::Inner::operator ::ns::Wrapper()

namespace ns {

void Wrapper::Inner::staticMember() { }
// CHECK: void Wrapper::Inner::staticMember()

}

template<int x, typename T>
class TemplateRecord {
  void function();
  template<typename U> void functionTemplate(T, U);
};

template<int x, typename T>
void TemplateRecord<x, T>::function() { }
// CHECK: template <int x, typename T> void TemplateRecord<x, T>::function()

template<int x, typename T>
template<typename U>
void TemplateRecord<x, T>::functionTemplate(T, U) { }
// CHECK: template <int x, typename T> template <typename U> void TemplateRecord<x, T>::functionTemplate(T, U)

template<>
class TemplateRecord<0, int> {
  void function();
  template<typename U> void functionTemplate(int, U);
};

void TemplateRecord<0, int>::function() { }
// CHECK: void TemplateRecord<0, int>::function()

template<typename U>
void TemplateRecord<0, int>::functionTemplate(int, U) { }
// CHECK: template <typename U> void TemplateRecord<0, int>::functionTemplate(int, U)

template<typename T>
struct OuterTemplateRecord {
  template<typename U>
  struct Inner {
    void function();
  };
};

template<typename T>
template<typename U>
void OuterTemplateRecord<T>::Inner<U>::function() { }
// CHECK: template <typename T> template <typename U> void OuterTemplateRecord<T>::Inner<U>::function()