From ee657043414b41152207111456f987617318b140 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 28 Aug 2024 09:13:08 -0700 Subject: [PATCH] moc: rename qt_meta_stringdata_%s_t to qt_meta_tag_%s_t It's an empty struct now, a.k.a. a "tag struct". It used to be the type of the actual data prior to QtMocHelpers::stringData(). Change-Id: I490a0b19e05103c74305fffd20c71a51e94fc449 Reviewed-by: Ivan Solovev Reviewed-by: Fabian Kosmale (cherry picked from commit d9b4309f0ec8719b2575bfd8b911d1b950a4d7ca) Reviewed-by: Qt Cherry-pick Bot --- src/tools/moc/generator.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index fb15a7a5ed6..16eb5be4c90 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -257,17 +257,19 @@ void Generator::generateCode() const QByteArray qualifiedClassNameIdentifier = generateQualifiedClassNameIdentifier(cdef->qualified); - // ensure the qt_meta_stringdata_XXXX_t type is local - fprintf(out, "namespace {\n"); + // ensure the qt_meta_tag_XXXX_t type is local + fprintf(out, "namespace {\n" + "struct qt_meta_tag_%s_t {};\n" + "} // unnamed namespace\n\n", + qualifiedClassNameIdentifier.constData()); // -// Build the strings using QtMocHelpers::StringData +// Build the strings using QtMocHelpers::stringData // fprintf(out, "\n#ifdef QT_MOC_HAS_STRINGDATA\n" - "struct qt_meta_stringdata_%s_t {};\n" - "constexpr auto qt_meta_stringdata_%s = QtMocHelpers::stringData(", - qualifiedClassNameIdentifier.constData(), qualifiedClassNameIdentifier.constData()); + "static constexpr auto qt_meta_stringdata_%s = QtMocHelpers::stringData(", + qualifiedClassNameIdentifier.constData()); { char comma = 0; for (const QByteArray &str : strings) { @@ -280,8 +282,7 @@ void Generator::generateCode() fprintf(out, "\n);\n" "#else // !QT_MOC_HAS_STRINGDATA\n"); fprintf(out, "#error \"qtmochelpers.h not found or too old.\"\n"); - fprintf(out, "#endif // !QT_MOC_HAS_STRINGDATA\n"); - fprintf(out, "} // unnamed namespace\n\n"); + fprintf(out, "#endif // !QT_MOC_HAS_STRINGDATA\n\n"); // // build the data array @@ -512,7 +513,7 @@ void Generator::generateCode() return "QtPrivate::TypeAndForceComplete<" % type % forceCompleteType; }; if (!requireCompleteness) { - fprintf(out, " qt_incomplete_metaTypeArray