summaryrefslogtreecommitdiffstats
path: root/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_watch_type.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'debuginfo-tests/dexter/feature_tests/commands/perfect/expect_watch_type.cpp')
-rw-r--r--debuginfo-tests/dexter/feature_tests/commands/perfect/expect_watch_type.cpp52
1 files changed, 52 insertions, 0 deletions
diff --git a/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_watch_type.cpp b/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_watch_type.cpp
new file mode 100644
index 00000000000..b98ef28ad98
--- /dev/null
+++ b/debuginfo-tests/dexter/feature_tests/commands/perfect/expect_watch_type.cpp
@@ -0,0 +1,52 @@
+// Purpose:
+// Check that \DexExpectWatchType applies no penalties when expected
+// types are found.
+//
+// REQUIRES: system-linux, lldb
+//
+// RUN: %dexter test --fail-lt 1.0 -w \
+// RUN: --builder 'clang' --debugger 'lldb' --cflags "-O0 -g" -- %s \
+// RUN: | FileCheck %s
+// CHECK: expect_watch_type.cpp:
+
+template<class T>
+class Doubled {
+public:
+ Doubled(const T & to_double)
+ : m_member(to_double * 2) {}
+
+ T GetVal() {
+ T to_return = m_member; // DexLabel('gv_start')
+ return to_return; // DexLabel('gv_end')
+ }
+
+ static T static_doubler(const T & to_double) {
+ T result = 0; // DexLabel('sd_start')
+ result = to_double * 2;
+ return result; // DexLabel('sd_end')
+ }
+
+private:
+ T m_member;
+};
+
+int main() {
+ auto myInt = Doubled<int>(5); // DexLabel('main_start')
+ auto myDouble = Doubled<double>(5.5);
+ auto staticallyDoubledInt = Doubled<int>::static_doubler(5);
+ auto staticallyDoubledDouble = Doubled<double>::static_doubler(5.5);
+ return int(double(myInt.GetVal())
+ + double(staticallyDoubledInt)
+ + myDouble.GetVal()
+ + staticallyDoubledDouble); // DexLabel('main_end')
+}
+
+// DexExpectWatchType('m_member', 'int', 'double', from_line='gv_start', to_line='gv_end')
+
+// DexExpectWatchType('to_double', 'const int &', 'const double &', from_line='sd_start', to_line='sd_end')
+
+// DexExpectWatchType('myInt', 'Doubled<int>', from_line='main_start', to_line='main_end')
+// DexExpectWatchType('myDouble', 'Doubled<double>', from_line='main_start', to_line='main_end')
+// DexExpectWatchType('staticallyDoubledInt', 'int', from_line='main_start', to_line='main_end')
+// DexExpectWatchType('staticallyDoubledDouble', 'double', from_line='main_start', to_line='main_end')
+
OpenPOWER on IntegriCloud