Fix clang warnings about copies in range-for constructs

Change-Id: If50553964483626e72a816b1d23fa81b45ed9ca7
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Christian Kandeler
2020-06-15 13:40:39 +02:00
parent beee392dd8
commit 48be20cf48
11 changed files with 14 additions and 14 deletions

View File

@@ -332,7 +332,7 @@ static FileInfos sortedFileInfos(const QVector<CppTools::ProjectPart::Ptr> &proj
{ {
FileInfos fileInfos; FileInfos fileInfos;
for (const CppTools::ProjectPart::Ptr projectPart : projectParts) { for (const CppTools::ProjectPart::Ptr &projectPart : projectParts) {
QTC_ASSERT(projectPart, continue); QTC_ASSERT(projectPart, continue);
if (!projectPart->selectedForBuilding) if (!projectPart->selectedForBuilding)
continue; continue;

View File

@@ -276,7 +276,7 @@ QList<CMakeBuildTarget> generateBuildTargets(const PreprocessedData &input,
// CMake sometimes mixes several shell-escaped pieces into one fragment. Disentangle that again: // CMake sometimes mixes several shell-escaped pieces into one fragment. Disentangle that again:
const QStringList parts = QtcProcess::splitArgs(f.fragment); const QStringList parts = QtcProcess::splitArgs(f.fragment);
for (const QString part : parts) { for (const QString &part : parts) {
// Some projects abuse linking to libraries to pass random flags to the linker, so ignore // Some projects abuse linking to libraries to pass random flags to the linker, so ignore
// flags mixed into a fragment // flags mixed into a fragment
if (part.startsWith("-")) if (part.startsWith("-"))

View File

@@ -56,7 +56,7 @@ ProjectInfo ProjectInfoGenerator::generate()
if (m_futureInterface.isCanceled()) if (m_futureInterface.isCanceled())
return ProjectInfo(); return ProjectInfo();
for (const ProjectPart::Ptr part : createProjectParts(rpp)) for (const ProjectPart::Ptr &part : createProjectParts(rpp))
projectInfo.appendProjectPart(part); projectInfo.appendProjectPart(part);
} }
@@ -101,7 +101,7 @@ static ProjectPart::Ptr projectPartFromRawProjectPart(
return part; return part;
} }
QVector<ProjectPart::Ptr> ProjectInfoGenerator::createProjectParts( const QVector<ProjectPart::Ptr> ProjectInfoGenerator::createProjectParts(
const RawProjectPart &rawProjectPart) const RawProjectPart &rawProjectPart)
{ {
using Utils::LanguageExtension; using Utils::LanguageExtension;

View File

@@ -42,7 +42,7 @@ public:
ProjectInfo generate(); ProjectInfo generate();
private: private:
QVector<ProjectPart::Ptr> createProjectParts( const QVector<ProjectPart::Ptr> createProjectParts(
const ProjectExplorer::RawProjectPart &rawProjectPart); const ProjectExplorer::RawProjectPart &rawProjectPart);
ProjectPart::Ptr createProjectPart(const ProjectExplorer::RawProjectPart &rawProjectPart, ProjectPart::Ptr createProjectPart(const ProjectExplorer::RawProjectPart &rawProjectPart,
const ProjectPart::Ptr &templateProjectPart, const ProjectPart::Ptr &templateProjectPart,

View File

@@ -353,7 +353,7 @@ void CtfTimelineModel::addCounterValue(const json &event, qint64 normalizedTime,
if (!event.contains("args")) return; if (!event.contains("args")) return;
// CTF documentation says all keys of 'args' should be displayed in // CTF documentation says all keys of 'args' should be displayed in
// one stacked graph, but we will display them separately: // one stacked graph, but we will display them separately:
for (const auto it : event["args"].items()) { for (const auto &it : event["args"].items()) {
std::string counterName = event.contains("id") ? std::string counterName = event.contains("id") ?
name + event.value("id", "") : name; name + event.value("id", "") : name;
const std::string &key = it.key(); const std::string &key = it.key();

View File

@@ -275,7 +275,7 @@ void IosBuildSettingsWidget::populateProvisioningProfiles()
m_signEntityCombo->clear(); m_signEntityCombo->clear();
const ProvisioningProfiles profiles = IosConfigurations::provisioningProfiles(); const ProvisioningProfiles profiles = IosConfigurations::provisioningProfiles();
if (!profiles.isEmpty()) { if (!profiles.isEmpty()) {
for (const auto profile : profiles) { for (const auto &profile : profiles) {
m_signEntityCombo->addItem(profile->displayName()); m_signEntityCombo->addItem(profile->displayName());
const int index = m_signEntityCombo->count() - 1; const int index = m_signEntityCombo->count() - 1;
m_signEntityCombo->setItemData(index, profile->identifier(), IdentifierRole); m_signEntityCombo->setItemData(index, profile->identifier(), IdentifierRole);

View File

@@ -294,7 +294,7 @@ void ItemLibraryModel::sortSections()
std::sort(m_sections.begin(), m_sections.end(), sectionSort); std::sort(m_sections.begin(), m_sections.end(), sectionSort);
for (const auto itemLibrarySection : m_sections) for (const auto &itemLibrarySection : qAsConst(m_sections))
itemLibrarySection->sortItems(); itemLibrarySection->sortItems();
} }

View File

@@ -74,7 +74,7 @@ bool ItemLibrarySection::updateSectionVisibility(const QString &searchText, bool
*changed = false; *changed = false;
for (const auto itemLibraryItem : m_sectionEntries.items()) { for (const auto &itemLibraryItem : m_sectionEntries.items()) {
bool itemVisible = itemLibraryItem->itemName().toLower().contains(searchText) bool itemVisible = itemLibraryItem->itemName().toLower().contains(searchText)
|| itemLibraryItem->typeName().toLower().contains(searchText); || itemLibraryItem->typeName().toLower().contains(searchText);

View File

@@ -119,7 +119,7 @@ private: // functions
void switchStateEditorViewToBaseState(); void switchStateEditorViewToBaseState();
void switchStateEditorViewToSavedState(); void switchStateEditorViewToSavedState();
QList<QPointer<AbstractView>> views() const; QList<QPointer<AbstractView>> views() const;
QList<QPointer<AbstractView>> standardViews() const; const QList<QPointer<AbstractView> > standardViews() const;
private: // variables private: // variables
ViewManagerData *d; ViewManagerData *d;

View File

@@ -173,7 +173,7 @@ QList<QPointer<AbstractView> > ViewManager::views() const
return list; return list;
} }
QList<QPointer<AbstractView> > ViewManager::standardViews() const const QList<QPointer<AbstractView> > ViewManager::standardViews() const
{ {
QList<QPointer<AbstractView>> list = { QList<QPointer<AbstractView>> list = {
&d->edit3DView, &d->edit3DView,
@@ -238,7 +238,7 @@ void ViewManager::detachAdditionalViews()
void ViewManager::detachStandardViews() void ViewManager::detachStandardViews()
{ {
for (const auto view : standardViews()) { for (const auto &view : standardViews()) {
if (view->isAttached()) if (view->isAttached())
currentModel()->detachView(view); currentModel()->detachView(view);
} }
@@ -280,7 +280,7 @@ void ViewManager::attachViewsExceptRewriterAndComponetView()
int last = time.elapsed(); int last = time.elapsed();
int currentTime = 0; int currentTime = 0;
if (!d->disableStandardViews) { if (!d->disableStandardViews) {
for (const auto view : standardViews()) { for (const auto &view : standardViews()) {
currentModel()->attachView(view); currentModel()->attachView(view);
currentTime = time.elapsed(); currentTime = time.elapsed();
qCInfo(viewBenchmark) << view->widgetInfo().uniqueId << currentTime - last; qCInfo(viewBenchmark) << view->widgetInfo().uniqueId << currentTime - last;

View File

@@ -144,7 +144,7 @@ void FpsLabelAction::fpsHandler(quint16 fpsValues[8])
fpsText = fpsText.arg("--"); fpsText = fpsText.arg("--");
else else
fpsText = fpsText.arg(lastValidFrames); fpsText = fpsText.arg(lastValidFrames);
for (const QPointer<QLabel> label : fpsHandlerLabelList) { for (const QPointer<QLabel> &label : qAsConst(fpsHandlerLabelList)) {
if (label) if (label)
label->setText(fpsText); label->setText(fpsText);
} }