From ace19063cbb02eb0dc05d2c7f1dcb9a9207c7702 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 9 Sep 2020 12:32:30 +0200 Subject: [PATCH] Moc: Require complete types consistently If we require complete types when generating the list of metatypes, then we also need to require them when generating each entry, and vice versa. Change-Id: I68394f8628bb6cd89f77bb829b1d4b5ab35071a0 Reviewed-by: Fawzi Mohamed --- src/tools/moc/generator.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 0df3a43584..1fe366dde4 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -572,7 +572,8 @@ void Generator::generateCode() fprintf(out, " nullptr,\n"); } else { bool needsComma = false; - if (!(requireCompleteTypes || cdef->requireCompleteMethodTypes)) { + const bool requireCompleteness = requireCompleteTypes || cdef->requireCompleteMethodTypes; + if (!requireCompleteness) { fprintf(out, "qt_incomplete_metaTypeArraypropertyList.count(); ++i) { const PropertyDef &p = cdef->propertyList.at(i); - if (requireCompleteTypes) + if (requireCompleteness) fprintf(out, "%s%s", needsComma ? ", " : "", p.type.data()); else fprintf(out, "%sQtPrivate::TypeAndForceComplete<%s, std::true_type>", needsComma ? ", " : "", p.type.data()); @@ -590,13 +591,13 @@ void Generator::generateCode() { cdef->signalList, cdef->slotList, cdef->methodList }) { for (int i = 0; i< methodContainer.count(); ++i) { const FunctionDef& fdef = methodContainer.at(i); - if (requireCompleteTypes) + if (requireCompleteness) fprintf(out, "%s%s", needsComma ? ", " : "", fdef.type.name.data()); else fprintf(out, "%sQtPrivate::TypeAndForceComplete<%s, std::false_type>", needsComma ? ", " : "", fdef.type.name.data()); needsComma = true; for (const auto &argument: fdef.arguments) { - if (requireCompleteTypes) + if (requireCompleteness) fprintf(out, ", %s", argument.type.name.data()); else fprintf(out, ", QtPrivate::TypeAndForceComplete<%s, std::false_type>", argument.type.name.data()); @@ -607,7 +608,7 @@ void Generator::generateCode() for (int i = 0; i< cdef->constructorList.count(); ++i) { const FunctionDef& fdef = cdef->constructorList.at(i); for (const auto &argument: fdef.arguments) { - if (requireCompleteTypes) + if (requireCompleteness) fprintf(out, "%s%s", needsComma ? ", " : "", argument.type.name.data()); else fprintf(out, "%sQtPrivate::TypeAndForceComplete<%s, std::false_type>", needsComma ? ", " : "", argument.type.name.data());