forked from qt-creator/qt-creator
CppTools: Fix misdetection of virtual function overloads
Change-Id: I4231d0b98fef2f2f3f1ebdf74c7dfc48ec879e83 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
c383535d5c
commit
4f890dea76
@@ -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()) {
|
||||
|
Reference in New Issue
Block a user