forked from qt-creator/qt-creator
C++: use argumentCount in loops in initializer.
argumentCount is a more expensive function, so try to call it only once, esp. in loops. Change-Id: I6f0d420352743ec444487ce3f506ef28e5282d1e Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
This commit is contained in:
@@ -145,7 +145,7 @@ public:
|
||||
|
||||
funTy->setReturnType(rewrite->rewriteType(type->returnType()));
|
||||
|
||||
for (unsigned i = 0; i < type->argumentCount(); ++i) {
|
||||
for (unsigned i = 0, argc = type->argumentCount(); i < argc; ++i) {
|
||||
Symbol *arg = type->argumentAt(i);
|
||||
|
||||
Argument *newArg = control()->newArgument(0, 0);
|
||||
|
||||
@@ -140,7 +140,7 @@ private:
|
||||
|
||||
fun->setReturnType(q->apply(funTy->returnType()));
|
||||
|
||||
for (unsigned i = 0; i < funTy->argumentCount(); ++i) {
|
||||
for (unsigned i = 0, argc = funTy->argumentCount(); i < argc; ++i) {
|
||||
Argument *originalArgument = funTy->argumentAt(i)->asArgument();
|
||||
Argument *arg = control()->newArgument(/*sourceLocation*/ 0,
|
||||
originalArgument->name());
|
||||
|
||||
@@ -638,7 +638,7 @@ bool ResolveExpression::visit(CallAST *ast)
|
||||
|
||||
int score = 0;
|
||||
|
||||
for (unsigned i = 0; i < funTy->argumentCount(); ++i) {
|
||||
for (unsigned i = 0, argc = funTy->argumentCount(); i < argc; ++i) {
|
||||
const FullySpecifiedType formalTy = funTy->argumentAt(i)->type();
|
||||
|
||||
FullySpecifiedType actualTy;
|
||||
|
||||
@@ -409,7 +409,7 @@ void TypePrettyPrinter::visit(Function *type)
|
||||
|
||||
_text += QLatin1Char('(');
|
||||
|
||||
for (unsigned index = 0; index < type->argumentCount(); ++index) {
|
||||
for (unsigned index = 0, argc = type->argumentCount(); index < argc; ++index) {
|
||||
if (index != 0)
|
||||
_text += QLatin1String(", ");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user