From 7650447805d56c064de2bc7ec53c068f572ed5cc Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 19 May 2021 11:22:50 +0200 Subject: [PATCH] CppTools: Remove unneeded parameter from getRefactoringEngine() The ClangCodeModel's RefactoringEngine implements all operations now and thus does not have to be excluded anywhere. Change-Id: Ie3c2107d02e13463fc85f1a5319454db2c45915f Reviewed-by: David Schulz --- src/plugins/cpptools/cppmodelmanager.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/plugins/cpptools/cppmodelmanager.cpp b/src/plugins/cpptools/cppmodelmanager.cpp index 55c5098878e..73c39e62f24 100644 --- a/src/plugins/cpptools/cppmodelmanager.cpp +++ b/src/plugins/cpptools/cppmodelmanager.cpp @@ -295,12 +295,11 @@ QString CppModelManager::editorConfigurationFileName() return QLatin1String(""); } -static RefactoringEngineInterface *getRefactoringEngine( - CppModelManagerPrivate::REHash &engines, bool excludeClangCodeModel = true) +static RefactoringEngineInterface *getRefactoringEngine(CppModelManagerPrivate::REHash &engines) { QTC_ASSERT(!engines.empty(), return nullptr;); RefactoringEngineInterface *currentEngine = engines[REType::BuiltIn]; - if (!excludeClangCodeModel && engines.find(REType::ClangCodeModel) != engines.end()) { + if (engines.find(REType::ClangCodeModel) != engines.end()) { currentEngine = engines[REType::ClangCodeModel]; } else if (engines.find(REType::ClangRefactoring) != engines.end()) { RefactoringEngineInterface *engine = engines[REType::ClangRefactoring]; @@ -314,8 +313,7 @@ void CppModelManager::startLocalRenaming(const CursorInEditor &data, CppTools::ProjectPart *projectPart, RenameCallback &&renameSymbolsCallback) { - RefactoringEngineInterface *engine = getRefactoringEngine(d->m_refactoringEngines, - false); + RefactoringEngineInterface *engine = getRefactoringEngine(d->m_refactoringEngines); QTC_ASSERT(engine, return;); engine->startLocalRenaming(data, projectPart, std::move(renameSymbolsCallback)); } @@ -323,7 +321,7 @@ void CppModelManager::startLocalRenaming(const CursorInEditor &data, void CppModelManager::globalRename(const CursorInEditor &data, UsagesCallback &&renameCallback, const QString &replacement) { - RefactoringEngineInterface *engine = getRefactoringEngine(d->m_refactoringEngines, false); + RefactoringEngineInterface *engine = getRefactoringEngine(d->m_refactoringEngines); QTC_ASSERT(engine, return;); engine->globalRename(data, std::move(renameCallback), replacement); } @@ -331,7 +329,7 @@ void CppModelManager::globalRename(const CursorInEditor &data, UsagesCallback && void CppModelManager::findUsages(const CppTools::CursorInEditor &data, UsagesCallback &&showUsagesCallback) const { - RefactoringEngineInterface *engine = getRefactoringEngine(d->m_refactoringEngines, false); + RefactoringEngineInterface *engine = getRefactoringEngine(d->m_refactoringEngines); QTC_ASSERT(engine, return;); engine->findUsages(data, std::move(showUsagesCallback)); } @@ -344,7 +342,7 @@ void CppModelManager::globalFollowSymbol( SymbolFinder *symbolFinder, bool inNextSplit) const { - RefactoringEngineInterface *engine = getRefactoringEngine(d->m_refactoringEngines, false); + RefactoringEngineInterface *engine = getRefactoringEngine(d->m_refactoringEngines); QTC_ASSERT(engine, return;); engine->globalFollowSymbol(data, std::move(processLinkCallback), snapshot, documentFromSemanticInfo, symbolFinder, inNextSplit);