diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-10-16 13:12:31 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-10-23 05:39:55 +0000 |
commit | 3aa406eb69290686b6a1693abd33d9abb419ae20 (patch) | |
tree | cf53ee3d84f7a3d6deec0deada51e9d39fc633fe /sources/shiboken2/ApiExtractor/tests/testarrayargument.cpp | |
parent | 7c448f5c27a51a60e27a54b79e298b53312ef2a8 (diff) |
shiboken2: AbstractMetaType: use QSharedData[Pointer]
Previously, shiboken2 kept AbstractMetaType by a raw pointer. The data
were copied numerous times by AbstractMetaType::copy() when adding the
inherited functions to a AbstractMetaClass or specializing templates,
sometimes with a bool flag indicating ownership.
To get rid of the copies and ownership issues, change the type
to be based on QSharedData[Pointer]. It can then be passed
around and treated like a C++ value type, with Qt sharing the
data when possible behind the scenes.
- Extract AbstractMetaType to a separate header/source
- Remove unused AbstractMetaType::setInstantiationInCpp()
- Remove unused member m_package
- Rewrite the comparison of AbstractMetaType which
becomes relevant for checking/detaching to do a complete
comparison. It was previously unused, intended for
a different implementation of view types with special cases.
- Rework debug formatting
- Invalid meta types are indicated by the "Invalid" usage pattern
instead of null pointers
Change-Id: Ic4b1feecafb4f0355f39e178c2703b104e45cf6c
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/tests/testarrayargument.cpp')
-rw-r--r-- | sources/shiboken2/ApiExtractor/tests/testarrayargument.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sources/shiboken2/ApiExtractor/tests/testarrayargument.cpp b/sources/shiboken2/ApiExtractor/tests/testarrayargument.cpp index b7b5ead17..ab05802b3 100644 --- a/sources/shiboken2/ApiExtractor/tests/testarrayargument.cpp +++ b/sources/shiboken2/ApiExtractor/tests/testarrayargument.cpp @@ -53,9 +53,9 @@ void TestArrayArgument::testArrayArgumentWithSizeDefinedByInteger() QVERIFY(classA); const AbstractMetaArgument *arg = classA->functions().constLast()->arguments().constFirst(); - QVERIFY(arg->type()->isArray()); - QCOMPARE(arg->type()->arrayElementCount(), 3); - QCOMPARE(arg->type()->arrayElementType()->name(), QLatin1String("double")); + QVERIFY(arg->type().isArray()); + QCOMPARE(arg->type().arrayElementCount(), 3); + QCOMPARE(arg->type().arrayElementType()->name(), QLatin1String("double")); } static QString functionMinimalSignature(const AbstractMetaClass *c, const QString &name) @@ -132,9 +132,9 @@ void TestArrayArgument::testArrayArgumentWithSizeDefinedByEnumValue() QVERIFY(nvalues); const AbstractMetaArgument *arg = classA->functions().constLast()->arguments().constFirst(); - QVERIFY(arg->type()->isArray()); - QCOMPARE(arg->type()->arrayElementCount(), nvalues->value().value()); - QCOMPARE(arg->type()->arrayElementType()->name(), QLatin1String("double")); + QVERIFY(arg->type().isArray()); + QCOMPARE(arg->type().arrayElementCount(), nvalues->value().value()); + QCOMPARE(arg->type().arrayElementType()->name(), QLatin1String("double")); }; void TestArrayArgument::testArrayArgumentWithSizeDefinedByEnumValueFromGlobalEnum() @@ -163,9 +163,9 @@ void TestArrayArgument::testArrayArgumentWithSizeDefinedByEnumValueFromGlobalEnu QVERIFY(nvalues); const AbstractMetaArgument *arg = classA->functions().constLast()->arguments().constFirst(); - QVERIFY(arg->type()->isArray()); - QCOMPARE(arg->type()->arrayElementCount(), nvalues->value().value()); - QCOMPARE(arg->type()->arrayElementType()->name(), QLatin1String("double")); + QVERIFY(arg->type().isArray()); + QCOMPARE(arg->type().arrayElementCount(), nvalues->value().value()); + QCOMPARE(arg->type().arrayElementType()->name(), QLatin1String("double")); }; QTEST_APPLESS_MAIN(TestArrayArgument) |