Moc: fix narrowing conversion warnings with range-for loops
Change-Id: I6dee1a6ae82c33bd6523734ee32ab4c83835f9d8 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit db9e206deecab7b78dd2177d4bcaf6415fb84c94) Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
87fc863c27
commit
8d82e24f95
@ -146,8 +146,8 @@ int Generator::stridx(const QByteArray &s)
|
|||||||
static int aggregateParameterCount(const QList<FunctionDef> &list)
|
static int aggregateParameterCount(const QList<FunctionDef> &list)
|
||||||
{
|
{
|
||||||
int sum = 0;
|
int sum = 0;
|
||||||
for (int i = 0; i < list.size(); ++i)
|
for (const FunctionDef &def : list)
|
||||||
sum += list.at(i).arguments.size() + 1; // +1 for return type
|
sum += int(def.arguments.size()) + 1; // +1 for return type
|
||||||
return sum;
|
return sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -592,8 +592,7 @@ void Generator::generateCode()
|
|||||||
// because we definitely printed something above, this section doesn't need comma control
|
// because we definitely printed something above, this section doesn't need comma control
|
||||||
for (const QList<FunctionDef> &methodContainer :
|
for (const QList<FunctionDef> &methodContainer :
|
||||||
{ cdef->signalList, cdef->slotList, cdef->methodList }) {
|
{ cdef->signalList, cdef->slotList, cdef->methodList }) {
|
||||||
for (int i = 0; i< methodContainer.size(); ++i) {
|
for (const FunctionDef &fdef : methodContainer) {
|
||||||
const FunctionDef& fdef = methodContainer.at(i);
|
|
||||||
fprintf(out, ",\n // method '%s'\n %s",
|
fprintf(out, ",\n // method '%s'\n %s",
|
||||||
fdef.name.constData(), stringForType(fdef.type.name, false).constData());
|
fdef.name.constData(), stringForType(fdef.type.name, false).constData());
|
||||||
for (const auto &argument: fdef.arguments)
|
for (const auto &argument: fdef.arguments)
|
||||||
|
@ -1157,8 +1157,9 @@ void Moc::generate(FILE *out, FILE *jsonOutput)
|
|||||||
fprintf(out, "QT_WARNING_DISABLE_GCC(\"-Wuseless-cast\")\n");
|
fprintf(out, "QT_WARNING_DISABLE_GCC(\"-Wuseless-cast\")\n");
|
||||||
|
|
||||||
fputs("", out);
|
fputs("", out);
|
||||||
for (int i = 0; i < classList.size(); ++i) {
|
for (ClassDef &def : classList) {
|
||||||
Generator generator(&classList[i], metaTypes, knownQObjectClasses, knownGadgets, out, requireCompleteTypes);
|
Generator generator(&def, metaTypes, knownQObjectClasses, knownGadgets, out,
|
||||||
|
requireCompleteTypes);
|
||||||
generator.generateCode();
|
generator.generateCode();
|
||||||
}
|
}
|
||||||
fputs("", out);
|
fputs("", out);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user