From 48b32f4cedc1021c774b68ddff1fb9b338c751c0 Mon Sep 17 00:00:00 2001 From: Lang Hames Date: Mon, 22 Jan 2018 23:53:56 +0000 Subject: [lldb] Fix some C++ virtual method call bugs in LLDB expression evaluation by building method override tables for CXXMethodDecls in DWARFASTParserClang::CompleteTypeFromDWARF. C++ virtual method calls in LLDB expressions may fail if the override table for the method being called is not correct as IRGen will produce references to the wrong (or a missing) vtable entry. This patch does not fix calls to virtual methods with covariant return types as it mistakenly treats these as overloads, rather than overrides. This will be addressed in a future patch. Review: https://reviews.llvm.org/D41997 Partially fixes llvm-svn: 323163 --- .../expression_command/call-overridden-method/main.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lldb/packages/Python/lldbsuite/test/expression_command/call-overridden-method/main.cpp (limited to 'lldb/packages/Python/lldbsuite/test/expression_command/call-overridden-method/main.cpp') diff --git a/lldb/packages/Python/lldbsuite/test/expression_command/call-overridden-method/main.cpp b/lldb/packages/Python/lldbsuite/test/expression_command/call-overridden-method/main.cpp new file mode 100644 index 00000000000..54ae705d297 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/expression_command/call-overridden-method/main.cpp @@ -0,0 +1,16 @@ +class Base { +public: + virtual ~Base() {} + virtual void foo() {} +}; + +class Derived : public Base { +public: + virtual void foo() {} +}; + +int main() { + Derived d; + Base *b = &d; + return 0; // Set breakpoint here +} -- cgit v1.2.3