[Lldb-commits] [PATCH] D65872: [lldb][NFC] Check in test case for testing virtual function calls in pointers and references.

Raphael Isemann via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Aug 7 07:22:54 PDT 2019


teemperor created this revision.
teemperor added a reviewer: lhames.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

rdar://38048657 says that the following test case was broken. It seems to have been fixed since then, so
this patch just adds the test case to our test suite to check for regressions.


Repository:
  rLLDB LLDB

https://reviews.llvm.org/D65872

Files:
  lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-ptr-vs-ref/Makefile
  lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-ptr-vs-ref/TestVirtualPtrVsRef.py
  lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-ptr-vs-ref/main.cpp


Index: lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-ptr-vs-ref/main.cpp
===================================================================
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-ptr-vs-ref/main.cpp
@@ -0,0 +1,19 @@
+class A {
+public:
+  virtual ~A() {}
+  virtual int Dump() { return 1; }
+};
+
+class B : public A {
+public:
+  virtual ~B() {}
+  virtual int Dump() { return 2; }
+};
+
+int main(int argc, char const *argv[], char const *envp[]) {
+  B ref;
+  A *ptr = &ref;
+  ptr->Dump();
+  return 0; //%self.expect("p ref.Dump()", substrs=['(int)', ' = 2'])
+            //%self.expect("p ptr->Dump()", substrs=['(int)', ' = 2'])
+}
Index: lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-ptr-vs-ref/TestVirtualPtrVsRef.py
===================================================================
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-ptr-vs-ref/TestVirtualPtrVsRef.py
@@ -0,0 +1,4 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(__file__, globals())
Index: lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-ptr-vs-ref/Makefile
===================================================================
--- /dev/null
+++ lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-ptr-vs-ref/Makefile
@@ -0,0 +1,3 @@
+LEVEL = ../../../make
+CXX_SOURCES := main.cpp
+include $(LEVEL)/Makefile.rules


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65872.213872.patch
Type: text/x-patch
Size: 1428 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190807/47c815e6/attachment.bin>


More information about the lldb-commits mailing list