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