Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / lang / cpp / breakpoint-commands / nested.cpp
blob740649622cab858d162f0b9849dc9b4be27c837e
1 #include <stdio.h>
3 namespace Foo
5 namespace Bar
7 class Baz
9 public:
10 Baz (int value):m_value(value) {}
11 int Function ()
13 printf ("%s returning: %d.\n", __FUNCTION__, m_value);
14 return m_value + 1;
16 private:
17 int m_value;
20 class Baz2
22 public:
23 Baz2 (int value):m_value(value) {}
24 int Function ()
26 printf ("%s returning: %d.\n", __FUNCTION__, m_value);
27 return m_value + 2;
29 private:
30 int m_value;
33 static int bar_value = 20;
34 int Function ()
36 printf ("%s returning: %d.\n", __FUNCTION__, bar_value);
37 return bar_value + 3;
42 class Baz
44 public:
45 Baz (int value):m_value(value) {}
46 int Function ()
48 printf ("%s returning: %d.\n", __FUNCTION__, m_value);
49 return m_value + 4;
51 private:
52 int m_value;
55 int
56 Function ()
58 printf ("I am a global function, I return 333.\n");
59 return 333;
62 int main ()
64 Foo::Bar::Baz mine(200);
65 Foo::Bar::Baz2 mine2(300);
66 ::Baz bare_baz (500);
68 printf ("Yup, got %d from Baz.\n", mine.Function());
69 printf ("Yup, got %d from Baz.\n", mine2.Function());
70 printf ("Yup, got %d from Baz.\n", bare_baz.Function());
71 printf ("And got %d from Bar.\n", Foo::Bar::Function());
72 printf ("And got %d from ::.\n", ::Function());
74 return 0;