forked from qt-creator/qt-creator
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:
@@ -332,7 +332,7 @@ static FileInfos sortedFileInfos(const QVector<CppTools::ProjectPart::Ptr> &proj
|
||||
{
|
||||
FileInfos fileInfos;
|
||||
|
||||
for (const CppTools::ProjectPart::Ptr projectPart : projectParts) {
|
||||
for (const CppTools::ProjectPart::Ptr &projectPart : projectParts) {
|
||||
QTC_ASSERT(projectPart, continue);
|
||||
if (!projectPart->selectedForBuilding)
|
||||
continue;
|
||||
|
@@ -276,7 +276,7 @@ QList<CMakeBuildTarget> generateBuildTargets(const PreprocessedData &input,
|
||||
|
||||
// CMake sometimes mixes several shell-escaped pieces into one fragment. Disentangle that again:
|
||||
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
|
||||
// flags mixed into a fragment
|
||||
if (part.startsWith("-"))
|
||||
|
@@ -56,7 +56,7 @@ ProjectInfo ProjectInfoGenerator::generate()
|
||||
if (m_futureInterface.isCanceled())
|
||||
return ProjectInfo();
|
||||
|
||||
for (const ProjectPart::Ptr part : createProjectParts(rpp))
|
||||
for (const ProjectPart::Ptr &part : createProjectParts(rpp))
|
||||
projectInfo.appendProjectPart(part);
|
||||
}
|
||||
|
||||
@@ -101,7 +101,7 @@ static ProjectPart::Ptr projectPartFromRawProjectPart(
|
||||
return part;
|
||||
}
|
||||
|
||||
QVector<ProjectPart::Ptr> ProjectInfoGenerator::createProjectParts(
|
||||
const QVector<ProjectPart::Ptr> ProjectInfoGenerator::createProjectParts(
|
||||
const RawProjectPart &rawProjectPart)
|
||||
{
|
||||
using Utils::LanguageExtension;
|
||||
|
@@ -42,7 +42,7 @@ public:
|
||||
ProjectInfo generate();
|
||||
|
||||
private:
|
||||
QVector<ProjectPart::Ptr> createProjectParts(
|
||||
const QVector<ProjectPart::Ptr> createProjectParts(
|
||||
const ProjectExplorer::RawProjectPart &rawProjectPart);
|
||||
ProjectPart::Ptr createProjectPart(const ProjectExplorer::RawProjectPart &rawProjectPart,
|
||||
const ProjectPart::Ptr &templateProjectPart,
|
||||
|
@@ -353,7 +353,7 @@ void CtfTimelineModel::addCounterValue(const json &event, qint64 normalizedTime,
|
||||
if (!event.contains("args")) return;
|
||||
// CTF documentation says all keys of 'args' should be displayed in
|
||||
// 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") ?
|
||||
name + event.value("id", "") : name;
|
||||
const std::string &key = it.key();
|
||||
|
@@ -275,7 +275,7 @@ void IosBuildSettingsWidget::populateProvisioningProfiles()
|
||||
m_signEntityCombo->clear();
|
||||
const ProvisioningProfiles profiles = IosConfigurations::provisioningProfiles();
|
||||
if (!profiles.isEmpty()) {
|
||||
for (const auto profile : profiles) {
|
||||
for (const auto &profile : profiles) {
|
||||
m_signEntityCombo->addItem(profile->displayName());
|
||||
const int index = m_signEntityCombo->count() - 1;
|
||||
m_signEntityCombo->setItemData(index, profile->identifier(), IdentifierRole);
|
||||
|
@@ -294,7 +294,7 @@ void ItemLibraryModel::sortSections()
|
||||
|
||||
std::sort(m_sections.begin(), m_sections.end(), sectionSort);
|
||||
|
||||
for (const auto itemLibrarySection : m_sections)
|
||||
for (const auto &itemLibrarySection : qAsConst(m_sections))
|
||||
itemLibrarySection->sortItems();
|
||||
}
|
||||
|
||||
|
@@ -74,7 +74,7 @@ bool ItemLibrarySection::updateSectionVisibility(const QString &searchText, bool
|
||||
|
||||
*changed = false;
|
||||
|
||||
for (const auto itemLibraryItem : m_sectionEntries.items()) {
|
||||
for (const auto &itemLibraryItem : m_sectionEntries.items()) {
|
||||
bool itemVisible = itemLibraryItem->itemName().toLower().contains(searchText)
|
||||
|| itemLibraryItem->typeName().toLower().contains(searchText);
|
||||
|
||||
|
@@ -119,7 +119,7 @@ private: // functions
|
||||
void switchStateEditorViewToBaseState();
|
||||
void switchStateEditorViewToSavedState();
|
||||
QList<QPointer<AbstractView>> views() const;
|
||||
QList<QPointer<AbstractView>> standardViews() const;
|
||||
const QList<QPointer<AbstractView> > standardViews() const;
|
||||
|
||||
private: // variables
|
||||
ViewManagerData *d;
|
||||
|
@@ -173,7 +173,7 @@ QList<QPointer<AbstractView> > ViewManager::views() const
|
||||
return list;
|
||||
}
|
||||
|
||||
QList<QPointer<AbstractView> > ViewManager::standardViews() const
|
||||
const QList<QPointer<AbstractView> > ViewManager::standardViews() const
|
||||
{
|
||||
QList<QPointer<AbstractView>> list = {
|
||||
&d->edit3DView,
|
||||
@@ -238,7 +238,7 @@ void ViewManager::detachAdditionalViews()
|
||||
|
||||
void ViewManager::detachStandardViews()
|
||||
{
|
||||
for (const auto view : standardViews()) {
|
||||
for (const auto &view : standardViews()) {
|
||||
if (view->isAttached())
|
||||
currentModel()->detachView(view);
|
||||
}
|
||||
@@ -280,7 +280,7 @@ void ViewManager::attachViewsExceptRewriterAndComponetView()
|
||||
int last = time.elapsed();
|
||||
int currentTime = 0;
|
||||
if (!d->disableStandardViews) {
|
||||
for (const auto view : standardViews()) {
|
||||
for (const auto &view : standardViews()) {
|
||||
currentModel()->attachView(view);
|
||||
currentTime = time.elapsed();
|
||||
qCInfo(viewBenchmark) << view->widgetInfo().uniqueId << currentTime - last;
|
||||
|
@@ -144,7 +144,7 @@ void FpsLabelAction::fpsHandler(quint16 fpsValues[8])
|
||||
fpsText = fpsText.arg("--");
|
||||
else
|
||||
fpsText = fpsText.arg(lastValidFrames);
|
||||
for (const QPointer<QLabel> label : fpsHandlerLabelList) {
|
||||
for (const QPointer<QLabel> &label : qAsConst(fpsHandlerLabelList)) {
|
||||
if (label)
|
||||
label->setText(fpsText);
|
||||
}
|
||||
|
Reference in New Issue
Block a user