diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-10-22 08:59:03 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-10-27 10:01:34 +0000 |
commit | 8b88410f9f9589235738bb26739d40af4447cc05 (patch) | |
tree | 19276bec219bf2a3c728fdced77b8fb3a45063fc /sources/shiboken2/ApiExtractor/tests/testtemplates.cpp | |
parent | 49bd2b28d4a666107d4d124b9a5cc9fbe88d8fe8 (diff) |
shiboken2: AbstractMetaArgument: use QSharedData[Pointer]
Similar to AbstractMetaType, AbstractMetaArgument was previously
kept as a raw pointer. The data were copied numerous times by
AbstractMetaArgument::copy() when adding the inherited functions to a
AbstractMetaClass.
Similar to what was done for AbstractMetaType in
6cad0686101b252cfdbd1a6768a2b02c39aa1d8a, 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.
* Remove inheritance from AbstractMetaVariable by moving
the fields over.
* Remove the unused field m_originalName.
Change-Id: Ic9e476ca71e163de131fbecc267d0a4e336cb0b9
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/tests/testtemplates.cpp')
-rw-r--r-- | sources/shiboken2/ApiExtractor/tests/testtemplates.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp b/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp index 217b31256..807768236 100644 --- a/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp +++ b/sources/shiboken2/ApiExtractor/tests/testtemplates.cpp @@ -115,7 +115,7 @@ namespace Namespace { QVERIFY(!classB->baseClass()); QVERIFY(classB->baseClassName().isEmpty()); const AbstractMetaFunction* func = classB->findFunction(QLatin1String("foo")); - AbstractMetaType argType = func->arguments().constFirst()->type(); + AbstractMetaType argType = func->arguments().constFirst().type(); QCOMPARE(argType.instantiations().count(), 1); QCOMPARE(argType.typeEntry()->qualifiedCppName(), QLatin1String("QList")); @@ -149,7 +149,7 @@ void func(List<int> arg) {} AbstractMetaFunction *func = globalFuncs.constFirst(); QCOMPARE(func->minimalSignature(), QLatin1String("func(List<int>)")); - QCOMPARE(func->arguments().constFirst()->type().cppSignature(), + QCOMPARE(func->arguments().constFirst().type().cppSignature(), QLatin1String("List<int >")); } @@ -174,7 +174,7 @@ void func(List<int>* arg) {} AbstractMetaFunction* func = globalFuncs.constFirst(); QCOMPARE(func->minimalSignature(), QLatin1String("func(List<int>*)")); - QCOMPARE(func->arguments().constFirst()->type().cppSignature(), + QCOMPARE(func->arguments().constFirst().type().cppSignature(), QLatin1String("List<int > *")); } @@ -199,7 +199,7 @@ void func(List<int>& arg) {} AbstractMetaFunction* func = globalFuncs.constFirst(); QCOMPARE(func->minimalSignature(), QLatin1String("func(List<int>&)")); - QCOMPARE(func->arguments().constFirst()->type().cppSignature(), + QCOMPARE(func->arguments().constFirst().type().cppSignature(), QLatin1String("List<int > &")); } @@ -231,13 +231,13 @@ struct List { const AbstractMetaFunction *append = list->findFunction(QStringLiteral("append")); QVERIFY(append); QCOMPARE(append->arguments().size(), 1); - QCOMPARE(append->arguments().at(0)->type().cppSignature(), QLatin1String("List<T >")); + QCOMPARE(append->arguments().at(0).type().cppSignature(), QLatin1String("List<T >")); // Verify that the parameter of "void erase(Iterator)" is not modified const AbstractMetaFunction *erase = list->findFunction(QStringLiteral("erase")); QVERIFY(erase); QCOMPARE(erase->arguments().size(), 1); QEXPECT_FAIL("", "Clang: Some other code changes the parameter type", Abort); - QCOMPARE(erase->arguments().at(0)->type().cppSignature(), QLatin1String("List::Iterator")); + QCOMPARE(erase->arguments().at(0).type().cppSignature(), QLatin1String("List::Iterator")); } void TestTemplates::testInheritanceFromContainterTemplate() |