summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-overload/Makefile5
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-overload/TestVirtualOverload.py3
-rw-r--r--lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-overload/main.cpp17
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp5
4 files changed, 29 insertions, 1 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-overload/Makefile b/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-overload/Makefile
new file mode 100644
index 00000000000..314f1cb2f07
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-overload/Makefile
@@ -0,0 +1,5 @@
+LEVEL = ../../../make
+
+CXX_SOURCES := main.cpp
+
+include $(LEVEL)/Makefile.rules
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-overload/TestVirtualOverload.py b/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-overload/TestVirtualOverload.py
new file mode 100644
index 00000000000..1311a149326
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-overload/TestVirtualOverload.py
@@ -0,0 +1,3 @@
+from lldbsuite.test import lldbinline
+
+lldbinline.MakeInlineTest(__file__, globals())
diff --git a/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-overload/main.cpp b/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-overload/main.cpp
new file mode 100644
index 00000000000..79c482352f9
--- /dev/null
+++ b/lldb/packages/Python/lldbsuite/test/lang/cpp/virtual-overload/main.cpp
@@ -0,0 +1,17 @@
+// Test that lldb doesn't get confused by an overload of a virtual
+// function of the same name.
+struct Base {
+ virtual void f(int i) {}
+ virtual ~Base() {}
+};
+
+struct Derived : Base {
+ virtual void f(int i, int j) {}
+};
+
+int main(int argc, char **argv) {
+ Derived obj;
+ obj.f(1, 2); //% self.expect("fr var", "not crashing", substrs = ["obj"])
+ return 0;
+}
+
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index ad6f74a7d06..875fc8eb9c2 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2170,7 +2170,10 @@ static bool isOverload(clang::CXXMethodDecl *m1, clang::CXXMethodDecl *m2) {
m2p.getUnqualifiedType());
};
- return !std::equal(m1Type->param_type_begin(), m1Type->param_type_end(),
+ // FIXME: In C++14 and later, we can just pass m2Type->param_type_end()
+ // as a fourth parameter to std::equal().
+ return (m1->getNumParams() != m2->getNumParams()) ||
+ !std::equal(m1Type->param_type_begin(), m1Type->param_type_end(),
m2Type->param_type_begin(), compareArgTypes);
}
OpenPOWER on IntegriCloud