From cf3843a2684c434a4800a7c11071e77f45817b70 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 17 May 2022 12:24:30 +0200 Subject: moc: Add line breaks to the qt_incomplete_metaTypeArray<> The code is hard to read due to the long line generated. Task-number: QTBUG-100145 Change-Id: I1d1a7a547db71cca1e710d39df809f079fc2dafe Reviewed-by: Fabian Kosmale --- src/tools/moc/generator.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/tools/moc') diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 1d3ba97a3b..3d633debd2 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -539,7 +539,7 @@ void Generator::generateCode() bool needsComma = false; const bool requireCompleteness = requireCompleteTypes || cdef->requireCompleteMethodTypes; if (!requireCompleteness) { - fprintf(out, "qt_incomplete_metaTypeArraypropertyList.count(); ++i) { const PropertyDef &p = cdef->propertyList.at(i); + if (needsComma) + fputs(",\n ", out); if (requireCompleteness) - fprintf(out, "%s%s", needsComma ? ", " : "", p.type.data()); + fputs(p.type.data(), out); else - fprintf(out, "%sQtPrivate::TypeAndForceComplete<%s, std::true_type>", needsComma ? ", " : "", p.type.data()); + fprintf(out, "QtPrivate::TypeAndForceComplete<%s, std::true_type>", p.type.data()); needsComma = true; } // type name for the Q_OJBECT/GADGET itself, void for namespaces auto ownType = !cdef->hasQNamespace ? cdef->classname.data() : "void"; + if (needsComma) + fputs(",\n ", out); if (requireCompleteness) - fprintf(out, "%s%s", needsComma ? ", " : "", ownType); + fputs(ownType, out); else - fprintf(out, "%sQtPrivate::TypeAndForceComplete<%s, std::true_type>", needsComma ? ", " : "", ownType); + fprintf(out, "QtPrivate::TypeAndForceComplete<%s, std::true_type>", ownType); // metatypes for all exposed methods // no need to check for needsComma any longer, as we always need one due to the classname being present @@ -567,14 +571,14 @@ void Generator::generateCode() for (int i = 0; i< methodContainer.count(); ++i) { const FunctionDef& fdef = methodContainer.at(i); if (requireCompleteness) - fprintf(out, ", %s", fdef.type.name.data()); + fprintf(out, ",\n %s", fdef.type.name.data()); else - fprintf(out, ", QtPrivate::TypeAndForceComplete<%s, std::false_type>", fdef.type.name.data()); + fprintf(out, ",\n QtPrivate::TypeAndForceComplete<%s, std::false_type>", fdef.type.name.data()); for (const auto &argument: fdef.arguments) { if (requireCompleteness) fprintf(out, ", %s", argument.type.name.data()); else - fprintf(out, ", QtPrivate::TypeAndForceComplete<%s, std::false_type>", argument.type.name.data()); + fprintf(out, ",\n QtPrivate::TypeAndForceComplete<%s, std::false_type>", argument.type.name.data()); } } fprintf(out, "\n"); @@ -583,12 +587,11 @@ void Generator::generateCode() const FunctionDef& fdef = cdef->constructorList.at(i); for (const auto &argument: fdef.arguments) { if (requireCompleteness) - fprintf(out, ", %s", argument.type.name.data()); + fprintf(out, ",\n %s", argument.type.name.data()); else - fprintf(out, ", QtPrivate::TypeAndForceComplete<%s, std::false_type>", argument.type.name.data()); + fprintf(out, ",\n QtPrivate::TypeAndForceComplete<%s, std::false_type>", argument.type.name.data()); } } - fprintf(out, "\n"); fprintf(out, ">,\n"); fprintf(out, " nullptr\n} };\n\n"); -- cgit v1.2.3