Commit 4f890dea authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

CppTools: Fix misdetection of virtual function overloads

Change-Id: I4231d0b98fef2f2f3f1ebdf74c7dfc48ec879e83
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@theqtcompany.com>
parent c383535d
......@@ -1539,6 +1539,35 @@ void CppEditorPlugin::test_quickfix_InsertVirtualMethods_data()
"};\n"
);
// Check: Overloads
QTest::newRow("Overloads")
<< InsertVirtualMethodsDialog::ModeInsideClass << true << false << _(
"class BaseA {\n"
"public:\n"
" virtual int virt(int i) = 0;\n"
" virtual int virt(double d) = 0;\n"
"};\n\n"
"class Derived : public Bas@eA {\n"
"};\n"
) << _(
"class BaseA {\n"
"public:\n"
" virtual int virt(int i) = 0;\n"
" virtual int virt(double d) = 0;\n"
"};\n\n"
"class Derived : public BaseA {\n"
"\n"
" // BaseA interface\n"
"public:\n"
" virtual int virt(int i)\n"
" {\n"
" }\n"
" virtual int virt(double d)\n"
" {\n"
" }\n"
"};\n"
);
// Check: Insert inside class
QTest::newRow("inside")
<< InsertVirtualMethodsDialog::ModeInsideClass << true << false << _(
......
......@@ -80,6 +80,8 @@ static bool isVirtualFunction_helper(const Function *function,
continue;
if (functionType == function) // already tested
continue;
if (!function->isSignatureEqualTo(functionType))
continue;
if (functionType->isFinal())
return res == True;
if (functionType->isVirtual()) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment