Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / lang / cpp / dynamic-value / sbvalue-cast.cpp
blob8a95cf4d3903b49bc09a1de4eb40eeb5cb49e3bb
1 #ifdef DO_VIRTUAL_INHERITANCE
2 #define VIRTUAL virtual
3 #else
4 #define VIRTUAL
5 #endif
7 #include <stdio.h>
9 class Base
11 public:
12 Base(int val) : m_base_val (val) {}
13 virtual ~Base() {}
15 virtual void
16 forcast(int input) {
17 int future_val = m_base_val + input * 1;
18 printf("Forcasting %d\n", future_val);
21 protected:
22 int m_base_val;
25 class DerivedA : public VIRTUAL Base
27 public:
28 DerivedA(int val) : Base(val*2), m_a_val(val) {
29 printf("DerivedA::ctor()->\n");
30 printf("m_base_val=%d\n", m_base_val);
31 printf("m_a_val=%d\n", m_a_val);
33 virtual ~DerivedA() {}
35 private:
36 int m_a_val;
39 class DerivedB : public VIRTUAL Base
41 public:
42 DerivedB(int val) : Base(val), m_b_val(val*3) {
43 printf("DerivedB::ctor()->\n");
44 printf("m_base_val=%d\n", m_base_val);
45 printf("m_b_val=%d\n", m_b_val);
47 virtual ~DerivedB() {}
49 virtual void
50 forcast(int input) {
51 int future_val = m_b_val + input * 2;
52 printf("Forcasting %d\n", future_val);
55 private:
56 int m_b_val;
59 int
60 main(int argc, char **argv)
62 DerivedA* dA = new DerivedA(10);
63 DerivedB* dB = new DerivedB(12);
64 Base *array[2] = {dA, dB};
65 Base *teller = NULL;
66 for (int i = 0; i < 2; ++i) {
67 teller = array[i];
68 teller->forcast(i); // Set breakpoint here.
71 return 0;