summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor/cppeditorwidget.cpp
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2021-08-20 11:21:06 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2021-08-27 10:53:54 +0000
commita952500e902eb0a0fe5b5dbcdafb6cb66fb88141 (patch)
tree744dfbbf969359a3cb147b6bbc8ee47fe361a7ab /src/plugins/cppeditor/cppeditorwidget.cpp
parent5d8551559af2300a67815582198b4ce580a7bba2 (diff)
downloadqt-creator-a952500e902eb0a0fe5b5dbcdafb6cb66fb88141.tar.gz
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>
Diffstat (limited to 'src/plugins/cppeditor/cppeditorwidget.cpp')
-rw-r--r--src/plugins/cppeditor/cppeditorwidget.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/plugins/cppeditor/cppeditorwidget.cpp b/src/plugins/cppeditor/cppeditorwidget.cpp
index ae8fd52db7..45c59fc64b 100644
--- a/src/plugins/cppeditor/cppeditorwidget.cpp
+++ b/src/plugins/cppeditor/cppeditorwidget.cpp
@@ -591,10 +591,10 @@ bool CppEditorWidget::isWidgetHighlighted(QWidget *widget)
namespace {
-QList<ProjectPart::Ptr> fetchProjectParts(CppTools::CppModelManager *modelManager,
+QList<ProjectPart::ConstPtr> fetchProjectParts(CppTools::CppModelManager *modelManager,
const Utils::FilePath &filePath)
{
- QList<ProjectPart::Ptr> projectParts = modelManager->projectPart(filePath);
+ QList<ProjectPart::ConstPtr> projectParts = modelManager->projectPart(filePath);
if (projectParts.isEmpty())
projectParts = modelManager->projectPartFromDependencies(filePath);
@@ -604,12 +604,13 @@ QList<ProjectPart::Ptr> fetchProjectParts(CppTools::CppModelManager *modelManage
return projectParts;
}
-ProjectPart *findProjectPartForCurrentProject(const QList<ProjectPart::Ptr> &projectParts,
- ProjectExplorer::Project *currentProject)
+const ProjectPart *findProjectPartForCurrentProject(
+ const QList<ProjectPart::ConstPtr> &projectParts,
+ ProjectExplorer::Project *currentProject)
{
const auto found = std::find_if(projectParts.cbegin(),
projectParts.cend(),
- [&](const CppTools::ProjectPart::Ptr &projectPart) {
+ [&](const CppTools::ProjectPart::ConstPtr &projectPart) {
return projectPart->belongsToProject(currentProject);
});
@@ -621,7 +622,7 @@ ProjectPart *findProjectPartForCurrentProject(const QList<ProjectPart::Ptr> &pro
} // namespace
-ProjectPart *CppEditorWidget::projectPart() const
+const ProjectPart *CppEditorWidget::projectPart() const
{
if (!d->m_modelManager)
return nullptr;
@@ -680,7 +681,7 @@ void CppEditorWidget::renameSymbolUnderCursor()
{
using ClangBackEnd::SourceLocationsContainer;
- ProjectPart *projPart = projectPart();
+ const ProjectPart *projPart = projectPart();
if (!projPart)
return;