From 630c7b481184b5e0dd2e87b967fed421d574ee02 Mon Sep 17 00:00:00 2001 From: Fabian Kosmale Date: Wed, 1 Apr 2020 09:23:53 +0200 Subject: Cleanups in QMetaProperty This changes the layout of the meta object data, so also bump the meta object revision. Original-patch-by: Lars Knoll Change-Id: I176fb16c207e8ebe59e358e69554be813406232f Reviewed-by: Ulf Hermann --- src/tools/moc/generator.cpp | 43 +++++++----------------------------------- src/tools/moc/moc.cpp | 12 ------------ src/tools/moc/moc.h | 2 -- src/tools/moc/outputrevision.h | 2 +- 4 files changed, 8 insertions(+), 51 deletions(-) (limited to 'src/tools/moc') diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp index 2278ba2603..d2fe5fa446 100644 --- a/src/tools/moc/generator.cpp +++ b/src/tools/moc/generator.cpp @@ -363,11 +363,7 @@ void Generator::generateCode() - cdef->constructorList.count(); // "this" parameters don't have names fprintf(out, " %4d, %4d, // properties\n", cdef->propertyList.count(), cdef->propertyList.count() ? index : 0); - index += cdef->propertyList.count() * 3; - if(cdef->notifyableProperties) - index += cdef->propertyList.count(); - if (cdef->revisionedProperties) - index += cdef->propertyList.count(); + index += cdef->propertyList.count() * QMetaObjectPrivate::IntsPerProperty; fprintf(out, " %4d, %4d, // enums/sets\n", cdef->enumList.count(), cdef->enumList.count() ? index : 0); int enumsIndex = index; @@ -888,12 +884,6 @@ void Generator::generateProperties() if (p.user != "false") flags |= User; - if (p.notifyId != -1) - flags |= Notify; - - if (p.revision > 0) - flags |= Revisioned; - if (p.constant) flags |= Constant; if (p.final) @@ -906,32 +896,13 @@ void Generator::generateProperties() fprintf(out, " %4d, ", stridx(p.name)); generateTypeInfo(p.type); - fprintf(out, ", 0x%.8x,\n", flags); - } - - if(cdef->notifyableProperties) { - fprintf(out, "\n // properties: notify_signal_id\n"); - for (int i = 0; i < cdef->propertyList.count(); ++i) { - const PropertyDef &p = cdef->propertyList.at(i); - if (p.notifyId == -1) { - fprintf(out, " %4d,\n", - 0); - } else if (p.notifyId > -1) { - fprintf(out, " %4d,\n", - p.notifyId); - } else { - const int indexInStrings = strings.indexOf(p.notify); - fprintf(out, " %4d,\n", - indexInStrings | IsUnresolvedSignal); - } - } - } - if (cdef->revisionedProperties) { - fprintf(out, "\n // properties: revision\n"); - for (int i = 0; i < cdef->propertyList.count(); ++i) { - const PropertyDef &p = cdef->propertyList.at(i); - fprintf(out, " %4d,\n", p.revision); + int notifyId = p.notifyId; + if (p.notifyId < -1) { + // signal is in parent class + const int indexInStrings = strings.indexOf(p.notify); + notifyId = indexInStrings | IsUnresolvedSignal; } + fprintf(out, ", 0x%.8x, uint(%d), %d,\n", flags, notifyId, p.revision); } } diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index bfbcde1507..8bb70a76dc 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -1415,10 +1415,6 @@ void Moc::parseProperty(ClassDef *def) createPropertyDef(propDef); next(RPAREN); - if(!propDef.notify.isEmpty()) - def->notifyableProperties++; - if (propDef.revision > 0) - ++def->revisionedProperties; def->propertyList += propDef; } @@ -1512,11 +1508,6 @@ void Moc::parsePrivateProperty(ClassDef *def) createPropertyDef(propDef); - if(!propDef.notify.isEmpty()) - def->notifyableProperties++; - if (propDef.revision > 0) - ++def->revisionedProperties; - def->propertyList += propDef; } @@ -1550,9 +1541,6 @@ void Moc::parsePrivateQProperty(ClassDef *def) next(RPAREN); - if (!propDef.notify.isEmpty()) - def->notifyableProperties++; - def->propertyList += propDef; } diff --git a/src/tools/moc/moc.h b/src/tools/moc/moc.h index 84ddf47a89..4d918c4dbf 100644 --- a/src/tools/moc/moc.h +++ b/src/tools/moc/moc.h @@ -201,9 +201,7 @@ struct ClassDef : BaseDef { QVector propertyList; QVector privateQProperties; QSet qPropertyMembers; - int notifyableProperties = 0; int revisionedMethods = 0; - int revisionedProperties = 0; bool hasQObject = false; bool hasQGadget = false; diff --git a/src/tools/moc/outputrevision.h b/src/tools/moc/outputrevision.h index 594775ca6b..e8d2d1b1b9 100644 --- a/src/tools/moc/outputrevision.h +++ b/src/tools/moc/outputrevision.h @@ -30,6 +30,6 @@ #define OUTPUTREVISION_H // if the output revision changes, you MUST change it in qobjectdefs.h too -enum { mocOutputRevision = 67 }; // moc format output revision +enum { mocOutputRevision = 68 }; // moc format output revision #endif // OUTPUTREVISION_H -- cgit v1.2.3