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

@@ -505,14 +505,13 @@ QSet<QString> internalTargets(const TestTreeItem &item)
if (!projectInfo)
return {};
const Utils::FilePath filePath = item.filePath();
const QString file = filePath.toString();
const QVector<CppEditor::ProjectPart::ConstPtr> projectParts = projectInfo->projectParts();
if (projectParts.isEmpty())
return cppMM->dependingInternalTargets(item.filePath());
for (const CppEditor::ProjectPart::ConstPtr &projectPart : projectParts) {
if (Utils::FilePath::fromString(projectPart->projectFile) == item.proFile()
&& Utils::anyOf(projectPart->files, [&file](const CppEditor::ProjectFile &pf) {
return pf.path == file;
&& Utils::anyOf(projectPart->files, [&filePath] (const CppEditor::ProjectFile &pf) {
return pf.path == filePath;
})) {
result.insert(projectPart->buildSystemTarget);
if (projectPart->buildTargetType != ProjectExplorer::BuildTargetType::Executable)

View File

@@ -73,13 +73,12 @@ static void extractAllFiles(const DebuggerRunTool *runTool, QStringList &include
for (const ProjectFile &file : std::as_const(part->files)) {
if (!file.active)
continue;
const auto path = FilePath::fromString(file.path);
if (file.isHeader() && !headers.contains(path))
headers.push_back(path);
else if (file.isSource() && !sources.contains(path))
sources.push_back(path);
else if (file.path.endsWith(".s") && !assemblers.contains(path))
assemblers.push_back(path);
if (file.isHeader() && !headers.contains(file.path))
headers.push_back(file.path);
else if (file.isSource() && !sources.contains(file.path))
sources.push_back(file.path);
else if (file.path.endsWith(".s") && !assemblers.contains(file.path))
assemblers.push_back(file.path);
}
for (const HeaderPath &include : std::as_const(part->headerPaths)) {
if (!includes.contains(include.path))

View File

@@ -81,6 +81,7 @@ using namespace LanguageClient;
using namespace LanguageServerProtocol;
using namespace ProjectExplorer;
using namespace TextEditor;
using namespace Utils;
namespace ClangCodeModel {
namespace Internal {
@@ -341,7 +342,7 @@ static void addToCompilationDb(QJsonObject &cdb,
// Should we make use of them or keep using our own?
args.prepend("clang");
const QString fileString = Utils::FilePath::fromString(sourceFile.path).toUserOutput();
const QString fileString = sourceFile.path.toUserOutput();
args.append(fileString);
QJsonObject value;
value.insert("workingDirectory", workingDir.toString());
@@ -819,7 +820,7 @@ void ClangdClient::updateParserConfig(const Utils::FilePath &filePath,
CppEditor::CompilerOptionsBuilder optionsBuilder = clangOptionsBuilder(
*projectPart, warningsConfigForProject(project()), includeDir,
ProjectExplorer::Macro::toMacros(config.editorDefines));
const CppEditor::ProjectFile file(filePath.toString(),
const CppEditor::ProjectFile file(filePath,
CppEditor::ProjectFile::classify(filePath.toString()));
const QJsonArray projectPartOptions = fullProjectPartOptions(
optionsBuilder, globalClangOptions());
@@ -833,7 +834,7 @@ void ClangdClient::updateParserConfig(const Utils::FilePath &filePath,
emit configChanged();
}
void ClangdClient::switchIssuePaneEntries(const Utils::FilePath &filePath)
void ClangdClient::switchIssuePaneEntries(const FilePath &filePath)
{
TaskHub::clearTasks(Constants::TASK_CATEGORY_DIAGNOSTICS);
const Tasks tasks = d->issuePaneEntries.value(filePath);

View File

@@ -110,13 +110,13 @@ static QJsonObject createFileObject(const FilePath &buildDir,
bool clStyle)
{
QJsonObject fileObject;
fileObject["file"] = projFile.path;
fileObject["file"] = projFile.path.toString();
QJsonArray args;
if (purpose == CompilationDbPurpose::Project) {
args = QJsonArray::fromStringList(arguments);
const ProjectFile::Kind kind = ProjectFile::classify(projFile.path);
const ProjectFile::Kind kind = ProjectFile::classify(projFile.path.path());
if (projectPart.toolchainType == ProjectExplorer::Constants::MSVC_TOOLCHAIN_TYPEID
|| projectPart.toolchainType == ProjectExplorer::Constants::CLANG_CL_TOOLCHAIN_TYPEID) {
if (!ProjectFile::isObjC(kind)) {
@@ -138,7 +138,7 @@ static QJsonObject createFileObject(const FilePath &buildDir,
args.prepend("clang"); // TODO: clang-cl for MSVC targets? Does it matter at all what we put here?
}
args.append(QDir::toNativeSeparators(projFile.path));
args.append(projFile.path.toUserOutput());
fileObject["arguments"] = args;
fileObject["directory"] = buildDir.toString();
return fileObject;
@@ -269,7 +269,7 @@ QJsonArray clangOptionsForFile(const ProjectFile &file, const ProjectPart &proje
? ProjectFile::CHeader : ProjectFile::CXXHeader;
}
if (usePch == UsePrecompiledHeaders::Yes
&& projectPart.precompiledHeaders.contains(file.path)) {
&& projectPart.precompiledHeaders.contains(file.path.path())) {
usePch = UsePrecompiledHeaders::No;
}
optionsBuilder.updateFileLanguage(fileKind);

View File

@@ -312,16 +312,14 @@ static FileInfos sortedFileInfos(const QVector<CppEditor::ProjectPart::ConstPtr>
for (const CppEditor::ProjectFile &file : std::as_const(projectPart->files)) {
QTC_ASSERT(file.kind != CppEditor::ProjectFile::Unclassified, continue);
QTC_ASSERT(file.kind != CppEditor::ProjectFile::Unsupported, continue);
if (file.path == CppEditor::CppModelManager::configurationFileName().path())
if (file.path == CppEditor::CppModelManager::configurationFileName())
continue;
if (file.active
&& (CppEditor::ProjectFile::isSource(file.kind)
|| CppEditor::ProjectFile::isHeader(file.kind))) {
ProjectFile::Kind sourceKind = CppEditor::ProjectFile::sourceKind(file.kind);
fileInfos.emplace_back(Utils::FilePath::fromString(file.path),
sourceKind,
projectPart);
fileInfos.emplace_back(file.path, sourceKind, projectPart);
}
}
}

View File

@@ -135,20 +135,19 @@ static FileInfo getFileInfo(const FilePath &file, Project *project)
for (const ProjectFile &projectFile : std::as_const(projectPart->files)) {
QTC_ASSERT(projectFile.kind != ProjectFile::Unclassified, continue);
QTC_ASSERT(projectFile.kind != ProjectFile::Unsupported, continue);
if (projectFile.path == CppModelManager::configurationFileName().path())
if (projectFile.path == CppModelManager::configurationFileName())
continue;
const auto projectFilePath = FilePath::fromString(projectFile.path);
if (file != projectFilePath)
if (file != projectFile.path)
continue;
if (!projectFile.active)
continue;
// found the best candidate, early return
ProjectFile::Kind sourceKind = ProjectFile::sourceKind(projectFile.kind);
if (projectPart->buildTargetType != BuildTargetType::Unknown)
return FileInfo(projectFilePath, sourceKind, projectPart);
return FileInfo(projectFile.path, sourceKind, projectPart);
// found something but keep looking for better candidates
if (candidate.projectPart.isNull())
candidate = FileInfo(projectFilePath, sourceKind, projectPart);
candidate = FileInfo(projectFile.path, sourceKind, projectPart);
}
}

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,

View File

@@ -29,7 +29,7 @@ AbstractEditorSupport::~AbstractEditorSupport()
void AbstractEditorSupport::updateDocument()
{
++m_revision;
m_modelmanager->updateSourceFiles(QSet<QString>{filePath().toString()});
m_modelmanager->updateSourceFiles({filePath()});
}
void AbstractEditorSupport::notifyAboutUpdatedContents() const

View File

@@ -240,11 +240,10 @@ QVariant ProjectFilesModel::data(const QModelIndex &index, int role) const
if (role == Qt::DisplayRole) {
const int row = index.row();
const int column = index.column();
if (column == FileKindColumn) {
if (column == FileKindColumn)
return CMI::Utils::toString(m_files.at(row).kind);
} else if (column == FilePathColumn) {
return m_files.at(row).path;
}
if (column == FilePathColumn)
return m_files.at(row).path.toVariant();
} else if (role == Qt::ForegroundRole) {
if (!m_files.at(index.row()).active) {
return QApplication::palette().color(QPalette::ColorGroup::Disabled,

View File

@@ -457,8 +457,7 @@ void CppFindReferences::onReplaceButtonClicked(Core::SearchResult *search,
{
const Utils::FilePaths filePaths = TextEditor::BaseFileFind::replaceAll(text, items, preserveCase);
if (!filePaths.isEmpty()) {
m_modelManager->updateSourceFiles(
Utils::transform<QSet>(filePaths, &Utils::FilePath::toString));
m_modelManager->updateSourceFiles(Utils::toSet(filePaths));
SearchResultWindow::instance()->hide();
}

View File

@@ -169,7 +169,7 @@ public:
// The members below are cached/(re)calculated from the projects and/or their project parts
bool m_dirty;
QStringList m_projectFiles;
Utils::FilePaths m_projectFiles;
ProjectExplorer::HeaderPaths m_headerPaths;
ProjectExplorer::Macros m_definedMacros;
@@ -262,9 +262,9 @@ const char pp_configuration[] =
"#define __ptr32\n"
"#define __ptr64\n";
QSet<QString> CppModelManager::timeStampModifiedFiles(const QList<Document::Ptr> &documentsToCheck)
QSet<FilePath> CppModelManager::timeStampModifiedFiles(const QList<Document::Ptr> &documentsToCheck)
{
QSet<QString> sourceFiles;
QSet<FilePath> sourceFiles;
for (const Document::Ptr &doc : documentsToCheck) {
const QDateTime lastModified = doc->lastModified();
@@ -273,7 +273,7 @@ QSet<QString> CppModelManager::timeStampModifiedFiles(const QList<Document::Ptr>
const FilePath filePath = doc->filePath();
if (filePath.exists() && filePath.lastModified() != lastModified)
sourceFiles.insert(filePath.toString());
sourceFiles.insert(filePath);
}
}
@@ -403,7 +403,7 @@ void CppModelManager::showPreprocessedFile(bool inNextSplit)
}
const ToolChain * tc = nullptr;
const ProjectFile classifier(filePath.toString(), ProjectFile::classify(filePath.toString()));
const ProjectFile classifier(filePath, ProjectFile::classify(filePath.toString()));
if (classifier.isC()) {
tc = ToolChainKitAspect::cToolChain(project->activeTarget()->kit());
} else if (classifier.isCxx() || classifier.isHeader()) {
@@ -890,8 +890,8 @@ void CppModelManager::initCppTools()
connect(Core::VcsManager::instance(), &Core::VcsManager::repositoryChanged,
this, &CppModelManager::updateModifiedSourceFiles);
connect(Core::DocumentManager::instance(), &Core::DocumentManager::filesChangedInternally,
[this](const Utils::FilePaths &filePaths) {
updateSourceFiles(Utils::transform<QSet>(filePaths, &Utils::FilePath::toString));
[this](const FilePaths &filePaths) {
updateSourceFiles(toSet(filePaths));
});
connect(this, &CppModelManager::documentUpdated,
@@ -1027,16 +1027,16 @@ void CppModelManager::ensureUpdated()
d->m_dirty = false;
}
QStringList CppModelManager::internalProjectFiles() const
FilePaths CppModelManager::internalProjectFiles() const
{
QStringList files;
FilePaths files;
for (const ProjectData &projectData : std::as_const(d->m_projectData)) {
for (const ProjectPart::ConstPtr &part : projectData.projectInfo->projectParts()) {
for (const ProjectFile &file : part->files)
files += file.path;
}
}
files.removeDuplicates();
FilePath::removeDuplicates(files);
return files;
}
@@ -1272,13 +1272,14 @@ static QSet<QString> filteredFilesRemoved(const QSet<QString> &files, int fileSi
return result;
}
QFuture<void> CppModelManager::updateSourceFiles(const QSet<QString> &sourceFiles,
QFuture<void> CppModelManager::updateSourceFiles(const QSet<FilePath> &sourceFiles,
ProgressNotificationMode mode)
{
if (sourceFiles.isEmpty() || !d->m_indexerEnabled)
return QFuture<void>();
const QSet<QString> filteredFiles = filteredFilesRemoved(sourceFiles, indexerFileSizeLimitInMb(),
const QSet<QString> filteredFiles = filteredFilesRemoved(transform(sourceFiles, &FilePath::toString),
indexerFileSizeLimitInMb(),
codeModelSettings()->ignoreFiles(),
codeModelSettings()->ignorePattern());
@@ -1304,11 +1305,10 @@ void CppModelManager::removeProjectInfoFilesAndIncludesFromSnapshot(const Projec
QMutexLocker snapshotLocker(&d->m_snapshotMutex);
for (const ProjectPart::ConstPtr &projectPart : projectInfo.projectParts()) {
for (const ProjectFile &cxxFile : std::as_const(projectPart->files)) {
const QSet<FilePath> filePaths = d->m_snapshot.allIncludesForDocument(
FilePath::fromString(cxxFile.path));
const QSet<FilePath> filePaths = d->m_snapshot.allIncludesForDocument(cxxFile.path);
for (const FilePath &filePath : filePaths)
d->m_snapshot.remove(filePath);
d->m_snapshot.remove(FilePath::fromString(cxxFile.path));
d->m_snapshot.remove(cxxFile.path);
}
}
}
@@ -1320,11 +1320,11 @@ const QList<CppEditorDocumentHandle *> CppModelManager::cppEditorDocuments() con
}
/// \brief Remove all given files from the snapshot.
void CppModelManager::removeFilesFromSnapshot(const QSet<QString> &filesToRemove)
void CppModelManager::removeFilesFromSnapshot(const QSet<FilePath> &filesToRemove)
{
QMutexLocker snapshotLocker(&d->m_snapshotMutex);
for (const QString &file : filesToRemove)
d->m_snapshot.remove(FilePath::fromString(file));
for (const FilePath &file : filesToRemove)
d->m_snapshot.remove(file);
}
class ProjectInfoComparer
@@ -1342,16 +1342,16 @@ public:
bool configurationChanged() const { return m_new.configurationChanged(m_old); }
bool configurationOrFilesChanged() const { return m_new.configurationOrFilesChanged(m_old); }
QSet<QString> addedFiles() const
QSet<FilePath> addedFiles() const
{
QSet<QString> addedFilesSet = m_newSourceFiles;
QSet<FilePath> addedFilesSet = m_newSourceFiles;
addedFilesSet.subtract(m_oldSourceFiles);
return addedFilesSet;
}
QSet<QString> removedFiles() const
QSet<FilePath> removedFiles() const
{
QSet<QString> removedFilesSet = m_oldSourceFiles;
QSet<FilePath> removedFilesSet = m_oldSourceFiles;
removedFilesSet.subtract(m_newSourceFiles);
return removedFilesSet;
}
@@ -1364,14 +1364,14 @@ public:
}
/// Returns a list of common files that have a changed timestamp.
QSet<QString> timeStampModifiedFiles(const Snapshot &snapshot) const
QSet<FilePath> timeStampModifiedFiles(const Snapshot &snapshot) const
{
QSet<QString> commonSourceFiles = m_newSourceFiles;
QSet<FilePath> commonSourceFiles = m_newSourceFiles;
commonSourceFiles.intersect(m_oldSourceFiles);
QList<Document::Ptr> documentsToCheck;
for (const QString &file : commonSourceFiles) {
if (Document::Ptr document = snapshot.document(FilePath::fromString(file)))
for (const FilePath &file : commonSourceFiles) {
if (Document::Ptr document = snapshot.document(file))
documentsToCheck << document;
}
@@ -1391,10 +1391,10 @@ private:
private:
const ProjectInfo &m_old;
const QSet<QString> m_oldSourceFiles;
const QSet<FilePath> m_oldSourceFiles;
const ProjectInfo &m_new;
const QSet<QString> m_newSourceFiles;
const QSet<FilePath> m_newSourceFiles;
};
/// Make sure that m_projectLock is locked for writing when calling this.
@@ -1406,8 +1406,7 @@ void CppModelManager::recalculateProjectPartMappings()
for (const ProjectPart::ConstPtr &projectPart : projectData.projectInfo->projectParts()) {
d->m_projectPartIdToProjectProjectPart[projectPart->id()] = projectPart;
for (const ProjectFile &cxxFile : projectPart->files)
d->m_fileToProjectParts[Utils::FilePath::fromString(cxxFile.path).canonicalPath()].append(
projectPart);
d->m_fileToProjectParts[cxxFile.path.canonicalPath()].append(projectPart);
}
}
@@ -1464,12 +1463,12 @@ void CppModelManager::updateCppEditorDocuments(bool projectsUpdated) const
}
QFuture<void> CppModelManager::updateProjectInfo(const ProjectInfo::ConstPtr &newProjectInfo,
const QSet<QString> &additionalFiles)
const QSet<FilePath> &additionalFiles)
{
if (!newProjectInfo)
return {};
QSet<QString> filesToReindex;
QSet<FilePath> filesToReindex;
QStringList removedProjectParts;
bool filesRemoved = false;
@@ -1481,7 +1480,7 @@ QFuture<void> CppModelManager::updateProjectInfo(const ProjectInfo::ConstPtr &ne
{ // Only hold the lock for a limited scope, so the dumping afterwards does not deadlock.
QWriteLocker projectLocker(&d->m_projectLock);
const QSet<QString> newSourceFiles = newProjectInfo->sourceFiles();
const QSet<FilePath> newSourceFiles = newProjectInfo->sourceFiles();
// Check if we can avoid a full reindexing
const auto it = d->m_projectData.find(project);
@@ -1503,18 +1502,18 @@ QFuture<void> CppModelManager::updateProjectInfo(const ProjectInfo::ConstPtr &ne
// Otherwise check for added and modified files
} else {
const QSet<QString> addedFiles = comparer.addedFiles();
const QSet<FilePath> addedFiles = comparer.addedFiles();
filesToReindex.unite(addedFiles);
const QSet<QString> modifiedFiles = comparer.timeStampModifiedFiles(snapshot());
const QSet<FilePath> modifiedFiles = comparer.timeStampModifiedFiles(snapshot());
filesToReindex.unite(modifiedFiles);
}
// Announce and purge the removed files from the snapshot
const QSet<QString> removedFiles = comparer.removedFiles();
const QSet<FilePath> removedFiles = comparer.removedFiles();
if (!removedFiles.isEmpty()) {
filesRemoved = true;
emit aboutToRemoveFiles(Utils::toList(removedFiles));
emit aboutToRemoveFiles(transform<QStringList>(removedFiles, &FilePath::toString));
removeFilesFromSnapshot(removedFiles);
}
}
@@ -1935,8 +1934,7 @@ void CppModelManager::GC()
// The configuration file is part of the project files, which is just fine.
// If single files are open, without any project, then there is no need to
// keep the configuration file around.
FilePaths todo = filesInEditorSupports;
todo += transform(projectFiles(), &FilePath::fromString);
FilePaths todo = filesInEditorSupports + projectFiles();
// Collect all files that are reachable from the project files
while (!todo.isEmpty()) {
@@ -2032,7 +2030,7 @@ CppIndexingSupport *CppModelManager::indexingSupport()
return d->m_internalIndexingSupport;
}
QStringList CppModelManager::projectFiles()
FilePaths CppModelManager::projectFiles()
{
QWriteLocker locker(&d->m_projectLock);
ensureUpdated();

View File

@@ -87,7 +87,7 @@ public:
ReservedProgressNotification
};
QFuture<void> updateSourceFiles(const QSet<QString> &sourceFiles,
QFuture<void> updateSourceFiles(const QSet<Utils::FilePath> &sourceFiles,
ProgressNotificationMode mode = ReservedProgressNotification);
void updateCppEditorDocuments(bool projectsUpdated = false) const;
WorkingCopy workingCopy() const;
@@ -103,7 +103,7 @@ public:
ProjectInfoList projectInfos() const;
ProjectInfo::ConstPtr projectInfo(ProjectExplorer::Project *project) const;
QFuture<void> updateProjectInfo(const ProjectInfo::ConstPtr &newProjectInfo,
const QSet<QString> &additionalFiles = {});
const QSet<Utils::FilePath> &additionalFiles = {});
/// \return The project part with the given project file
ProjectPart::ConstPtr projectPartForId(const QString &projectPartId) const;
@@ -192,7 +192,7 @@ public:
CppIndexingSupport *indexingSupport();
QStringList projectFiles();
Utils::FilePaths projectFiles();
ProjectExplorer::HeaderPaths headerPaths();
@@ -207,7 +207,7 @@ public:
QThreadPool *sharedThreadPool();
static QSet<QString> timeStampModifiedFiles(const QList<Document::Ptr> &documentsToCheck);
static QSet<Utils::FilePath> timeStampModifiedFiles(const QList<Document::Ptr> &documentsToCheck);
static Internal::CppSourceProcessor *createSourceProcessor();
static const Utils::FilePath &configurationFileName();
@@ -284,13 +284,13 @@ private:
void recalculateProjectPartMappings();
void replaceSnapshot(const CPlusPlus::Snapshot &newSnapshot);
void removeFilesFromSnapshot(const QSet<QString> &removedFiles);
void removeFilesFromSnapshot(const QSet<Utils::FilePath> &removedFiles);
void removeProjectInfoFilesAndIncludesFromSnapshot(const ProjectInfo &projectInfo);
WorkingCopy buildWorkingCopyList();
void ensureUpdated();
QStringList internalProjectFiles() const;
Utils::FilePaths internalProjectFiles() const;
ProjectExplorer::HeaderPaths internalHeaderPaths() const;
ProjectExplorer::Macros internalDefinedMacros() const;
@@ -301,4 +301,4 @@ private:
Internal::CppModelManagerPrivate *d;
};
} // namespace CppEditor
} // CppEditor

View File

@@ -103,7 +103,7 @@ public:
rpp.setQtVersion(Utils::QtMajorVersion::Qt5);
const ProjectFiles rppFiles = Utils::transform<ProjectFiles>(projectFiles,
[](const FilePath &file) {
return ProjectFile(file.toString(), ProjectFile::classify(file.toString()));
return ProjectFile(file, ProjectFile::classify(file.toString()));
});
const auto project = modelManagerTestHelper->createProject(
name, Utils::FilePath::fromString(dir).pathAppended(name + ".pro"));
@@ -217,7 +217,7 @@ void ModelManagerTest::testFrameworkHeaders()
const FilePath source =
testDataDir.fileFromSourcesDir("test_modelmanager_framework_headers.cpp");
const auto part = ProjectPart::create(project->projectFilePath(), rpp, {},
{ProjectFile(source.toString(), ProjectFile::CXXSource)});
{ProjectFile(source, ProjectFile::CXXSource)});
const auto pi = ProjectInfo::create(ProjectUpdateInfo(project, KitInfo(nullptr), {}, {}),
{part});
@@ -262,7 +262,7 @@ void ModelManagerTest::testRefreshAlsoIncludesOfProjectFiles()
rpp.setMacros({{"OH_BEHAVE", "-1"}});
rpp.setHeaderPaths({HeaderPath::makeUser(testDataDir.includeDir(false))});
auto part = ProjectPart::create(project->projectFilePath(), rpp, {},
{ProjectFile(testCpp.toString(), ProjectFile::CXXSource)});
{ProjectFile(testCpp, ProjectFile::CXXSource)});
auto pi = ProjectInfo::create(ProjectUpdateInfo(project, KitInfo(nullptr), {}, {}), {part});
QSet<FilePath> refreshedFiles = helper.updateProjectInfo(pi);
@@ -280,7 +280,7 @@ void ModelManagerTest::testRefreshAlsoIncludesOfProjectFiles()
// Introduce a define that will enable another define once the document is reparsed.
rpp.setMacros({{"TEST_DEFINE", "1"}});
part = ProjectPart::create(project->projectFilePath(), rpp, {},
{ProjectFile(testCpp.toString(), ProjectFile::CXXSource)});
{ProjectFile(testCpp, ProjectFile::CXXSource)});
pi = ProjectInfo::create(ProjectUpdateInfo(project, KitInfo(nullptr), {}, {}), {part});
refreshedFiles = helper.updateProjectInfo(pi);
@@ -317,9 +317,9 @@ void ModelManagerTest::testRefreshSeveralTimes()
RawProjectPart rpp;
rpp.setQtVersion(Utils::QtMajorVersion::Qt5);
const ProjectFiles files = {
ProjectFile(testHeader1.toString(), ProjectFile::CXXHeader),
ProjectFile(testHeader2.toString(), ProjectFile::CXXHeader),
ProjectFile(testCpp.toString(), ProjectFile::CXXSource)
ProjectFile(testHeader1, ProjectFile::CXXHeader),
ProjectFile(testHeader2, ProjectFile::CXXHeader),
ProjectFile(testCpp, ProjectFile::CXXSource)
};
const auto part = ProjectPart::create(project->projectFilePath(), rpp, {}, files);
auto pi = ProjectInfo::create(ProjectUpdateInfo(project, KitInfo(nullptr), {}, {}), {part});
@@ -369,7 +369,7 @@ void ModelManagerTest::testRefreshTestForChanges()
CppModelManager *mm = CppModelManager::instance();
const MyTestDataDir testDataDir(_("testdata_refresh"));
const QString testCpp(testDataDir.file(_("source.cpp")));
const FilePath testCpp = testDataDir.filePath("source.cpp");
const auto project = helper.createProject(_("test_modelmanager_refresh_2"),
Utils::FilePath::fromString("blubb.pro"));
@@ -384,7 +384,7 @@ void ModelManagerTest::testRefreshTestForChanges()
QFuture<void> firstFuture = mm->updateProjectInfo(pi);
QVERIFY(firstFuture.isStarted() || firstFuture.isRunning());
firstFuture.waitForFinished();
const QSet<QString> refreshedFiles = helper.waitForRefreshedSourceFiles();
const QSet<FilePath> refreshedFiles = helper.waitForRefreshedSourceFiles();
QCOMPARE(refreshedFiles.size(), 1);
QVERIFY(refreshedFiles.contains(testCpp));
@@ -411,8 +411,8 @@ void ModelManagerTest::testRefreshAddedAndPurgeRemoved()
RawProjectPart rpp;
rpp.setQtVersion(Utils::QtMajorVersion::Qt5);
const auto part = ProjectPart::create(project->projectFilePath(), rpp, {},
{{testCpp.toString(), ProjectFile::CXXSource},
{testHeader1.toString(), ProjectFile::CXXHeader}});
{{testCpp, ProjectFile::CXXSource},
{testHeader1, ProjectFile::CXXHeader}});
auto pi = ProjectInfo::create({project, KitInfo(nullptr), {}, {}}, {part});
CPlusPlus::Snapshot snapshot;
@@ -430,8 +430,8 @@ void ModelManagerTest::testRefreshAddedAndPurgeRemoved()
// Now add testHeader2 and remove testHeader1
const auto newPart = ProjectPart::create(project->projectFilePath(), rpp, {},
{{testCpp.toString(), ProjectFile::CXXSource},
{testHeader2.toString(), ProjectFile::CXXHeader}});
{{testCpp, ProjectFile::CXXSource},
{testHeader2, ProjectFile::CXXHeader}});
pi = ProjectInfo::create({project, KitInfo(nullptr), {}, {}}, {newPart});
refreshedFiles = helper.updateProjectInfo(pi);
@@ -468,7 +468,7 @@ void ModelManagerTest::testRefreshTimeStampModifiedIfSourcefilesChange()
RawProjectPart rpp;
rpp.setQtVersion(Utils::QtMajorVersion::Qt5);
auto files = Utils::transform<ProjectFiles>(initialProjectFilePaths, [](const FilePath &f) {
return ProjectFile(f.toString(), ProjectFile::CXXSource);
return ProjectFile(f, ProjectFile::CXXSource);
});
auto part = ProjectPart::create(project->projectFilePath(), rpp, {}, files);
auto pi = ProjectInfo::create({project, KitInfo(nullptr), {}, {}}, {part});
@@ -501,7 +501,7 @@ void ModelManagerTest::testRefreshTimeStampModifiedIfSourcefilesChange()
// Add or remove source file. The configuration stays the same.
files = Utils::transform<ProjectFiles>(finalProjectFilePaths, [](const FilePath &f) {
return ProjectFile(f.toString(), ProjectFile::CXXSource);
return ProjectFile(f, ProjectFile::CXXSource);
});
part = ProjectPart::create(project->projectFilePath(), rpp, {}, files);
pi = ProjectInfo::create({project, KitInfo(nullptr), {}, {}}, {part});
@@ -732,9 +732,9 @@ void ModelManagerTest::testDefinesPerProject()
ModelManagerTestHelper helper;
MyTestDataDir testDataDirectory(_("testdata_defines"));
const QString main1File = testDataDirectory.file(_("main1.cpp"));
const QString main2File = testDataDirectory.file(_("main2.cpp"));
const QString header = testDataDirectory.file(_("header.h"));
const FilePath main1File = testDataDirectory.filePath("main1.cpp");
const FilePath main2File = testDataDirectory.filePath("main2.cpp");
const FilePath header = testDataDirectory.filePath("header.h");
CppModelManager *mm = CppModelManager::instance();
@@ -766,7 +766,7 @@ void ModelManagerTest::testDefinesPerProject()
struct Data {
QString firstDeclarationName;
QString fileName;
FilePath filePath;
} d[] = {
{_("one"), main1File},
{_("two"), main2File}
@@ -774,15 +774,14 @@ void ModelManagerTest::testDefinesPerProject()
for (auto &i : d) {
const QString firstDeclarationName = i.firstDeclarationName;
const Utils::FilePath filePath = Utils::FilePath::fromString(i.fileName);
Core::IEditor *editor = Core::EditorManager::openEditor(filePath);
Core::IEditor *editor = Core::EditorManager::openEditor(i.filePath);
EditorCloser closer(editor);
QVERIFY(editor);
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1);
QVERIFY(mm->isCppEditor(editor));
Document::Ptr doc = mm->document(filePath);
Document::Ptr doc = mm->document(i.filePath);
QCOMPARE(nameOfFirstDeclaration(doc), firstDeclarationName);
}
}
@@ -794,9 +793,9 @@ void ModelManagerTest::testPrecompiledHeaders()
MyTestDataDir testDataDirectory(_("testdata_defines"));
const FilePath main1File = testDataDirectory.filePath("main1.cpp");
const FilePath main2File = testDataDirectory.filePath("main2.cpp");
const QString header = testDataDirectory.file(_("header.h"));
const QString pch1File = testDataDirectory.file(_("pch1.h"));
const QString pch2File = testDataDirectory.file(_("pch2.h"));
const FilePath header = testDataDirectory.filePath("header.h");
const FilePath pch1File = testDataDirectory.filePath("pch1.h");
const FilePath pch2File = testDataDirectory.filePath("pch2.h");
CppModelManager *mm = CppModelManager::instance();
@@ -806,18 +805,18 @@ void ModelManagerTest::testPrecompiledHeaders()
RawProjectPart rpp1;
rpp1.setProjectFileLocation("project1.projectfile");
rpp1.setQtVersion(Utils::QtMajorVersion::None);
rpp1.setPreCompiledHeaders({pch1File});
rpp1.setPreCompiledHeaders({pch1File.toString()});
rpp1.setHeaderPaths({HeaderPath::makeUser(testDataDirectory.includeDir(false))});
const auto part1 = ProjectPart::create(project->projectFilePath(), rpp1, {},
{{main1File.toString(), ProjectFile::CXXSource}, {header, ProjectFile::CXXHeader}});
{{main1File, ProjectFile::CXXSource}, {header, ProjectFile::CXXHeader}});
RawProjectPart rpp2;
rpp2.setProjectFileLocation("project2.projectfile");
rpp2.setQtVersion(Utils::QtMajorVersion::None);
rpp2.setPreCompiledHeaders({pch2File});
rpp2.setPreCompiledHeaders({pch2File.toString()});
rpp2.setHeaderPaths({HeaderPath::makeUser(testDataDirectory.includeDir(false))});
const auto part2 = ProjectPart::create(project->projectFilePath(), rpp2, {},
{{main2File.toString(), ProjectFile::CXXSource}, {header, ProjectFile::CXXHeader}});
{{main2File, ProjectFile::CXXSource}, {header, ProjectFile::CXXHeader}});
const auto pi = ProjectInfo::create({project, KitInfo(nullptr), {}, {}}, {part1, part2});
@@ -874,9 +873,9 @@ void ModelManagerTest::testDefinesPerEditor()
ModelManagerTestHelper helper;
MyTestDataDir testDataDirectory(_("testdata_defines"));
const QString main1File = testDataDirectory.file(_("main1.cpp"));
const QString main2File = testDataDirectory.file(_("main2.cpp"));
const QString header = testDataDirectory.file(_("header.h"));
const FilePath main1File = testDataDirectory.filePath("main1.cpp");
const FilePath main2File = testDataDirectory.filePath("main2.cpp");
const FilePath header = testDataDirectory.filePath("header.h");
CppModelManager *mm = CppModelManager::instance();
@@ -914,8 +913,7 @@ void ModelManagerTest::testDefinesPerEditor()
const QString editorDefines = i.editorDefines;
const QString firstDeclarationName = i.firstDeclarationName;
Core::IEditor *editor = Core::EditorManager::openEditor(
Utils::FilePath::fromString(main1File));
Core::IEditor *editor = Core::EditorManager::openEditor(main1File);
EditorCloser closer(editor);
QVERIFY(editor);
QCOMPARE(Core::DocumentModel::openedDocuments().size(), 1);
@@ -929,7 +927,7 @@ void ModelManagerTest::testDefinesPerEditor()
parser->update({CppModelManager::instance()->workingCopy(), nullptr,
Utils::Language::Cxx, false});
Document::Ptr doc = mm->document(FilePath::fromString(main1File));
Document::Ptr doc = mm->document(main1File);
QCOMPARE(nameOfFirstDeclaration(doc), firstDeclarationName);
}
}
@@ -970,7 +968,7 @@ void ModelManagerTest::testUpdateEditorsAfterProjectUpdate()
RawProjectPart rpp;
rpp.setQtVersion(Utils::QtMajorVersion::None);
const auto part = ProjectPart::create(project->projectFilePath(), rpp, {},
{{fileA.toString(), ProjectFile::CXXSource}, {fileB.toString(), ProjectFile::CXXSource}});
{{fileA, ProjectFile::CXXSource}, {fileB, ProjectFile::CXXSource}});
const auto pi = ProjectInfo::create({project, KitInfo(nullptr), {}, {}}, {part});
helper.updateProjectInfo(pi);
@@ -1004,23 +1002,22 @@ void ModelManagerTest::testRenameIncludes()
const MyTestDataDir testDir(_("testdata_project1"));
// Copy test files to a temporary directory
QSet<QString> sourceFiles;
QSet<FilePath> sourceFiles;
for (const QString &fileName : std::as_const(fileNames)) {
const QString &file = workingDir.filePath(fileName);
QVERIFY(QFile::copy(testDir.file(fileName), file));
// Saving source file names for the model manager update,
// so we can update just the relevant files.
if (ProjectFile::classify(file) == ProjectFile::CXXSource)
sourceFiles.insert(file);
sourceFiles.insert(FilePath::fromString(file));
}
// Update the c++ model manager and check for the old includes
modelManager->updateSourceFiles(sourceFiles).waitForFinished();
QCoreApplication::processEvents();
CPlusPlus::Snapshot snapshot = modelManager->snapshot();
for (const QString &sourceFile : std::as_const(sourceFiles)) {
QCOMPARE(snapshot.allIncludesForDocument(FilePath::fromString(sourceFile)),
QSet<FilePath>{oldHeader});
for (const FilePath &sourceFile : std::as_const(sourceFiles)) {
QCOMPARE(snapshot.allIncludesForDocument(sourceFile), QSet<FilePath>{oldHeader});
}
// Renaming the header
@@ -1032,9 +1029,8 @@ void ModelManagerTest::testRenameIncludes()
modelManager->updateSourceFiles(sourceFiles).waitForFinished();
QCoreApplication::processEvents();
snapshot = modelManager->snapshot();
for (const QString &sourceFile : std::as_const(sourceFiles)) {
QCOMPARE(snapshot.allIncludesForDocument(FilePath::fromString(sourceFile)),
QSet<FilePath>{newHeader});
for (const FilePath &sourceFile : std::as_const(sourceFiles)) {
QCOMPARE(snapshot.allIncludesForDocument(sourceFile), QSet<FilePath>{newHeader});
}
}
@@ -1066,22 +1062,22 @@ void ModelManagerTest::testRenameIncludesInEditor()
helper.resetRefreshedSourceFiles();
// Copy test files to a temporary directory
QSet<QString> sourceFiles;
QSet<FilePath> sourceFiles;
for (const QString &fileName : fileNames) {
const QString &file = workingDir.filePath(fileName);
QVERIFY(QFile::copy(testDir.file(fileName), file));
// Saving source file names for the model manager update,
// so we can update just the relevant files.
if (ProjectFile::classify(file) == ProjectFile::CXXSource)
sourceFiles.insert(file);
sourceFiles.insert(FilePath::fromString(file));
}
// Update the c++ model manager and check for the old includes
modelManager->updateSourceFiles(sourceFiles).waitForFinished();
QCoreApplication::processEvents();
CPlusPlus::Snapshot snapshot = modelManager->snapshot();
for (const QString &sourceFile : std::as_const(sourceFiles)) {
QCOMPARE(snapshot.allIncludesForDocument(FilePath::fromString(sourceFile)),
for (const FilePath &sourceFile : std::as_const(sourceFiles)) {
QCOMPARE(snapshot.allIncludesForDocument(sourceFile),
QSet<FilePath>{headerWithPragmaOnce});
}
@@ -1160,8 +1156,8 @@ void ModelManagerTest::testRenameIncludesInEditor()
modelManager->updateSourceFiles(sourceFiles).waitForFinished();
QCoreApplication::processEvents();
snapshot = modelManager->snapshot();
for (const QString &sourceFile : std::as_const(sourceFiles)) {
QCOMPARE(snapshot.allIncludesForDocument(FilePath::fromString(sourceFile)),
for (const FilePath &sourceFile : std::as_const(sourceFiles)) {
QCOMPARE(snapshot.allIncludesForDocument(sourceFile),
QSet<FilePath>{renamedHeaderWithPragmaOnce});
}
}

View File

@@ -13,7 +13,7 @@
namespace CppEditor {
ProjectFile::ProjectFile(const QString &filePath, Kind kind, bool active)
ProjectFile::ProjectFile(const Utils::FilePath &filePath, Kind kind, bool active)
: path(filePath)
, kind(kind)
, active(active)

View File

@@ -5,7 +5,7 @@
#include "cppeditor_global.h"
#include <QString>
#include <utils/filepath.h>
namespace Utils { class FilePath; }
@@ -31,7 +31,7 @@ public:
};
ProjectFile() = default;
ProjectFile(const QString &filePath, Kind kind, bool active = true);
ProjectFile(const Utils::FilePath &filePath, Kind kind, bool active = true);
static Kind classifyByMimeType(const QString &mt);
static Kind classify(const QString &filePath);
@@ -58,7 +58,7 @@ public:
friend QDebug operator<<(QDebug stream, const CppEditor::ProjectFile &projectFile);
public:
QString path;
Utils::FilePath path;
Kind kind = Unclassified;
bool active = true;
};
@@ -67,4 +67,4 @@ using ProjectFiles = QVector<ProjectFile>;
const char *projectFileKindToText(ProjectFile::Kind kind);
} // namespace CppEditor
} // CppEditor

View File

@@ -4,6 +4,9 @@
#include "cppprojectfilecategorizer.h"
#include <utils/algorithm.h>
#include <utils/filepath.h>
using namespace Utils;
namespace CppEditor {
@@ -38,7 +41,7 @@ ProjectFiles ProjectFileCategorizer::classifyFiles(const QStringList &filePaths,
ProjectFiles ambiguousHeaders;
for (const QString &filePath : filePaths) {
const ProjectFile projectFile(filePath,
const ProjectFile projectFile(FilePath::fromString(filePath),
getMimeType
? ProjectFile::classifyByMimeType(getMimeType(filePath))
: ProjectFile::classify(filePath),

View File

@@ -19,6 +19,7 @@
#include <QFutureInterface>
using namespace ProjectExplorer;
using namespace Utils;
namespace CppEditor {
@@ -134,11 +135,11 @@ void CppProjectUpdater::checkForExtraCompilersFinished()
m_projectUpdateFutureInterface.reset();
QList<ExtraCompiler *> extraCompilers;
QSet<QString> compilerFiles;
QSet<FilePath> compilerFiles;
for (const QPointer<ExtraCompiler> &compiler : std::as_const(m_extraCompilers)) {
if (compiler) {
extraCompilers += compiler.data();
compilerFiles += Utils::transform<QSet>(compiler->targets(), &Utils::FilePath::toString);
compilerFiles += Utils::toSet(compiler->targets());
}
}
GeneratedCodeModelSupport::update(extraCompilers);

View File

@@ -244,7 +244,7 @@ void CppRefactoringChangesData::reindentSelection(const QTextCursor &selection,
void CppRefactoringChangesData::fileChanged(const FilePath &filePath)
{
m_modelManager->updateSourceFiles({filePath.toString()});
m_modelManager->updateSourceFiles({filePath});
}
} // CppEditor

View File

@@ -283,8 +283,7 @@ CPlusPlus::Document::Ptr TestCase::waitForRehighlightedSemanticDocument(CppEdito
bool TestCase::parseFiles(const QSet<FilePath> &filePaths)
{
QSet<QString> filePaths_ = transform(filePaths, &FilePath::toString);
CppModelManager::instance()->updateSourceFiles(filePaths_).waitForFinished();
CppModelManager::instance()->updateSourceFiles(filePaths).waitForFinished();
QCoreApplication::processEvents();
const CPlusPlus::Snapshot snapshot = globalSnapshot();
if (snapshot.isEmpty()) {

View File

@@ -137,9 +137,9 @@ TestActionsTestCase::TestActionsTestCase(const Actions &tokenActions, const Acti
for (const ProjectInfo::ConstPtr &info : projectInfos) {
qDebug() << "Project" << info->projectFilePath().toUserOutput() << "- files to process:"
<< info->sourceFiles().size();
const QSet<QString> sourceFiles = info->sourceFiles();
for (const QString &sourceFile : sourceFiles)
filesToOpen << FilePath::fromString(sourceFile);
const QSet<FilePath> sourceFiles = info->sourceFiles();
for (const FilePath &sourceFile : sourceFiles)
filesToOpen << sourceFile;
}
Utils::sort(filesToOpen);

View File

@@ -83,7 +83,7 @@ QSet<FilePath> ModelManagerTestHelper::updateProjectInfo(
resetRefreshedSourceFiles();
CppModelManager::instance()->updateProjectInfo(projectInfo).waitForFinished();
QCoreApplication::processEvents();
return Utils::transform(waitForRefreshedSourceFiles(), &FilePath::fromString);
return waitForRefreshedSourceFiles();
}
void ModelManagerTestHelper::resetRefreshedSourceFiles()
@@ -92,12 +92,12 @@ void ModelManagerTestHelper::resetRefreshedSourceFiles()
m_refreshHappened = false;
}
QSet<QString> ModelManagerTestHelper::waitForRefreshedSourceFiles()
QSet<FilePath> ModelManagerTestHelper::waitForRefreshedSourceFiles()
{
while (!m_refreshHappened)
QCoreApplication::processEvents();
return m_lastRefreshedSourceFiles;
return Utils::transform(m_lastRefreshedSourceFiles, &FilePath::fromString);
}
void ModelManagerTestHelper::waitForFinishedGc()

View File

@@ -43,7 +43,7 @@ public:
QSet<Utils::FilePath> updateProjectInfo(const ProjectInfo::ConstPtr &projectInfo);
void resetRefreshedSourceFiles();
QSet<QString> waitForRefreshedSourceFiles();
QSet<Utils::FilePath> waitForRefreshedSourceFiles();
void waitForFinishedGc();
signals:

View File

@@ -9,6 +9,8 @@
#include <projectexplorer/rawprojectpart.h>
#include <projectexplorer/toolchain.h>
using namespace Utils;
namespace CppEditor {
ProjectInfo::ConstPtr ProjectInfo::create(const ProjectExplorer::ProjectUpdateInfo &updateInfo,
@@ -17,16 +19,6 @@ ProjectInfo::ConstPtr ProjectInfo::create(const ProjectExplorer::ProjectUpdateIn
return ConstPtr(new ProjectInfo(updateInfo, projectParts));
}
const QVector<ProjectPart::ConstPtr> ProjectInfo::projectParts() const
{
return m_projectParts;
}
const QSet<QString> ProjectInfo::sourceFiles() const
{
return m_sourceFiles;
}
bool ProjectInfo::operator ==(const ProjectInfo &other) const
{
return m_projectName == other.m_projectName
@@ -58,9 +50,9 @@ bool ProjectInfo::configurationOrFilesChanged(const ProjectInfo &other) const
return configurationChanged(other) || m_sourceFiles != other.m_sourceFiles;
}
static QSet<QString> getSourceFiles(const QVector<ProjectPart::ConstPtr> &projectParts)
static QSet<FilePath> getSourceFiles(const QVector<ProjectPart::ConstPtr> &projectParts)
{
QSet<QString> sourceFiles;
QSet<FilePath> sourceFiles;
for (const ProjectPart::ConstPtr &part : projectParts) {
for (const ProjectFile &file : std::as_const(part->files))
sourceFiles.insert(file.path);

View File

@@ -10,7 +10,8 @@
#include <projectexplorer/project.h>
#include <projectexplorer/rawprojectpart.h>
#include <projectexplorer/toolchain.h>
#include <utils/fileutils.h>
#include <utils/filepath.h>
#include <QHash>
#include <QList>
@@ -28,8 +29,8 @@ public:
static ConstPtr create(const ProjectExplorer::ProjectUpdateInfo &updateInfo,
const QVector<ProjectPart::ConstPtr> &projectParts);
const QVector<ProjectPart::ConstPtr> projectParts() const;
const QSet<QString> sourceFiles() const;
const QVector<ProjectPart::ConstPtr> &projectParts() const { return m_projectParts; }
const QSet<Utils::FilePath> &sourceFiles() const { return m_sourceFiles; }
QString projectName() const { return m_projectName; }
Utils::FilePath projectFilePath() const { return m_projectFilePath; }
Utils::FilePath projectRoot() const { return m_projectFilePath.parentDir(); }
@@ -51,7 +52,7 @@ private:
const Utils::FilePath m_projectFilePath;
const Utils::FilePath m_buildRoot;
const ProjectExplorer::HeaderPaths m_headerPaths;
const QSet<QString> m_sourceFiles;
const QSet<Utils::FilePath> m_sourceFiles;
const ProjectExplorer::Macros m_defines;
};

View File

@@ -14,6 +14,8 @@
#include <cctype>
using namespace Utils;
namespace Todo {
namespace Internal {
@@ -35,7 +37,7 @@ void CppTodoItemsScanner::scannerParamsChanged()
CppEditor::CppModelManager *modelManager = CppEditor::CppModelManager::instance();
QSet<QString> filesToBeUpdated;
QSet<FilePath> filesToBeUpdated;
const CppEditor::ProjectInfoList infoList = modelManager->projectInfos();
for (const CppEditor::ProjectInfo::ConstPtr &info : infoList)
filesToBeUpdated.unite(info->sourceFiles());