forked from qt-creator/qt-creator
CppTools: Use only const pointers for ProjectInfo and ProjectPart
All members were already const, but this makes it clear at all points of use that these data structures are immutable. Change-Id: Iea615c090bde462c445d15223caccc561b0c713d Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -41,14 +41,14 @@ public:
|
||||
FileInfo() = default;
|
||||
FileInfo(Utils::FilePath file,
|
||||
CppTools::ProjectFile::Kind kind,
|
||||
CppTools::ProjectPart::Ptr projectPart)
|
||||
CppTools::ProjectPart::ConstPtr projectPart)
|
||||
: file(std::move(file))
|
||||
, kind(kind)
|
||||
, projectPart(projectPart)
|
||||
{}
|
||||
Utils::FilePath file;
|
||||
CppTools::ProjectFile::Kind kind;
|
||||
CppTools::ProjectPart::Ptr projectPart;
|
||||
CppTools::ProjectPart::ConstPtr projectPart;
|
||||
};
|
||||
using FileInfos = std::vector<FileInfo>;
|
||||
|
||||
|
||||
@@ -325,11 +325,11 @@ private:
|
||||
QMap<Utils::FilePath, RefactoringFileInfo> m_refactoringFileInfos;
|
||||
};
|
||||
|
||||
static FileInfos sortedFileInfos(const QVector<CppTools::ProjectPart::Ptr> &projectParts)
|
||||
static FileInfos sortedFileInfos(const QVector<CppTools::ProjectPart::ConstPtr> &projectParts)
|
||||
{
|
||||
FileInfos fileInfos;
|
||||
|
||||
for (const CppTools::ProjectPart::Ptr &projectPart : projectParts) {
|
||||
for (const CppTools::ProjectPart::ConstPtr &projectPart : projectParts) {
|
||||
QTC_ASSERT(projectPart, continue);
|
||||
if (!projectPart->selectedForBuilding)
|
||||
continue;
|
||||
|
||||
@@ -114,8 +114,8 @@ private:
|
||||
Utils::Environment m_environment;
|
||||
Utils::TemporaryDirectory m_temporaryDir;
|
||||
|
||||
CppTools::ProjectInfo::Ptr m_projectInfoBeforeBuild;
|
||||
CppTools::ProjectInfo::Ptr m_projectInfo;
|
||||
CppTools::ProjectInfo::ConstPtr m_projectInfoBeforeBuild;
|
||||
CppTools::ProjectInfo::ConstPtr m_projectInfo;
|
||||
QString m_targetTriple;
|
||||
Utils::Id m_toolChainType;
|
||||
|
||||
|
||||
@@ -141,12 +141,12 @@ static VirtualFileSystemOverlay &vfso()
|
||||
|
||||
static FileInfo getFileInfo(const FilePath &file, Project *project)
|
||||
{
|
||||
const ProjectInfo::Ptr projectInfo = CppModelManager::instance()->projectInfo(project);
|
||||
const ProjectInfo::ConstPtr projectInfo = CppModelManager::instance()->projectInfo(project);
|
||||
if (!projectInfo)
|
||||
return {};
|
||||
|
||||
FileInfo candidate;
|
||||
for (const ProjectPart::Ptr &projectPart : projectInfo->projectParts()) {
|
||||
for (const ProjectPart::ConstPtr &projectPart : projectInfo->projectParts()) {
|
||||
QTC_ASSERT(projectPart, continue);
|
||||
|
||||
for (const ProjectFile &projectFile : qAsConst(projectPart->files)) {
|
||||
|
||||
Reference in New Issue
Block a user