aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorErik Verbruggen <erik.verbruggen@digia.com>2016-02-23 15:18:26 +0100
committerErik Verbruggen <erik.verbruggen@theqtcompany.com>2016-03-05 12:16:59 +0000
commit06d82fdbce5f647ac2651cc28eede456c681953c (patch)
tree50f7af92b9523eacd2a418a793a11411c16dffe1 /src
parent7179050ecf53634befba08cacee5f260ab373f0b (diff)
V4: Replace foreach with range based for loops for statements.
BasicBlock::statements() returns a const reference to a QVector, so it can safely be iterated over without qAsConst. Change-Id: If4e47e0e113adbc87253bb3478208a3a38fed9e2 Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/compiler/qqmltypecompiler.cpp4
-rw-r--r--src/qml/compiler/qv4isel_moth.cpp4
-rw-r--r--src/qml/compiler/qv4isel_util_p.h2
-rw-r--r--src/qml/compiler/qv4ssa.cpp30
4 files changed, 20 insertions, 20 deletions
diff --git a/src/qml/compiler/qqmltypecompiler.cpp b/src/qml/compiler/qqmltypecompiler.cpp
index 33716d57b8..57192a9221 100644
--- a/src/qml/compiler/qqmltypecompiler.cpp
+++ b/src/qml/compiler/qqmltypecompiler.cpp
@@ -2732,7 +2732,7 @@ bool QQmlJavaScriptBindingExpressionSimplificationPass::simplifyBinding(QV4::IR:
return false;
foreach (QV4::IR::BasicBlock *bb, function->basicBlocks()) {
- foreach (QV4::IR::Stmt *s, bb->statements()) {
+ for (QV4::IR::Stmt *s : bb->statements()) {
s->accept(this);
if (!_canSimplify)
return false;
@@ -2902,7 +2902,7 @@ void QQmlIRFunctionCleanser::clean()
foreach (QV4::IR::Function *function, module->functions) {
foreach (QV4::IR::BasicBlock *block, function->basicBlocks()) {
- foreach (QV4::IR::Stmt *s, block->statements()) {
+ for (QV4::IR::Stmt *s : block->statements()) {
s->accept(this);
}
}
diff --git a/src/qml/compiler/qv4isel_moth.cpp b/src/qml/compiler/qv4isel_moth.cpp
index b3468848ca..dcedc54b6e 100644
--- a/src/qml/compiler/qv4isel_moth.cpp
+++ b/src/qml/compiler/qv4isel_moth.cpp
@@ -255,7 +255,7 @@ protected:
if (IR::Jump *jump = s->asJump()) {
IR::MoveMapping moves;
- foreach (IR::Stmt *succStmt, jump->target->statements()) {
+ for (IR::Stmt *succStmt : jump->target->statements()) {
if (IR::Phi *phi = succStmt->asPhi()) {
forceActivation(*phi->targetTemp);
for (int i = 0, ei = phi->d->incoming.size(); i != ei; ++i) {
@@ -404,7 +404,7 @@ void InstructionSelection::run(int functionIndex)
exceptionHandler = _block->catchBlock;
}
- foreach (IR::Stmt *s, _block->statements()) {
+ for (IR::Stmt *s : _block->statements()) {
_currentStatement = s;
if (s->location.isValid()) {
diff --git a/src/qml/compiler/qv4isel_util_p.h b/src/qml/compiler/qv4isel_util_p.h
index 9ef3ef6721..0f207f8368 100644
--- a/src/qml/compiler/qv4isel_util_p.h
+++ b/src/qml/compiler/qv4isel_util_p.h
@@ -149,7 +149,7 @@ public:
if (bb->isRemoved())
continue;
_currentBasicBlock = bb;
- foreach (IR::Stmt *s, bb->statements())
+ for (IR::Stmt *s : bb->statements())
process(s);
}
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index 924fb36794..77b1aef1e8 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -1060,7 +1060,7 @@ public:
currentBB = bb;
killed.assign(function->tempCount, false);
- foreach (Stmt *s, bb->statements())
+ for (Stmt *s : bb->statements())
s->accept(this);
}
}
@@ -1580,7 +1580,7 @@ private:
{
currentBB = bb;
- foreach (Stmt *s, bb->statements()) {
+ for (Stmt *s : bb->statements()) {
currentStmt = s;
s->accept(this);
}
@@ -1588,7 +1588,7 @@ private:
for (BasicBlock *Y : bb->out) {
const int j = Y->in.indexOf(bb);
Q_ASSERT(j >= 0 && j < Y->in.size());
- foreach (Stmt *s, Y->statements()) {
+ for (Stmt *s : Y->statements()) {
if (Phi *phi = s->asPhi()) {
Temp *t = phi->d->incoming[j]->asTemp();
unsigned newTmp = currentNumber(*t);
@@ -1848,7 +1848,7 @@ public:
if (bb->isRemoved())
continue;
- foreach (Stmt *s, bb->statements()) {
+ for (Stmt *s : bb->statements()) {
if (!s)
continue;
@@ -2838,7 +2838,7 @@ public:
continue;
_conversions.clear();
- foreach (Stmt *s, bb->statements()) {
+ for (Stmt *s : bb->statements()) {
_currStmt = s;
s->accept(this);
}
@@ -3563,7 +3563,7 @@ static void cleanupBasicBlocks(IR::Function *function)
int idx = outBB->in.indexOf(bb);
if (idx != -1) {
outBB->in.remove(idx);
- foreach (Stmt *s, outBB->statements()) {
+ for (Stmt *s : outBB->statements()) {
if (Phi *phi = s->asPhi())
phi->d->incoming.remove(idx);
else
@@ -3822,7 +3822,7 @@ void unlink(BasicBlock *from, BasicBlock *to, IR::Function *func, DefUses &defUs
}
// unlink all defs/uses from the statements in the basic block
- foreach (Stmt *s, bb->statements()) {
+ for (Stmt *s : bb->statements()) {
if (!s)
continue;
@@ -4424,7 +4424,7 @@ private:
const int bbIndex = successor->in.indexOf(bb);
Q_ASSERT(bbIndex >= 0);
- foreach (Stmt *s, successor->statements()) {
+ for (Stmt *s : successor->statements()) {
if (Phi *phi = s->asPhi()) {
if (Temp *t = phi->d->incoming.at(bbIndex)->asTemp())
live.insert(*t);
@@ -4434,7 +4434,7 @@ private:
}
}
- QVector<Stmt *> statements = bb->statements();
+ const QVector<Stmt *> &statements = bb->statements();
foreach (const Temp &opd, live)
interval(&opd).addRange(start(bb), end(bb));
@@ -4529,7 +4529,7 @@ public:
foreach (BasicBlock *bb, function->basicBlocks())
if (!bb->isRemoved())
- foreach (Stmt *s, bb->statements())
+ for (Stmt *s : bb->statements())
s->accept(this);
if (convertArgs && function->formals.size() > 0)
@@ -4613,7 +4613,7 @@ public:
{
block = new BasicBlock(originalBlock->function, 0);
- foreach (Stmt *s, originalBlock->statements()) {
+ for (Stmt *s : originalBlock->statements()) {
s->accept(this);
clonedStmt->location = s->location;
}
@@ -4886,7 +4886,7 @@ static void verifyNoPointerSharing(IR::Function *function)
if (bb->isRemoved())
continue;
- foreach (Stmt *s, bb->statements())
+ for (Stmt *s : bb->statements())
s->accept(this);
}
}
@@ -4954,7 +4954,7 @@ public:
if (bb->isRemoved())
continue;
- foreach (Stmt *s, bb->statements()) {
+ for (Stmt *s : bb->statements()) {
if (!hasSideEffects(s)) {
s->location = QQmlJS::AST::SourceLocation();
}
@@ -5172,7 +5172,7 @@ void LifeTimeIntervals::renumber(IR::Function *function)
_basicBlockPosition[bb->index()].start = _lastPosition + 1;
- foreach (Stmt *s, bb->statements()) {
+ for (Stmt *s : bb->statements()) {
if (s->asPhi())
continue;
@@ -5338,7 +5338,7 @@ void Optimizer::convertOutOfSSA() {
for (BasicBlock *successor : bb->out) {
const int inIdx = successor->in.indexOf(bb);
Q_ASSERT(inIdx >= 0);
- foreach (Stmt *s, successor->statements()) {
+ for (Stmt *s : successor->statements()) {
if (Phi *phi = s->asPhi()) {
moves.add(clone(phi->d->incoming[inIdx], function),
clone(phi->targetTemp, function)->asTemp());