forked from qt-creator/qt-creator
bare-metal: Get rid of foreach in favor to range-based for
Change-Id: Icebeb8fdd6b49c71fe72bfa855c08b8943fe8f92 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -112,7 +112,7 @@ void BareMetalDebugSupport::start()
|
||||
QString commands;
|
||||
if (const BuildConfiguration *bc = target->activeBuildConfiguration()) {
|
||||
if (BuildStepList *bsl = bc->stepList(BareMetalGdbCommandsDeployStep::stepId())) {
|
||||
foreach (const BareMetalGdbCommandsDeployStep *bs, bsl->allOfType<BareMetalGdbCommandsDeployStep>()) {
|
||||
for (const BareMetalGdbCommandsDeployStep *bs : bsl->allOfType<BareMetalGdbCommandsDeployStep>()) {
|
||||
if (!commands.endsWith("\n"))
|
||||
commands.append("\n");
|
||||
commands.append(bs->gdbCommands());
|
||||
|
@@ -105,7 +105,7 @@ void GdbServerProviderManager::restoreProviders()
|
||||
|
||||
const QVariantMap map = data.value(key).toMap();
|
||||
bool restored = false;
|
||||
foreach (GdbServerProviderFactory *f, m_factories) {
|
||||
for (GdbServerProviderFactory *f : qAsConst(m_factories)) {
|
||||
if (f->canRestore(map)) {
|
||||
if (GdbServerProvider *p = f->restore(map)) {
|
||||
registerProvider(p);
|
||||
@@ -129,7 +129,7 @@ void GdbServerProviderManager::saveProviders()
|
||||
data.insert(QLatin1String(fileVersionKeyC), 1);
|
||||
|
||||
int count = 0;
|
||||
foreach (const GdbServerProvider *p, m_providers) {
|
||||
for (const GdbServerProvider *p : qAsConst(m_providers)) {
|
||||
if (p->isValid()) {
|
||||
const QVariantMap tmp = p->toMap();
|
||||
if (tmp.isEmpty())
|
||||
|
@@ -124,7 +124,7 @@ GdbServerProviderNode *GdbServerProviderModel::nodeForIndex(const QModelIndex &i
|
||||
void GdbServerProviderModel::apply()
|
||||
{
|
||||
// Remove unused providers
|
||||
foreach (GdbServerProvider *provider, m_providersToRemove)
|
||||
for (GdbServerProvider *provider : qAsConst(m_providersToRemove))
|
||||
GdbServerProviderManager::deregisterProvider(provider);
|
||||
QTC_ASSERT(m_providersToRemove.isEmpty(), m_providersToRemove.clear());
|
||||
|
||||
@@ -144,7 +144,7 @@ void GdbServerProviderModel::apply()
|
||||
|
||||
// Add new (and already updated) providers
|
||||
QStringList skippedProviders;
|
||||
foreach (GdbServerProvider *provider, m_providersToAdd) {
|
||||
for (GdbServerProvider *provider: qAsConst(m_providersToAdd)) {
|
||||
if (!GdbServerProviderManager::registerProvider(provider))
|
||||
skippedProviders << provider->displayName();
|
||||
}
|
||||
|
@@ -95,7 +95,7 @@ QString OpenOcdGdbServerProvider::channel() const
|
||||
QStringList args;
|
||||
// In the pipe mode need to add quotes to each item of arguments;
|
||||
// otherwise running will be stuck.
|
||||
foreach (const QString &a, arguments()) {
|
||||
for (const QString &a : arguments()) {
|
||||
if (a.startsWith(QLatin1Char('\"')) && a.endsWith(QLatin1Char('\"')))
|
||||
continue;
|
||||
args << (QLatin1Char('\"') + a + QLatin1Char('\"'));
|
||||
|
Reference in New Issue
Block a user