forked from qt-creator/qt-creator
CppEditor: InsertDefFromDecl: Hide when definition already exists
"Add Definition Inside/Outside Class" was wrongly shown when there was already an definition outside the class. Change-Id: I6409080c6a1a3abdd4511f7db14ecb4f63458411 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
committed by
Nikolai Kosjar
parent
17a81ae106
commit
d25c5f35ca
@@ -2621,6 +2621,13 @@ void InsertDefFromDecl::match(const CppQuickFixInterface &interface, QuickFixOpe
|
||||
const QString cppFileName = correspondingHeaderOrSource(
|
||||
interface->fileName(), &isHeaderFile);
|
||||
|
||||
// Check if there is already a definition
|
||||
CppTools::SymbolFinder symbolFinder;
|
||||
if (symbolFinder.findMatchingDefinition(decl, interface->snapshot(),
|
||||
true)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Insert Position: Implementation File
|
||||
if (isHeaderFile && !cppFileName.isEmpty()) {
|
||||
CppRefactoringChanges refactoring(interface->snapshot());
|
||||
|
||||
Reference in New Issue
Block a user