1 // Purpose:
2 // Check that \DexExpectWatchType applies no penalties when expected
3 // types are found.
4 //
5 // UNSUPPORTED: system-darwin
6 //
7 // TODO: On Windows WITH dbgeng, This test takes a long time to run and doesn't evaluate type values
8 // in the same manner as LLDB.
9 // XFAIL: system-windows
10 //
11 // RUN: %dexter_regression_test -- %s | FileCheck %s
12 // CHECK: expect_watch_type.cpp:
13
14 template<class T>
15 class Doubled {
16 public:
Doubled(const T & to_double)17 Doubled(const T & to_double)
18 : m_member(to_double * 2) {}
19
GetVal()20 T GetVal() {
21 T to_return = m_member; // DexLabel('gv_start')
22 return to_return; // DexLabel('gv_end')
23 }
24
static_doubler(const T & to_double)25 static T static_doubler(const T & to_double) {
26 T result = 0; // DexLabel('sd_start')
27 result = to_double * 2;
28 return result; // DexLabel('sd_end')
29 }
30
31 private:
32 T m_member;
33 };
34
main()35 int main() {
36 auto myInt = Doubled<int>(5); // DexLabel('main_start')
37 auto myDouble = Doubled<double>(5.5);
38 auto staticallyDoubledInt = Doubled<int>::static_doubler(5);
39 auto staticallyDoubledDouble = Doubled<double>::static_doubler(5.5);
40 return int(double(myInt.GetVal())
41 + double(staticallyDoubledInt)
42 + myDouble.GetVal()
43 + staticallyDoubledDouble); // DexLabel('main_end')
44 }
45
46 // DexExpectWatchType('m_member', 'int', 'double', from_line='gv_start', to_line='gv_end')
47
48 // DexExpectWatchType('to_double', 'const int &', 'const double &', from_line='sd_start', to_line='sd_end')
49
50 // DexExpectWatchType('myInt', 'Doubled<int>', from_line='main_start', to_line='main_end')
51 // DexExpectWatchType('myDouble', 'Doubled<double>', from_line='main_start', to_line='main_end')
52 // DexExpectWatchType('staticallyDoubledInt', 'int', from_line='main_start', to_line='main_end')
53 // DexExpectWatchType('staticallyDoubledDouble', 'double', from_line='main_start', to_line='main_end')
54
55