From ddfbbd346b522703a5b6f8d274a7f79983e5f319 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 25 Jun 2019 09:33:27 +0200 Subject: shiboken: Introduce nullptr Apply Fixits by Qt Creator with some amendments. Change-Id: Ie8300ddb834adb8b649324562f2c912a4e8cf4ce Reviewed-by: Christian Tismer --- sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp | 2 +- sources/shiboken2/ApiExtractor/tests/testconversionoperator.cpp | 2 +- sources/shiboken2/ApiExtractor/tests/testconversionruletag.cpp | 6 +++--- sources/shiboken2/ApiExtractor/tests/testimplicitconversions.cpp | 2 +- sources/shiboken2/ApiExtractor/tests/testreverseoperators.cpp | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'sources/shiboken2/ApiExtractor/tests') diff --git a/sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp b/sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp index 8a6b59285..98b493c67 100644 --- a/sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp +++ b/sources/shiboken2/ApiExtractor/tests/testabstractmetaclass.cpp @@ -134,7 +134,7 @@ public: const AbstractMetaClass *f = AbstractMetaClass::findClass(classes, QLatin1String("F")); QVERIFY(f); - AbstractMetaClass* no_class = 0; + AbstractMetaClass* no_class = nullptr; QCOMPARE(a->baseClass(), no_class); QCOMPARE(b->baseClass(), a); diff --git a/sources/shiboken2/ApiExtractor/tests/testconversionoperator.cpp b/sources/shiboken2/ApiExtractor/tests/testconversionoperator.cpp index 67865d3aa..142c783a4 100644 --- a/sources/shiboken2/ApiExtractor/tests/testconversionoperator.cpp +++ b/sources/shiboken2/ApiExtractor/tests/testconversionoperator.cpp @@ -64,7 +64,7 @@ void TestConversionOperator::testConversionOperator() QCOMPARE(classC->functions().count(), 3); QCOMPARE(classA->externalConversionOperators().count(), 2); - AbstractMetaFunction* convOp = 0; + AbstractMetaFunction *convOp = nullptr; for (AbstractMetaFunction *func : classB->functions()) { if (func->isConversionOperator()) { convOp = func; diff --git a/sources/shiboken2/ApiExtractor/tests/testconversionruletag.cpp b/sources/shiboken2/ApiExtractor/tests/testconversionruletag.cpp index 8c662d76b..aa2bec5d6 100644 --- a/sources/shiboken2/ApiExtractor/tests/testconversionruletag.cpp +++ b/sources/shiboken2/ApiExtractor/tests/testconversionruletag.cpp @@ -119,7 +119,7 @@ void TestConversionRuleTag::testConversionRuleTagReplace() QVERIFY(toNative); QCOMPARE(toNative->sourceTypeName(), QLatin1String("TargetNone")); QVERIFY(toNative->isCustomType()); - QCOMPARE(toNative->sourceType(), (const TypeEntry*)0); + QCOMPARE(toNative->sourceType(), nullptr); QCOMPARE(toNative->sourceTypeCheck(), QLatin1String("%IN == Target_None")); QCOMPARE(toNative->conversion().simplified(), QLatin1String("DoThat(); DoSomething(); %OUT = A();")); @@ -138,7 +138,7 @@ void TestConversionRuleTag::testConversionRuleTagReplace() QVERIFY(toNative); QCOMPARE(toNative->sourceTypeName(), QLatin1String("String")); QVERIFY(toNative->isCustomType()); - QCOMPARE(toNative->sourceType(), (const TypeEntry*)0); + QCOMPARE(toNative->sourceType(), nullptr); QCOMPARE(toNative->sourceTypeCheck(), QLatin1String("String_Check(%IN)")); QCOMPARE(toNative->conversion().trimmed(), QLatin1String("%OUT = new A(String_AsString(%IN), String_GetSize(%IN));")); } @@ -183,7 +183,7 @@ if (!TargetDateTimeAPI) TargetDateTime_IMPORT;\n\ QVERIFY(toNative); QCOMPARE(toNative->sourceTypeName(), QLatin1String("TargetDate")); QVERIFY(toNative->isCustomType()); - QCOMPARE(toNative->sourceType(), (const TypeEntry*)0); + QCOMPARE(toNative->sourceType(), nullptr); QCOMPARE(toNative->sourceTypeCheck(), QLatin1String("TargetDate_Check(%IN)")); QCOMPARE(toNative->conversion().trimmed(), QLatin1String("if (!TargetDateTimeAPI) TargetDateTime_IMPORT;\n%OUT = new Date(TargetDate_Day(%IN), TargetDate_Month(%IN), TargetDate_Year(%IN));")); diff --git a/sources/shiboken2/ApiExtractor/tests/testimplicitconversions.cpp b/sources/shiboken2/ApiExtractor/tests/testimplicitconversions.cpp index 7b3616daa..26fb148d5 100644 --- a/sources/shiboken2/ApiExtractor/tests/testimplicitconversions.cpp +++ b/sources/shiboken2/ApiExtractor/tests/testimplicitconversions.cpp @@ -151,7 +151,7 @@ void TestImplicitConversions::testWithExternalConversionOperator() AbstractMetaFunctionList externalConvOps = classA->externalConversionOperators(); QCOMPARE(externalConvOps.count(), 1); - const AbstractMetaFunction* convOp = 0; + const AbstractMetaFunction *convOp = nullptr; for (const AbstractMetaFunction *func : classB->functions()) { if (func->isConversionOperator()) convOp = func; diff --git a/sources/shiboken2/ApiExtractor/tests/testreverseoperators.cpp b/sources/shiboken2/ApiExtractor/tests/testreverseoperators.cpp index 2ea95595e..dc4801e18 100644 --- a/sources/shiboken2/ApiExtractor/tests/testreverseoperators.cpp +++ b/sources/shiboken2/ApiExtractor/tests/testreverseoperators.cpp @@ -51,7 +51,7 @@ void TestReverseOperators::testReverseSum() QVERIFY(classA); QCOMPARE(classA->functions().count(), 4); - const AbstractMetaFunction* reverseOp = 0; + const AbstractMetaFunction* reverseOp = nullptr; const AbstractMetaFunction* normalOp = 0; for (const AbstractMetaFunction *func : classA->functions()) { if (func->name() == QLatin1String("operator+")) { @@ -100,8 +100,8 @@ void TestReverseOperators::testReverseSumWithAmbiguity() QVERIFY(classB); QCOMPARE(classB->functions().count(), 4); - const AbstractMetaFunction* reverseOp = 0; - const AbstractMetaFunction* normalOp = 0; + const AbstractMetaFunction *reverseOp = nullptr; + const AbstractMetaFunction *normalOp = nullptr; for (const AbstractMetaFunction *func : classB->functions()) { if (func->name() == QLatin1String("operator+")) { if (func->isReverseOperator()) -- cgit v1.2.3 From e5595a4b3010b1bb4b6f80a0339271a7b26934de Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 25 Jun 2019 09:51:39 +0200 Subject: shiboken: Introduce auto Apply Fixits by Qt Creator with some amendments. Change-Id: Ib2be1012ef7e8a2ad0e6cd130371bf1e941c4264 Reviewed-by: Christian Tismer --- sources/shiboken2/ApiExtractor/tests/testutil.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sources/shiboken2/ApiExtractor/tests') diff --git a/sources/shiboken2/ApiExtractor/tests/testutil.h b/sources/shiboken2/ApiExtractor/tests/testutil.h index c6ad19d7e..c8f446c14 100644 --- a/sources/shiboken2/ApiExtractor/tests/testutil.h +++ b/sources/shiboken2/ApiExtractor/tests/testutil.h @@ -69,7 +69,7 @@ namespace TestUtil arguments.append(QFile::encodeName(tempSource.fileName())); tempSource.write(cppCode, qint64(strlen(cppCode))); tempSource.close(); - AbstractMetaBuilder *builder = new AbstractMetaBuilder; + auto *builder = new AbstractMetaBuilder; if (!builder->build(arguments)) { delete builder; return Q_NULLPTR; -- cgit v1.2.3 From 4ccfd8de6462ce2ed938587eb0518038640c310f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 29 May 2019 14:59:09 +0200 Subject: shiboken: Fix various clang warnings - Avoid copying complex types by using const ref - Use isEmpty() to check for container emptyness - Use range-based for - Use Q_DISABLE_COPY in 'public:' area - Fix spelling error - Use '= default' for trivial constructors/destructors - Remove non-null checks before deletion - Fix misleading indentation - Fix else after return - Simplify boolean expressions - Fix unused parameters, streamline code Change-Id: I8c6cadd8653e220ba8e5bdb4dd55524d13a81768 Reviewed-by: Christian Tismer --- sources/shiboken2/ApiExtractor/tests/testutil.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sources/shiboken2/ApiExtractor/tests') diff --git a/sources/shiboken2/ApiExtractor/tests/testutil.h b/sources/shiboken2/ApiExtractor/tests/testutil.h index c8f446c14..9a2faad5c 100644 --- a/sources/shiboken2/ApiExtractor/tests/testutil.h +++ b/sources/shiboken2/ApiExtractor/tests/testutil.h @@ -47,7 +47,7 @@ namespace TestUtil TypeDatabase* td = TypeDatabase::instance(true); if (apiVersion.isEmpty()) TypeDatabase::clearApiVersions(); - else if (!td->setApiVersion(QLatin1String("*"), apiVersion)) + else if (!TypeDatabase::setApiVersion(QLatin1String("*"), apiVersion)) return nullptr; td->setDropTypeEntries(dropTypeEntries); QBuffer buffer; -- cgit v1.2.3