CppEditor: Use FilePath for ProjectPath::m_sourceFiles

... and update using code.

Change-Id: I682727a4b2982dba388e7cc7b9488225748d591f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2022-11-24 19:16:47 +01:00
parent 887db6b419
commit b87f0519e3
26 changed files with 158 additions and 173 deletions

View File

@@ -22,10 +22,11 @@
#include <QThread>
using namespace Utils;
namespace Cppcheck::Internal {
CppcheckTool::CppcheckTool(CppcheckDiagnosticManager &manager,
const Utils::Id &progressId) :
CppcheckTool::CppcheckTool(CppcheckDiagnosticManager &manager, const Id &progressId) :
m_manager(manager),
m_progressRegexp("^.* checked (\\d+)% done$"),
m_messageRegexp("^(.+),(\\d+),(\\w+),(\\w+),(.*)$"),
@@ -194,13 +195,12 @@ void CppcheckTool::check(const Utils::FilePaths &files)
return;
}
std::map<CppEditor::ProjectPart::ConstPtr, Utils::FilePaths> groups;
for (const Utils::FilePath &file : std::as_const(filtered)) {
const QString stringed = file.toString();
std::map<CppEditor::ProjectPart::ConstPtr, FilePaths> groups;
for (const FilePath &file : std::as_const(filtered)) {
for (const CppEditor::ProjectPart::ConstPtr &part : parts) {
using CppEditor::ProjectFile;
QTC_ASSERT(part, continue);
const auto match = [stringed](const ProjectFile &pFile){return pFile.path == stringed;};
const auto match = [file](const ProjectFile &pFile){return pFile.path == file;};
if (Utils::contains(part->files, match))
groups[part].push_back(file);
}

View File

@@ -78,8 +78,7 @@ void CppcheckTrigger::checkEditors(const QList<IEditor *> &editors)
if (!m_currentProject->isKnownFile(path))
continue;
const QString &pathString = path.toString();
if (!info->sourceFiles().contains(pathString))
if (!info->sourceFiles().contains(path))
continue;
connect(document, &IDocument::aboutToReload,