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
|
||||
bool funcExistsInClass = false;
|
||||
const Name *funcName = func->name();
|
||||
for (Symbol *symbol = m_classAST->symbol->find(funcName->identifier());
|
||||
symbol; symbol = symbol->next()) {
|
||||
if (!symbol->name()
|
||||
|| !funcName->identifier()->match(symbol->identifier())) {
|
||||
const OperatorNameId * const opName = funcName->asOperatorNameId();
|
||||
Symbol *symbol = opName ? m_classAST->symbol->find(opName->kind())
|
||||
: m_classAST->symbol->find(funcName->identifier());
|
||||
for (; symbol; symbol = symbol->next()) {
|
||||
if (!opName && (!symbol->name()
|
||||
|| !funcName->identifier()->match(symbol->identifier()))) {
|
||||
continue;
|
||||
}
|
||||
if (symbol->type().match(func->type())) {
|
||||
@@ -1541,10 +1543,12 @@ void CppEditorPlugin::test_quickfix_InsertVirtualMethods_data()
|
||||
"class BaseA {\n"
|
||||
"public:\n"
|
||||
" virtual int virtualFuncA();\n"
|
||||
" virtual operator==(const BaseA &);\n"
|
||||
"};\n\n"
|
||||
"class Derived : public Bas@eA {\n"
|
||||
"public:\n"
|
||||
" virtual int virtualFuncA() = 0;\n"
|
||||
" virtual operator==(const BaseA &);\n"
|
||||
"};\n"
|
||||
) << _();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user