1 // Purpose:
2 //      Check that \DexExpectWatchType applies no penalties when expected
3 //      types are found.
4 //
5 // REQUIRES: system-linux, lldb
6 //
7 // RUN: %dexter_base test --fail-lt 1.0 -w \
8 // RUN:     --builder 'clang' --debugger 'lldb' --cflags "-O0 -g" -- %s \
9 // RUN:     | FileCheck %s
10 // CHECK: expect_watch_type.cpp:
11 
12 template<class T>
13 class Doubled {
14 public:
Doubled(const T & to_double)15   Doubled(const T & to_double)
16     : m_member(to_double * 2) {}
17 
GetVal()18   T GetVal() {
19     T to_return = m_member; // DexLabel('gv_start')
20     return to_return;       // DexLabel('gv_end')
21   }
22 
static_doubler(const T & to_double)23   static T static_doubler(const T & to_double) {
24     T result = 0;           // DexLabel('sd_start')
25     result = to_double * 2;
26     return result;          // DexLabel('sd_end')
27   }
28 
29 private:
30   T m_member;
31 };
32 
main()33 int main() {
34   auto myInt = Doubled<int>(5); // DexLabel('main_start')
35   auto myDouble = Doubled<double>(5.5);
36   auto staticallyDoubledInt = Doubled<int>::static_doubler(5);
37   auto staticallyDoubledDouble = Doubled<double>::static_doubler(5.5);
38   return int(double(myInt.GetVal())
39          + double(staticallyDoubledInt)
40          + myDouble.GetVal()
41          + staticallyDoubledDouble); // DexLabel('main_end')
42 }
43 
44 // DexExpectWatchType('m_member', 'int', 'double', from_line='gv_start', to_line='gv_end')
45 
46 // DexExpectWatchType('to_double', 'const int &', 'const double &', from_line='sd_start', to_line='sd_end')
47 
48 // DexExpectWatchType('myInt', 'Doubled<int>', from_line='main_start', to_line='main_end')
49 // DexExpectWatchType('myDouble', 'Doubled<double>', from_line='main_start', to_line='main_end')
50 // DexExpectWatchType('staticallyDoubledInt', 'int', from_line='main_start', to_line='main_end')
51 // DexExpectWatchType('staticallyDoubledDouble', 'double', from_line='main_start', to_line='main_end')
52 
53