forked from qt-creator/qt-creator
CppEditor: Consider operators
... when looking for reimplemented member functions in the "Insert virtual functions of base class" quickfix. Fixes: QTCREATORBUG-12218 Change-Id: I6e37e28ab747a76dcc97df242bd6c6199fbc7e2e Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -619,10 +619,12 @@ public:
|
|||||||
// Do not implement existing functions inside target class
|
// Do not implement existing functions inside target class
|
||||||
bool funcExistsInClass = false;
|
bool funcExistsInClass = false;
|
||||||
const Name *funcName = func->name();
|
const Name *funcName = func->name();
|
||||||
for (Symbol *symbol = m_classAST->symbol->find(funcName->identifier());
|
const OperatorNameId * const opName = funcName->asOperatorNameId();
|
||||||
symbol; symbol = symbol->next()) {
|
Symbol *symbol = opName ? m_classAST->symbol->find(opName->kind())
|
||||||
if (!symbol->name()
|
: m_classAST->symbol->find(funcName->identifier());
|
||||||
|| !funcName->identifier()->match(symbol->identifier())) {
|
for (; symbol; symbol = symbol->next()) {
|
||||||
|
if (!opName && (!symbol->name()
|
||||||
|
|| !funcName->identifier()->match(symbol->identifier()))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (symbol->type().match(func->type())) {
|
if (symbol->type().match(func->type())) {
|
||||||
@@ -1541,10 +1543,12 @@ void CppEditorPlugin::test_quickfix_InsertVirtualMethods_data()
|
|||||||
"class BaseA {\n"
|
"class BaseA {\n"
|
||||||
"public:\n"
|
"public:\n"
|
||||||
" virtual int virtualFuncA();\n"
|
" virtual int virtualFuncA();\n"
|
||||||
|
" virtual operator==(const BaseA &);\n"
|
||||||
"};\n\n"
|
"};\n\n"
|
||||||
"class Derived : public Bas@eA {\n"
|
"class Derived : public Bas@eA {\n"
|
||||||
"public:\n"
|
"public:\n"
|
||||||
" virtual int virtualFuncA() = 0;\n"
|
" virtual int virtualFuncA() = 0;\n"
|
||||||
|
" virtual operator==(const BaseA &);\n"
|
||||||
"};\n"
|
"};\n"
|
||||||
) << _();
|
) << _();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user