Skip pure virtual functions in "Insert Definition From Declaration"

Pure virtual functions do not need a definition.

The issue is that, when the codebase is very huge (hundreds of thousands
of files), the match method starts exploring the whole codebase,
searching for an already present definition that will never be found,
so the QuickFix wastes time for nothing and freezes the UI.

Change-Id: Ia17740d740afcb40ec4f1b3237d8b9f5c1e3d54c
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Antonio Di Monaco
2019-07-19 18:28:43 +02:00
parent 395b5ec185
commit 545b0537ae

View File

@@ -2690,7 +2690,7 @@ void InsertDefFromDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
if (Symbol *symbol = simpleDecl->symbols->value) {
if (Declaration *decl = symbol->asDeclaration()) {
if (Function *func = decl->type()->asFunctionType()) {
if (func->isSignal())
if (func->isSignal() || func->isPureVirtual())
return;
// Check if there is already a definition