Moc: use a std::initializer_list<QList *> instead of copying

No need to copy the 3 QLists to iterate over them.

Change-Id: Id0fc7d39012bdaa78e51b1153565df77c7fb889a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
Ahmad Samir 2023-05-21 22:15:43 +03:00
parent cfc098253a
commit 17df4bf528

View File

@ -539,9 +539,9 @@ void Generator::generateCode()
// metatypes for all exposed methods
// because we definitely printed something above, this section doesn't need comma control
for (const QList<FunctionDef> &methodContainer :
{ cdef->signalList, cdef->slotList, cdef->methodList }) {
for (const FunctionDef &fdef : methodContainer) {
const auto allMethods = {&cdef->signalList, &cdef->slotList, &cdef->methodList};
for (const QList<FunctionDef> *methodContainer : allMethods) {
for (const FunctionDef &fdef : *methodContainer) {
fprintf(out, ",\n // method '%s'\n %s",
fdef.name.constData(), stringForType(fdef.type.name, false).constData());
for (const auto &argument: fdef.arguments)