xref: /llvm-project/lldb/test/API/functionalities/breakpoint/cpp/main.cpp (revision 3d83a57721def7aad227d68b1e5e0afa6a74a33f)
1 #include <stdio.h>
2 #include <stdint.h>
3 
4 namespace a {
5     class c {
6     public:
7         c();
8         ~c();
func1()9         void func1()
10         {
11             puts (__PRETTY_FUNCTION__);
12         }
func2()13         void func2()
14         {
15             puts (__PRETTY_FUNCTION__);
16         }
func3()17         void func3()
18         {
19             puts (__PRETTY_FUNCTION__);
20         }
21     };
22 
c()23     c::c() {}
~c()24     c::~c() {}
25 }
26 
27 namespace aa {
28     class cc {
29     public:
30         cc();
31         ~cc();
func1()32         void func1()
33         {
34             puts (__PRETTY_FUNCTION__);
35         }
func2()36         void func2()
37         {
38             puts (__PRETTY_FUNCTION__);
39         }
func3()40         void func3()
41         {
42             puts (__PRETTY_FUNCTION__);
43         }
44     };
45 
cc()46     cc::cc() {}
~cc()47     cc::~cc() {}
48 }
49 
50 namespace b {
51     class c {
52     public:
53         c();
54         ~c();
func1()55         void func1()
56         {
57             puts (__PRETTY_FUNCTION__);
58         }
func3()59         void func3()
60         {
61             puts (__PRETTY_FUNCTION__);
62         }
63     };
64 
c()65     c::c() {}
~c()66     c::~c() {}
67 }
68 
69 namespace c {
70     class d {
71     public:
d()72         d () {}
~d()73         ~d() {}
func2()74         void func2()
75         {
76             puts (__PRETTY_FUNCTION__);
77         }
func3()78         void func3()
79         {
80             puts (__PRETTY_FUNCTION__);
81         }
82     };
83 }
84 
85 namespace ns {
86 template <typename Type> struct Foo {
importns::Foo87   template <typename T> void import() {}
88 
funcns::Foo89   template <typename T> auto func() {}
90 
operator boolns::Foo91   operator bool() { return true; }
92 
operator Tns::Foo93   template <typename T> operator T() { return {}; }
94 
operator <<ns::Foo95   template <typename T> void operator<<(T t) {}
96 };
97 
g()98 template <typename Type> void g() {}
99 } // namespace ns
100 
main(int argc,char const * argv[])101 int main (int argc, char const *argv[])
102 {
103     a::c ac;
104     aa::cc aac;
105     b::c bc;
106     c::d cd;
107     ac.func1();
108     ac.func2();
109     ac.func3();
110     aac.func1();
111     aac.func2();
112     aac.func3();
113     bc.func1();
114     bc.func3();
115     cd.func2();
116     cd.func3();
117 
118     ns::Foo<double> f;
119     f.import <int>();
120     f.func<int>();
121     f.func<ns::Foo<int>>();
122     f.operator bool();
123     f.operator a::c();
124     f.operator ns::Foo<int>();
125     f.operator<<(5);
126     f.operator<< <ns::Foo<int>>({});
127 
128     ns::g<int>();
129     ns::g<char>();
130 
131     return 0;
132 }
133