xref: /llvm-project/lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/set/main.cpp (revision 3eb9e6536a6a40f116655240b264292efabdc928)
1 #include <set>
2 #include <string>
3 
4 int g_the_foo = 0;
5 
thefoo_rw(int arg=1)6 int thefoo_rw(int arg = 1) {
7   if (arg < 0)
8     arg = 0;
9   if (!arg)
10     arg = 1;
11   g_the_foo += arg;
12   return g_the_foo;
13 }
14 
by_ref_and_ptr(std::set<int> & ref,std::set<int> * ptr)15 void by_ref_and_ptr(std::set<int> &ref, std::set<int> *ptr) {
16   // Stop here to check by ref and ptr
17   return;
18 }
19 
main()20 int main() {
21   std::set<int> ii;
22   thefoo_rw(1); // Set break point at this line.
23 
24   ii.insert(0);
25   ii.insert(1);
26   ii.insert(2);
27   ii.insert(3);
28   ii.insert(4);
29   ii.insert(5);
30   thefoo_rw(1); // Set break point at this line.
31 
32   ii.insert(6);
33   thefoo_rw(1); // Set break point at this line.
34 
35   by_ref_and_ptr(ii, &ii);
36 
37   ii.clear();
38   thefoo_rw(1); // Set break point at this line.
39 
40   std::set<std::string> ss;
41   thefoo_rw(1); // Set break point at this line.
42 
43   ss.insert("a");
44   ss.insert("a very long string is right here");
45   thefoo_rw(1); // Set break point at this line.
46 
47   ss.insert("b");
48   ss.insert("c");
49   thefoo_rw(1); // Set break point at this line.
50 
51   ss.erase("b");
52   thefoo_rw(1); // Set break point at this line.
53 
54   return 0;
55 }
56