Merge CppTools into CppEditor

There was no proper separation of responsibilities between these
plugins. In particular, CppTools had lots of editor-related
functionality, so it's not clear why it was separated out in the first
place.
In fact, for a lot of code, it seemed quite arbitrary where it was put
(just one example: switchHeaderSource() was in CppTools, wheras
switchDeclarationDefinition() was in CppEditor).
Merging the plugins will enable us to get rid of various convoluted
pseudo-abstractions that were only introduced to keep up the artificial
separation.

Change-Id: Iafc3bce625b4794f6d4aa03df6cddc7f2d26716a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Christian Kandeler
2021-08-30 10:58:08 +02:00
parent 3e1fa0f170
commit 284817fae6
525 changed files with 3705 additions and 4179 deletions

View File

@@ -26,7 +26,7 @@
#include "itestparser.h"
#include <coreplugin/editormanager/editormanager.h>
#include <cpptools/cppmodelmanager.h>
#include <cppeditor/cppmodelmanager.h>
#include <utils/textfileformat.h>
#include <utils/algorithm.h>
@@ -48,14 +48,14 @@ void CppParser::init(const Utils::FilePaths &filesToParse, bool fullParse)
{
Q_UNUSED(filesToParse)
Q_UNUSED(fullParse)
m_cppSnapshot = CppTools::CppModelManager::instance()->snapshot();
m_workingCopy = CppTools::CppModelManager::instance()->workingCopy();
m_cppSnapshot = CppEditor::CppModelManager::instance()->snapshot();
m_workingCopy = CppEditor::CppModelManager::instance()->workingCopy();
}
bool CppParser::selectedForBuilding(const Utils::FilePath &fileName)
{
QList<CppTools::ProjectPart::ConstPtr> projParts =
CppTools::CppModelManager::instance()->projectPart(fileName);
QList<CppEditor::ProjectPart::ConstPtr> projParts =
CppEditor::CppModelManager::instance()->projectPart(fileName);
return !projParts.isEmpty() && projParts.at(0)->selectedForBuilding;
}
@@ -82,8 +82,8 @@ bool precompiledHeaderContains(const CPlusPlus::Snapshot &snapshot,
const QString &cacheString,
const std::function<bool(const QString &)> &checker)
{
const CppTools::CppModelManager *modelManager = CppTools::CppModelManager::instance();
const QList<CppTools::ProjectPart::ConstPtr> projectParts = modelManager->projectPart(filePath);
const CppEditor::CppModelManager *modelManager = CppEditor::CppModelManager::instance();
const QList<CppEditor::ProjectPart::ConstPtr> projectParts = modelManager->projectPart(filePath);
if (projectParts.isEmpty())
return false;
const QStringList precompiledHeaders = projectParts.first()->precompiledHeaders;
@@ -128,7 +128,7 @@ bool CppParser::precompiledHeaderContains(const CPlusPlus::Snapshot &snapshot,
void CppParser::release()
{
m_cppSnapshot = CPlusPlus::Snapshot();
m_workingCopy = CppTools::WorkingCopy();
m_workingCopy = CppEditor::WorkingCopy();
QMutexLocker l(s_cacheMutex());
s_pchLookupCache.clear();
}