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

@@ -46,8 +46,8 @@
#include <coreplugin/icore.h>
#include <coreplugin/messagebox.h>
#include <cpptools/clangdiagnosticconfigsmodel.h>
#include <cpptools/cppmodelmanager.h>
#include <cppeditor/clangdiagnosticconfigsmodel.h>
#include <cppeditor/cppmodelmanager.h>
#include <debugger/analyzer/analyzermanager.h>
@@ -79,7 +79,7 @@
#include <QToolButton>
using namespace Core;
using namespace CppTools;
using namespace CppEditor;
using namespace Debugger;
using namespace ProjectExplorer;
using namespace Utils;
@@ -325,22 +325,22 @@ private:
QMap<Utils::FilePath, RefactoringFileInfo> m_refactoringFileInfos;
};
static FileInfos sortedFileInfos(const QVector<CppTools::ProjectPart::ConstPtr> &projectParts)
static FileInfos sortedFileInfos(const QVector<CppEditor::ProjectPart::ConstPtr> &projectParts)
{
FileInfos fileInfos;
for (const CppTools::ProjectPart::ConstPtr &projectPart : projectParts) {
for (const CppEditor::ProjectPart::ConstPtr &projectPart : projectParts) {
QTC_ASSERT(projectPart, continue);
if (!projectPart->selectedForBuilding)
continue;
for (const CppTools::ProjectFile &file : qAsConst(projectPart->files)) {
QTC_ASSERT(file.kind != CppTools::ProjectFile::Unclassified, continue);
QTC_ASSERT(file.kind != CppTools::ProjectFile::Unsupported, continue);
if (file.path == CppTools::CppModelManager::configurationFileName())
for (const CppEditor::ProjectFile &file : qAsConst(projectPart->files)) {
QTC_ASSERT(file.kind != CppEditor::ProjectFile::Unclassified, continue);
QTC_ASSERT(file.kind != CppEditor::ProjectFile::Unsupported, continue);
if (file.path == CppEditor::CppModelManager::configurationFileName())
continue;
if (file.active && CppTools::ProjectFile::isSource(file.kind)) {
if (file.active && CppEditor::ProjectFile::isSource(file.kind)) {
fileInfos.emplace_back(Utils::FilePath::fromString(file.path),
file.kind,
projectPart);
@@ -638,7 +638,7 @@ static bool continueDespiteReleaseBuild(const QString &toolName)
void ClangTool::startTool(ClangTool::FileSelection fileSelection,
const RunSettings &runSettings,
const CppTools::ClangDiagnosticConfig &diagnosticConfig)
const CppEditor::ClangDiagnosticConfig &diagnosticConfig)
{
Project *project = SessionManager::startupProject();
QTC_ASSERT(project, return);
@@ -736,7 +736,7 @@ FileInfos ClangTool::collectFileInfos(Project *project, FileSelection fileSelect
return {};
}
const auto projectInfo = CppTools::CppModelManager::instance()->projectInfo(project);
const auto projectInfo = CppEditor::CppModelManager::instance()->projectInfo(project);
QTC_ASSERT(projectInfo, return FileInfos());
const FileInfos allFileInfos = sortedFileInfos(projectInfo->projectParts());
@@ -1116,7 +1116,7 @@ void ClangTool::setState(ClangTool::State state)
QSet<Diagnostic> ClangTool::diagnostics() const
{
return Utils::filtered(m_diagnosticModel->diagnostics(), [](const Diagnostic &diagnostic) {
using CppTools::ProjectFile;
using CppEditor::ProjectFile;
return ProjectFile::isSource(ProjectFile::classify(diagnostic.location.filePath.toString()));
});
}