aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-01-03 14:00:50 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2023-01-05 17:32:06 +0100
commit1e3ec1ba2a29e59b580fbd9a5cf6e4e91c8994e2 (patch)
treeedfaa3333c7599db8d4fc2b4c753aae384dcb6ca /sources/shiboken6
parentb8acf6d995a5d84e464476a2718a0921165c3163 (diff)
shiboken6: Port from QSharedPointer to std::shared_ptr
Task-number: QTBUG-109570 Change-Id: Iabdafb0a5ab211e32c1bbf7face78fd5102a49b9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken6')
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp180
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetabuilder_helpers.cpp4
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetafunction.cpp16
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetafunction.h1
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetalang.cpp50
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetalang.h2
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetalang_helpers.h2
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetalang_typedefs.h11
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetatype.cpp31
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetatype.h2
-rw-r--r--sources/shiboken6/ApiExtractor/addedfunction.cpp2
-rw-r--r--sources/shiboken6/ApiExtractor/addedfunction.h5
-rw-r--r--sources/shiboken6/ApiExtractor/apiextractor.cpp18
-rw-r--r--sources/shiboken6/ApiExtractor/apiextractorresult.cpp4
-rw-r--r--sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp96
-rw-r--r--sources/shiboken6/ApiExtractor/codesnip.cpp2
-rw-r--r--sources/shiboken6/ApiExtractor/codesnip.h9
-rw-r--r--sources/shiboken6/ApiExtractor/customconversion.cpp10
-rw-r--r--sources/shiboken6/ApiExtractor/customconversion_typedefs.h5
-rw-r--r--sources/shiboken6/ApiExtractor/debughelpers_p.h12
-rw-r--r--sources/shiboken6/ApiExtractor/docparser.cpp2
-rw-r--r--sources/shiboken6/ApiExtractor/docparser.h5
-rw-r--r--sources/shiboken6/ApiExtractor/doxygenparser.cpp8
-rw-r--r--sources/shiboken6/ApiExtractor/enclosingclassmixin.cpp2
-rw-r--r--sources/shiboken6/ApiExtractor/enclosingclassmixin.h6
-rw-r--r--sources/shiboken6/ApiExtractor/messages.cpp10
-rw-r--r--sources/shiboken6/ApiExtractor/modifications.cpp2
-rw-r--r--sources/shiboken6/ApiExtractor/modifications_typedefs.h5
-rw-r--r--sources/shiboken6/ApiExtractor/parser/codemodel.cpp20
-rw-r--r--sources/shiboken6/ApiExtractor/parser/codemodel.h2
-rw-r--r--sources/shiboken6/ApiExtractor/parser/codemodel_fwd.h31
-rw-r--r--sources/shiboken6/ApiExtractor/parser/typeinfo.cpp6
-rw-r--r--sources/shiboken6/ApiExtractor/qtdocparser.cpp16
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testabstractmetaclass.cpp82
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testabstractmetatype.cpp18
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testaddfunction.cpp74
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testarrayargument.cpp10
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testcodeinjection.cpp8
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testcontainer.cpp10
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testconversionoperator.cpp32
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testconversionruletag.cpp22
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testctorinformation.cpp10
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testdroptypeentries.cpp8
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testdtorinformation.cpp34
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testenum.cpp30
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testextrainclude.cpp8
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testfunctiontag.cpp10
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testimplicitconversions.cpp10
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testinserttemplate.cpp8
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testmodifydocumentation.cpp10
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testmodifyfunction.cpp42
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testmultipleinheritance.cpp2
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testnamespace.cpp16
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testnestedtypes.cpp20
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testnumericaltypedef.cpp4
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testprimitivetypetag.cpp6
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testrefcounttag.cpp8
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testreferencetopointer.cpp6
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testremovefield.cpp4
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testremoveimplconv.cpp8
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp4
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testresolvetype.cpp20
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testreverseoperators.cpp22
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testtemplates.cpp72
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testtyperevision.cpp4
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testvaluetypedefaultctortag.cpp6
-rw-r--r--sources/shiboken6/ApiExtractor/tests/testvoidarg.cpp18
-rw-r--r--sources/shiboken6/ApiExtractor/typedatabase.cpp70
-rw-r--r--sources/shiboken6/ApiExtractor/typedatabase.h7
-rw-r--r--sources/shiboken6/ApiExtractor/typesystem.cpp22
-rw-r--r--sources/shiboken6/ApiExtractor/typesystem_typedefs.h75
-rw-r--r--sources/shiboken6/ApiExtractor/typesystemparser.cpp107
-rw-r--r--sources/shiboken6/ApiExtractor/typesystemparser_p.h9
-rw-r--r--sources/shiboken6/ApiExtractor/xmlutils.cpp4
-rw-r--r--sources/shiboken6/ApiExtractor/xmlutils.h5
-rw-r--r--sources/shiboken6/ApiExtractor/xmlutils_libxslt.cpp4
-rw-r--r--sources/shiboken6/ApiExtractor/xmlutils_libxslt.h5
-rw-r--r--sources/shiboken6/ApiExtractor/xmlutils_qt.h5
-rw-r--r--sources/shiboken6/generator/generator.cpp12
-rw-r--r--sources/shiboken6/generator/generator.h5
-rw-r--r--sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp22
-rw-r--r--sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp8
-rw-r--r--sources/shiboken6/generator/qtdoc/qtxmltosphinx.h5
-rw-r--r--sources/shiboken6/generator/shiboken/cppgenerator.cpp122
-rw-r--r--sources/shiboken6/generator/shiboken/cppgenerator.h5
-rw-r--r--sources/shiboken6/generator/shiboken/cppgenerator_container.cpp2
-rw-r--r--sources/shiboken6/generator/shiboken/headergenerator.cpp16
-rw-r--r--sources/shiboken6/generator/shiboken/overloaddata.cpp10
-rw-r--r--sources/shiboken6/generator/shiboken/overloaddata.h5
-rw-r--r--sources/shiboken6/generator/shiboken/shibokengenerator.cpp44
-rw-r--r--sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py2
-rw-r--r--sources/shiboken6/tests/dumpcodemodel/main.cpp4
-rw-r--r--sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.cpp2
93 files changed, 917 insertions, 883 deletions
diff --git a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
index aead464db..48eb43285 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
@@ -141,12 +141,12 @@ void AbstractMetaBuilderPrivate::checkFunctionModifications()
for (auto it = entries.cbegin(), end = entries.cend(); it != end; ++it) {
TypeEntryCPtr entry = it.value();
- if (entry.isNull())
+ if (!entry)
continue;
if (!entry->isComplex() || !entry->generateCode())
continue;
- auto centry = qSharedPointerCast<const ComplexTypeEntry>(entry);
+ auto centry = std::static_pointer_cast<const ComplexTypeEntry>(entry);
if (!centry->generateCode())
continue;
@@ -160,7 +160,7 @@ void AbstractMetaBuilderPrivate::checkFunctionModifications()
name.truncate(name.indexOf(u'('));
const auto clazz = AbstractMetaClass::findClass(m_metaClasses, centry);
- if (clazz.isNull())
+ if (!clazz)
continue;
bool found = false;
@@ -197,7 +197,7 @@ AbstractMetaClassPtr AbstractMetaBuilderPrivate::argumentToClass(const ArgumentM
if (!type.has_value())
return returned;
TypeEntryCPtr entry = type->typeEntry();
- if (!entry.isNull() && entry->isComplex())
+ if (entry && entry->isComplex())
returned = AbstractMetaClass::findClass(m_metaClasses, entry);
return returned;
}
@@ -267,7 +267,7 @@ void AbstractMetaBuilderPrivate::traverseOperatorFunction(const FunctionModelIte
auto type = translateType(item->type(), currentClass);
const auto retType = type.has_value() ? type->typeEntry() : TypeEntryCPtr{};
const auto otherArgClass = argumentToClass(itemArguments.at(1), currentClass);
- if (!otherArgClass.isNull() && !retType.isNull()
+ if (otherArgClass && retType
&& (retType->isValue() || retType->isObject())
&& retType != baseoperandClass->typeEntry()
&& retType == otherArgClass->typeEntry()) {
@@ -275,7 +275,7 @@ void AbstractMetaBuilderPrivate::traverseOperatorFunction(const FunctionModelIte
firstArgumentIsSelf = false;
}
}
- if (baseoperandClass.isNull())
+ if (!baseoperandClass)
return;
if (item->isSpaceshipOperator() && !item->isDeleted()) {
@@ -472,7 +472,7 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom,
+ QByteArray::number(typeValues.size()) + ")...");
for (const ClassModelItem &item : typeValues) {
if (const auto cls = traverseClass(dom, item, nullptr))
- addAbstractMetaClass(cls, item.data());
+ addAbstractMetaClass(cls, item.get());
}
// We need to know all global enums
@@ -501,7 +501,7 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom,
+ QByteArray::number(typeDefs.size()) + ")...");
for (const TypeDefModelItem &typeDef : typeDefs) {
if (const auto cls = traverseTypeDef(dom, typeDef, nullptr))
- addAbstractMetaClass(cls, typeDef.data());
+ addAbstractMetaClass(cls, typeDef.get());
}
traverseTypesystemTypedefs();
@@ -519,7 +519,7 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom,
continue;
FunctionTypeEntryPtr funcEntry = types->findFunctionType(func->name());
- if (funcEntry.isNull() || !funcEntry->generateCode())
+ if (!funcEntry || !funcEntry->generateCode())
continue;
AbstractMetaFunction *metaFunc = traverseFunction(func, nullptr);
@@ -583,7 +583,7 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom,
&& !AbstractMetaClass::findClass(m_metaClasses, entry)) {
qCWarning(lcShiboken, "%s", qPrintable(msgTypeNotDefined(entry)));
} else if (entry->generateCode() && entry->type() == TypeEntry::FunctionType) {
- auto fte = qSharedPointerCast<const FunctionTypeEntry>(entry);
+ auto fte = std::static_pointer_cast<const FunctionTypeEntry>(entry);
const QStringList &signatures = fte->signatures();
for (const QString &signature : signatures) {
bool ok = false;
@@ -601,13 +601,13 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom,
}
}
} else if (entry->isEnum() && entry->generateCode()) {
- const auto enumEntry = qSharedPointerCast<const EnumTypeEntry>(entry);
+ const auto enumEntry = std::static_pointer_cast<const EnumTypeEntry>(entry);
const auto cls = AbstractMetaClass::findClass(m_metaClasses,
enumEntry->parent());
- const bool enumFound = cls.isNull()
- ? m_enums.contains(entry)
- : cls->findEnum(entry->targetLangEntryName()).has_value();
+ const bool enumFound = cls
+ ? cls->findEnum(entry->targetLangEntryName()).has_value()
+ : m_enums.contains(entry);
if (!enumFound) {
entry->setCodeGeneration(TypeEntry::GenerateNothing);
@@ -693,10 +693,10 @@ bool AbstractMetaBuilder::build(const QByteArrayList &arguments,
{
const FileModelItem dom = d->buildDom(arguments, addCompilerSupportArguments,
level, clangFlags);
- if (dom.isNull())
+ if (!dom)
return false;
if (ReportHandler::isDebug(ReportHandler::MediumDebug))
- qCDebug(lcShiboken) << dom.data();
+ qCDebug(lcShiboken) << dom.get();
d->traverseDom(dom, apiExtractorFlags);
return true;
@@ -751,13 +751,13 @@ AbstractMetaClassPtr
// Continue populating namespace?
AbstractMetaClassPtr metaClass = AbstractMetaClass::findClass(m_metaClasses, type);
- if (metaClass.isNull()) {
+ if (!metaClass) {
metaClass.reset(new AbstractMetaClass);
metaClass->setTypeEntry(type);
- addAbstractMetaClass(metaClass, namespaceItem.data());
+ addAbstractMetaClass(metaClass, namespaceItem.get());
if (auto extendsType = type->extends()) {
const auto extended = AbstractMetaClass::findClass(m_metaClasses, extendsType);
- if (extended.isNull()) {
+ if (!extended) {
qCWarning(lcShiboken, "%s",
qPrintable(msgNamespaceToBeExtendedNotFound(extendsType->name(), extendsType->targetLangPackage())));
return {};
@@ -765,7 +765,7 @@ AbstractMetaClassPtr
metaClass->setExtendedNamespace(extended);
}
} else {
- m_itemToClass.insert(namespaceItem.data(), metaClass);
+ m_itemToClass.insert(namespaceItem.get(), metaClass);
}
traverseEnums(namespaceItem, metaClass, namespaceItem->enumsDeclarations());
@@ -775,10 +775,10 @@ AbstractMetaClassPtr
const ClassList &classes = namespaceItem->classes();
for (const ClassModelItem &cls : classes) {
const auto mjc = traverseClass(dom, cls, metaClass);
- if (!mjc.isNull()) {
+ if (mjc) {
metaClass->addInnerClass(mjc);
mjc->setEnclosingClass(metaClass);
- addAbstractMetaClass(mjc, cls.data());
+ addAbstractMetaClass(mjc, cls.get());
}
}
@@ -787,21 +787,21 @@ AbstractMetaClassPtr
const TypeDefList typeDefs = namespaceItem->typeDefs();
for (const TypeDefModelItem &typeDef : typeDefs) {
const auto cls = traverseTypeDef(dom, typeDef, metaClass);
- if (!cls.isNull()) {
+ if (cls) {
metaClass->addInnerClass(cls);
cls->setEnclosingClass(metaClass);
- addAbstractMetaClass(cls, typeDef.data());
+ addAbstractMetaClass(cls, typeDef.get());
}
}
// Traverse namespaces recursively
for (const NamespaceModelItem &ni : namespaceItem->namespaces()) {
const auto mjc = traverseNamespace(dom, ni);
- if (!mjc.isNull()) {
+ if (mjc) {
metaClass->addInnerClass(mjc);
mjc->setEnclosingClass(metaClass);
- m_classToItem.insert(mjc, ni.data()); // Add for enum lookup.
- m_itemToClass.insert(ni.data(), mjc);
+ m_classToItem.insert(mjc, ni.get()); // Add for enum lookup.
+ m_itemToClass.insert(ni.get(), mjc);
}
}
@@ -882,7 +882,7 @@ std::optional<AbstractMetaEnum>
metaEnum.setHasQEnumsDeclaration(true);
}
- auto enumTypeEntry = qSharedPointerCast<EnumTypeEntry>(typeEntry);
+ auto enumTypeEntry = std::static_pointer_cast<EnumTypeEntry>(typeEntry);
metaEnum.setTypeEntry(enumTypeEntry);
metaEnum.setAccess(enumItem->accessPolicy());
if (metaEnum.access() == Access::Private)
@@ -908,9 +908,9 @@ std::optional<AbstractMetaEnum>
const bool isScopedEnum = enumItem->enumKind() == EnumClass;
const EnumeratorList &enumerators = enumItem->enumerators();
for (const EnumeratorModelItem &e : enumerators) {
- EnumValueTypeEntryPtr enumValue(new EnumValueTypeEntry(e->name(), e->stringValue(),
- enumTypeEntry, isScopedEnum,
- enumTypeEntry->version()));
+ auto enumValue = std::make_shared<EnumValueTypeEntry>(e->name(), e->stringValue(),
+ enumTypeEntry, isScopedEnum,
+ enumTypeEntry->version());
TypeDatabase::instance()->addType(enumValue);
if (e->value().isNullValue())
enumTypeEntry->setNullValue(enumValue);
@@ -943,7 +943,7 @@ AbstractMetaClassPtr AbstractMetaBuilderPrivate::traverseTypeDef(const FileModel
const auto &targetNames = typeDef->type().qualifiedName();
const auto pTarget = targetNames.size() == 1
? types->findPrimitiveType(targetNames.constFirst()) : PrimitiveTypeEntryPtr{};
- if (!ptype.isNull()) {
+ if (ptype) {
ptype->setReferencedTypeEntry(pTarget);
return nullptr;
}
@@ -952,7 +952,8 @@ AbstractMetaClassPtr AbstractMetaBuilderPrivate::traverseTypeDef(const FileModel
// (like size_t = unsigned)? Add it to the type DB.
if (pTarget && isCppPrimitive(basicReferencedNonBuiltinTypeEntry(pTarget))
&& currentClass == nullptr) {
- PrimitiveTypeEntryPtr pte(new PrimitiveTypeEntry(className, {}, {}));
+ auto pte = std::make_shared<PrimitiveTypeEntry>(className, QVersionNumber{},
+ TypeEntryCPtr{});
pte->setReferencedTypeEntry(pTarget);
pte->setBuiltIn(true);
types->addType(pte);
@@ -961,10 +962,10 @@ AbstractMetaClassPtr AbstractMetaBuilderPrivate::traverseTypeDef(const FileModel
// If we haven't specified anything for the typedef, then we don't care
auto type = types->findComplexType(fullClassName);
- if (type.isNull())
+ if (!type)
return nullptr;
- AbstractMetaClassPtr metaClass(new AbstractMetaClass);
+ auto metaClass = std::make_shared<AbstractMetaClass>();
metaClass->setTypeDef(true);
metaClass->setTypeEntry(type);
metaClass->setBaseClassNames(QStringList(typeDef->type().toString()));
@@ -984,7 +985,7 @@ void AbstractMetaBuilderPrivate::traverseTypesystemTypedefs()
const auto &entries = TypeDatabase::instance()->typedefEntries();
for (auto it = entries.begin(), end = entries.end(); it != end; ++it) {
TypedefEntryPtr te = it.value();
- AbstractMetaClassPtr metaClass(new AbstractMetaClass);
+ auto metaClass = std::make_shared<AbstractMetaClass>();
metaClass->setTypeDef(true);
metaClass->setTypeEntry(te->target());
metaClass->setBaseClassNames(QStringList(te->sourceType()));
@@ -1028,9 +1029,9 @@ AbstractMetaClassPtr AbstractMetaBuilderPrivate::traverseClass(const FileModelIt
if (TypeDatabase::instance()->isClassRejected(fullClassName)) {
reason = AbstractMetaBuilder::GenerationDisabled;
- } else if (type.isNull()) {
+ } else if (!type) {
TypeEntryPtr te = TypeDatabase::instance()->findType(fullClassName);
- if (!te.isNull() && !te->isComplex()) {
+ if (te && !te->isComplex()) {
reason = AbstractMetaBuilder::RedefinedToNotClass;
// Set the default include file name
if (!te->include().isValid())
@@ -1050,7 +1051,7 @@ AbstractMetaClassPtr AbstractMetaBuilderPrivate::traverseClass(const FileModelIt
return nullptr;
}
- AbstractMetaClassPtr metaClass(new AbstractMetaClass);
+ auto metaClass = std::make_shared<AbstractMetaClass>();
metaClass->setSourceLocation(classItem->sourceLocation());
metaClass->setTypeEntry(type);
if ((type->typeFlags() & ComplexTypeEntry::ForceAbstract) != 0)
@@ -1086,7 +1087,8 @@ AbstractMetaClassPtr AbstractMetaBuilderPrivate::traverseClass(const FileModelIt
auto argumentParent = typeSystemTypeEntry(metaClass->typeEntry());
for (qsizetype i = 0; i < template_parameters.size(); ++i) {
const TemplateParameterModelItem &param = template_parameters.at(i);
- auto param_type = new TemplateArgumentEntry(param->name(), type->version(),
+ auto param_type =
+ std::make_shared<TemplateArgumentEntry>(param->name(), type->version(),
argumentParent);
param_type->setOrdinal(i);
template_args.append(TypeEntryCPtr(param_type));
@@ -1102,10 +1104,10 @@ AbstractMetaClassPtr AbstractMetaBuilderPrivate::traverseClass(const FileModelIt
const ClassList &innerClasses = classItem->classes();
for (const ClassModelItem &ci : innerClasses) {
const auto cl = traverseClass(dom, ci, metaClass);
- if (!cl.isNull()) {
+ if (cl) {
cl->setEnclosingClass(metaClass);
metaClass->addInnerClass(cl);
- addAbstractMetaClass(cl, ci.data());
+ addAbstractMetaClass(cl, ci.get());
}
}
@@ -1116,9 +1118,9 @@ AbstractMetaClassPtr AbstractMetaBuilderPrivate::traverseClass(const FileModelIt
const TypeDefList typeDefs = classItem->typeDefs();
for (const TypeDefModelItem &typeDef : typeDefs) {
const auto cls = traverseTypeDef(dom, typeDef, metaClass);
- if (!cls.isNull()) {
+ if (cls) {
cls->setEnclosingClass(metaClass);
- addAbstractMetaClass(cls, typeDef.data());
+ addAbstractMetaClass(cls, typeDef.get());
}
}
@@ -1144,8 +1146,8 @@ void AbstractMetaBuilderPrivate::traverseScopeMembers(const ScopeModelItem &item
void AbstractMetaBuilderPrivate::traverseClassMembers(const ClassModelItem &item)
{
- const auto metaClass = m_itemToClass.value(item.data());
- if (!metaClass.isNull()) // Class members
+ const auto metaClass = m_itemToClass.value(item.get());
+ if (metaClass) // Class members
traverseScopeMembers(item, metaClass);
}
@@ -1176,8 +1178,8 @@ void AbstractMetaBuilderPrivate::traverseUsingMembers(const AbstractMetaClassPtr
void AbstractMetaBuilderPrivate::traverseNamespaceMembers(const NamespaceModelItem &item)
{
- const auto metaClass = m_itemToClass.value(item.data());
- if (metaClass.isNull())
+ const auto metaClass = m_itemToClass.value(item.get());
+ if (!metaClass)
return;
// Namespace members
@@ -1294,7 +1296,7 @@ void AbstractMetaBuilderPrivate::fixReturnTypeOfConversionOperator(AbstractMetaF
castTo.remove(0, 6);
TypeEntryPtr retType = types->findType(castTo);
- if (retType.isNull())
+ if (!retType)
return;
AbstractMetaType metaType(retType);
@@ -1517,7 +1519,7 @@ bool AbstractMetaBuilderPrivate::setupInheritance(const AbstractMetaClassPtr &me
ComplexTypeEntryPtr baseContainerType;
const auto templ = findTemplateClass(baseClasses.constFirst(), metaClass,
&info, &baseContainerType);
- if (!templ.isNull()) {
+ if (templ) {
setupInheritance(templ);
inheritTemplate(metaClass, templ, info);
metaClass->typeEntry()->setBaseContainerType(templ->typeEntry());
@@ -1643,7 +1645,7 @@ AbstractMetaFunction *
return nullptr;
}
- auto metaFunction = new AbstractMetaFunction(addedFunc);
+ auto *metaFunction = new AbstractMetaFunction(addedFunc);
metaFunction->setType(returnType.value());
metaFunction->setFunctionType(functionTypeFromName(addedFunc->name()));
@@ -2253,7 +2255,7 @@ TypeEntryCList AbstractMetaBuilderPrivate::findTypeEntries(const QString &qualif
for (qsizetype i = 0, size = types.size(); i < size; ++i) {
const auto &e = types.at(i);
if (e->isPrimitive()) {
- const auto pte = qSharedPointerCast<const PrimitiveTypeEntry>(e);
+ const auto pte = std::static_pointer_cast<const PrimitiveTypeEntry>(e);
types[i] = basicReferencedNonBuiltinTypeEntry(pte);
}
}
@@ -2313,7 +2315,7 @@ static AbstractMetaFunctionPtr
addMethod(const AbstractMetaClassPtr &s, const AbstractMetaType &returnType,
const QString &name, bool isConst = true)
{
- AbstractMetaFunctionPtr function(new AbstractMetaFunction(name));
+ auto function = std::make_shared<AbstractMetaFunction>(name);
function->setType(returnType);
AbstractMetaClass::addFunction(s, function);
function->setConstant(isConst);
@@ -2326,7 +2328,7 @@ static AbstractMetaFunctionPtr
const QString &name, bool isConst = true)
{
auto typeEntry = TypeDatabase::instance()->findPrimitiveType(returnTypeName);
- Q_ASSERT(!typeEntry.isNull());
+ Q_ASSERT(typeEntry);
AbstractMetaType returnType(typeEntry);
returnType.decideUsagePattern();
return addMethod(s, returnType, name, isConst);
@@ -2369,7 +2371,7 @@ static void fixSmartPointerConstructors(const AbstractMetaClassPtr &s,
}
if (!seenParameter) {
- AbstractMetaFunctionPtr constructor(new AbstractMetaFunction(s->name()));
+ auto constructor = std::make_shared<AbstractMetaFunction>(s->name());
constructor->setFunctionType(AbstractMetaFunction::ConstructorFunction);
constructor->addArgument(pointeeArgument(s, ste));
AbstractMetaClass::addFunction(s, constructor);
@@ -2377,7 +2379,7 @@ static void fixSmartPointerConstructors(const AbstractMetaClassPtr &s,
}
if (!seenDefaultConstructor) {
- AbstractMetaFunctionPtr constructor(new AbstractMetaFunction(s->name()));
+ auto constructor = std::make_shared<AbstractMetaFunction>(s->name());
constructor->setFunctionType(AbstractMetaFunction::ConstructorFunction);
AbstractMetaClass::addFunction(s, constructor);
synthesizeWarning(constructor);
@@ -2400,14 +2402,14 @@ static void fixSmartPointerReset(const AbstractMetaClassPtr &s,
}
if (!seenParameter) {
- AbstractMetaFunctionPtr f(new AbstractMetaFunction(resetMethodName));
+ auto f = std::make_shared<AbstractMetaFunction>(resetMethodName);
f->addArgument(pointeeArgument(s, ste));
AbstractMetaClass::addFunction(s, f);
synthesizeWarning(f);
}
if (!seenParameterLess) {
- AbstractMetaFunctionPtr f(new AbstractMetaFunction(resetMethodName));
+ auto f = std::make_shared<AbstractMetaFunction>(resetMethodName);
AbstractMetaClass::addFunction(s, f);
synthesizeWarning(f);
}
@@ -2423,22 +2425,22 @@ static void fixSmartPointerClass(const AbstractMetaClassPtr &s,
fixSmartPointerReset(s, ste);
const QString getterName = ste->getter();
- if (s->findFunction(getterName).isNull())
+ if (!s->findFunction(getterName))
addMethod(s, instantiationType(s, ste), getterName);
const QString refCountName = ste->refCountMethodName();
- if (!refCountName.isEmpty() && s->findFunction(refCountName).isNull())
+ if (!refCountName.isEmpty() && !s->findFunction(refCountName))
addMethod(s, u"int"_s, refCountName);
const QString valueCheckMethod = ste->valueCheckMethod();
- if (!valueCheckMethod.isEmpty() && s->findFunction(valueCheckMethod).isNull()) {
+ if (!valueCheckMethod.isEmpty() && !s->findFunction(valueCheckMethod)) {
auto f = addMethod(s, u"bool"_s, valueCheckMethod);
if (valueCheckMethod == u"operator bool")
f->setFunctionType(AbstractMetaFunction::ConversionOperator);
}
const QString nullCheckMethod = ste->nullCheckMethod();
- if (!nullCheckMethod.isEmpty() && s->findFunction(nullCheckMethod).isNull())
+ if (!nullCheckMethod.isEmpty() && !s->findFunction(nullCheckMethod))
addMethod(s, u"bool"_s, nullCheckMethod);
}
@@ -2446,20 +2448,20 @@ static void fixSmartPointerClass(const AbstractMetaClassPtr &s,
static AbstractMetaClassPtr createSmartPointerClass(const SmartPointerTypeEntryCPtr &ste,
const AbstractMetaClassList &allClasses)
{
- AbstractMetaClassPtr result(new AbstractMetaClass());
- result->setTypeEntry(qSharedPointerConstCast<SmartPointerTypeEntry>(ste));
- TypeEntryCPtr templateArg(new TemplateArgumentEntry(u"T"_s, ste->version(),
- typeSystemTypeEntry(ste)));
+ auto result = std::make_shared<AbstractMetaClass>();
+ result->setTypeEntry(std::const_pointer_cast<SmartPointerTypeEntry>(ste));
+ auto templateArg = std::make_shared<TemplateArgumentEntry>(u"T"_s, ste->version(),
+ typeSystemTypeEntry(ste));
result->setTemplateArguments({templateArg});
fixSmartPointerClass(result, ste);
auto enclosingTe = ste->parent();
if (!enclosingTe->isTypeSystem()) {
const auto enclosing = AbstractMetaClass::findClass(allClasses, enclosingTe);
- if (enclosing.isNull())
+ if (!enclosing)
throw Exception(msgEnclosingClassNotFound(ste));
result->setEnclosingClass(enclosing);
auto inner = enclosing->innerClasses();
- inner.append(qSharedPointerConstCast<const AbstractMetaClass>(result));
+ inner.append(std::const_pointer_cast<const AbstractMetaClass>(result));
enclosing->setInnerClasses(inner);
}
return result;
@@ -2471,8 +2473,8 @@ void AbstractMetaBuilderPrivate::fixSmartPointers()
for (const auto &ste : smartPointerTypes) {
const auto smartPointerClass =
AbstractMetaClass::findClass(m_smartPointers, ste);
- if (!smartPointerClass.isNull()) {
- fixSmartPointerClass(qSharedPointerConstCast<AbstractMetaClass>(smartPointerClass),
+ if (smartPointerClass) {
+ fixSmartPointerClass(std::const_pointer_cast<AbstractMetaClass>(smartPointerClass),
ste);
} else {
qCWarning(lcShiboken, "Synthesizing smart pointer \"%s\"...",
@@ -2596,8 +2598,8 @@ std::optional<AbstractMetaType>
arrayType.setArrayElementCount(int(elems));
}
auto elementTypeEntry = elementType->typeEntry();
- TypeEntryCPtr at(new ArrayTypeEntry(elementTypeEntry, elementTypeEntry->version(),
- elementTypeEntry->parent()));
+ auto at = std::make_shared<ArrayTypeEntry>(elementTypeEntry, elementTypeEntry->version(),
+ elementTypeEntry->parent());
arrayType.setTypeEntry(at);
arrayType.decideUsagePattern();
@@ -2680,7 +2682,7 @@ std::optional<AbstractMetaType>
} else {
auto it = std::find_if(types.cbegin(), types.cend(),
[instantiationType](const TypeEntryCPtr &e) {
- auto smartPtr = qSharedPointerCast<const SmartPointerTypeEntry>(e);
+ auto smartPtr = std::static_pointer_cast<const SmartPointerTypeEntry>(e);
return smartPtr->matchesInstantiation(instantiationType);
});
if (it == types.cend()) {
@@ -2978,7 +2980,7 @@ AbstractMetaClassCList
? findTemplateClass(parent, metaClass)
: AbstractMetaClass::findClass(m_metaClasses, parent);
- if (!cls.isNull())
+ if (cls)
baseClasses << cls;
}
return baseClasses;
@@ -2996,7 +2998,7 @@ std::optional<AbstractMetaType>
returned.setOriginalTemplateType(metaType);
if (returned.typeEntry()->isTemplateArgument()) {
- const auto tae = qSharedPointerCast<const TemplateArgumentEntry>(returned.typeEntry());
+ const auto tae = std::static_pointer_cast<const TemplateArgumentEntry>(returned.typeEntry());
// If the template is intantiated with void we special case this as rejecting the functions that use this
// parameter from the instantiation.
@@ -3032,7 +3034,7 @@ AbstractMetaClassPtr
const AbstractMetaTypeList &templateTypes,
InheritTemplateFlags flags)
{
- AbstractMetaClassPtr result(new AbstractMetaClass);
+ auto result = std::make_shared<AbstractMetaClass>();
result->setTypeDef(true);
result->setTypeEntry(te);
@@ -3150,7 +3152,7 @@ AbstractMetaFunctionPtr
const AbstractMetaClassPtr &subclass)
{
AbstractMetaFunctionPtr f = inheritTemplateFunction(function, templateTypes);
- if (f.isNull())
+ if (!f)
return {};
// There is no base class in the target language to inherit from here, so
@@ -3248,7 +3250,7 @@ void AbstractMetaBuilderPrivate::inheritTemplateFunctions(const AbstractMetaClas
templateClass, subclass)) {
AbstractMetaFunctionCPtr f = inheritTemplateMember(function, templateTypes,
templateClass, subclass);
- if (!f.isNull())
+ if (f)
AbstractMetaClass::addFunction(subclass, f);
}
}
@@ -3322,7 +3324,7 @@ void AbstractMetaBuilderPrivate::setupExternalConversion(const AbstractMetaClass
continue;
const auto metaClass =
AbstractMetaClass::findClass(m_metaClasses, func->type().typeEntry());
- if (metaClass.isNull())
+ if (!metaClass)
continue;
metaClass->addExternalConversionOperator(func);
}
@@ -3402,10 +3404,10 @@ void AbstractMetaBuilderPrivate::dumpLog() const
// AbstractMetaClassList/AbstractMetaClassCList.
// Add a dependency of the class associated with typeEntry on clazz.
template <class MetaClass>
-static bool addClassDependency(const QList<QSharedPointer<MetaClass> > &classList,
+static bool addClassDependency(const QList<std::shared_ptr<MetaClass> > &classList,
const TypeEntryCPtr &typeEntry,
- QSharedPointer<MetaClass> clazz,
- Graph<QSharedPointer<MetaClass> > *graph)
+ std::shared_ptr<MetaClass> clazz,
+ Graph<std::shared_ptr<MetaClass> > *graph)
{
if (!typeEntry->isComplex() || typeEntry == clazz->typeEntry())
return false;
@@ -3416,11 +3418,11 @@ static bool addClassDependency(const QList<QSharedPointer<MetaClass> > &classLis
}
template <class MetaClass>
-static QList<QSharedPointer<MetaClass> >
- topologicalSortHelper(const QList<QSharedPointer<MetaClass> > &classList,
+static QList<std::shared_ptr<MetaClass> >
+ topologicalSortHelper(const QList<std::shared_ptr<MetaClass> > &classList,
const Dependencies &additionalDependencies)
{
- Graph<QSharedPointer<MetaClass> > graph(classList.cbegin(), classList.cend());
+ Graph<std::shared_ptr<MetaClass> > graph(classList.cbegin(), classList.cend());
for (const auto &dep : additionalDependencies) {
if (!graph.addEdge(dep.parent, dep.child)) {
@@ -3432,12 +3434,12 @@ static QList<QSharedPointer<MetaClass> >
for (const auto &clazz : classList) {
if (auto enclosingC = clazz->enclosingClass()) {
- const auto enclosing = qSharedPointerConstCast<MetaClass>(enclosingC);
+ const auto enclosing = std::const_pointer_cast<MetaClass>(enclosingC);
graph.addEdge(enclosing, clazz);
}
for (const auto &baseClass : clazz->baseClasses())
- graph.addEdge(qSharedPointerConstCast<MetaClass>(baseClass), clazz);
+ graph.addEdge(std::const_pointer_cast<MetaClass>(baseClass), clazz);
for (const auto &func : clazz->functions()) {
const AbstractMetaArgumentList &arguments = func->arguments();
@@ -3508,8 +3510,8 @@ void AbstractMetaBuilderPrivate::pushScope(const NamespaceModelItem &item)
}
}
if (candidates.size() > 1) {
- NamespaceModelItem joined(new _NamespaceModelItem(m_scopes.constLast()->model(),
- name, _CodeModelItem::Kind_Namespace));
+ auto joined = std::make_shared<_NamespaceModelItem>(m_scopes.constLast()->model(),
+ name, _CodeModelItem::Kind_Namespace);
joined->setScope(item->scope());
for (const auto &n : candidates)
joined->appendNamespace(*n);
diff --git a/sources/shiboken6/ApiExtractor/abstractmetabuilder_helpers.cpp b/sources/shiboken6/ApiExtractor/abstractmetabuilder_helpers.cpp
index 35ca2580f..07cedd09e 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetabuilder_helpers.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetabuilder_helpers.cpp
@@ -95,11 +95,11 @@ QString AbstractMetaBuilderPrivate::fixEnumDefault(const AbstractMetaType &type,
EnumTypeEntryCPtr enumTypeEntry;
FlagsTypeEntryCPtr flagsTypeEntry;
if (typeEntry->isFlags()) {
- flagsTypeEntry = qSharedPointerCast<const FlagsTypeEntry>(typeEntry);
+ flagsTypeEntry = std::static_pointer_cast<const FlagsTypeEntry>(typeEntry);
enumTypeEntry = flagsTypeEntry->originator();
} else {
Q_ASSERT(typeEntry->isEnum());
- enumTypeEntry = qSharedPointerCast<const EnumTypeEntry>(typeEntry);
+ enumTypeEntry = std::static_pointer_cast<const EnumTypeEntry>(typeEntry);
}
// Use the enum's qualified name (would otherwise be "QFlags<Enum>")
if (!enumTypeEntry->qualifiedCppName().contains(u"::"))
diff --git a/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp b/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp
index ea1aaf0ea..613138207 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp
@@ -274,7 +274,7 @@ void AbstractMetaFunction::setFlags(Flags f)
*/
bool AbstractMetaFunction::isModifiedRemoved(AbstractMetaClassCPtr cls) const
{
- if (!isInGlobalScope() && cls.isNull())
+ if (!isInGlobalScope() && !cls)
cls = d->m_implementingClass;
for (const auto &mod : modifications(cls)) {
if (mod.isRemoved())
@@ -482,7 +482,7 @@ bool AbstractMetaFunction::isWhiteListed() const
case NormalFunction:
case SignalFunction:
case SlotFunction:
- if (auto dc = declaringClass(); !dc.isNull()) {
+ if (auto dc = declaringClass()) {
const QSet<QString> &whiteList = dc->typeEntry()->generateFunctions();
return whiteList.isEmpty() || whiteList.contains(d->m_name)
|| whiteList.contains(minimalSignature());
@@ -555,12 +555,12 @@ void AbstractMetaFunction::setConstant(bool constant)
bool AbstractMetaFunction::isUserAdded() const
{
- return !d->m_addedFunction.isNull() && !d->m_addedFunction->isDeclaration();
+ return d->m_addedFunction && !d->m_addedFunction->isDeclaration();
}
bool AbstractMetaFunction::isUserDeclared() const
{
- return !d->m_addedFunction.isNull() && d->m_addedFunction->isDeclaration();
+ return d->m_addedFunction && d->m_addedFunction->isDeclaration();
}
int AbstractMetaFunction::actualMinimumArgumentCount() const
@@ -1030,7 +1030,7 @@ const FunctionModificationList &
AbstractMetaFunctionPrivate::modifications(const AbstractMetaFunction *q,
const AbstractMetaClassCPtr &implementor) const
{
- if (!m_addedFunction.isNull())
+ if (m_addedFunction)
return m_addedFunction->modifications();
for (const auto &ce : m_modificationCache) {
if (ce.klass == implementor)
@@ -1047,7 +1047,7 @@ const FunctionModificationList &
const FunctionModificationList &
AbstractMetaFunction::modifications(AbstractMetaClassCPtr implementor) const
{
- if (implementor.isNull())
+ if (!implementor)
implementor = d->m_class;
return d->modifications(this, implementor);
}
@@ -1059,8 +1059,8 @@ void AbstractMetaFunction::clearModificationsCache()
const DocModificationList AbstractMetaFunction::addedFunctionDocModifications() const
{
- return d->m_addedFunction.isNull()
- ? DocModificationList{} : d->m_addedFunction->docModifications();
+ return d->m_addedFunction
+ ? d->m_addedFunction->docModifications() : DocModificationList{};
}
QString AbstractMetaFunction::argumentName(int index,
diff --git a/sources/shiboken6/ApiExtractor/abstractmetafunction.h b/sources/shiboken6/ApiExtractor/abstractmetafunction.h
index 6f9bf741a..44509f3d0 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetafunction.h
+++ b/sources/shiboken6/ApiExtractor/abstractmetafunction.h
@@ -11,6 +11,7 @@
#include "typesystem_typedefs.h"
#include "parser/codemodel_enums.h"
+#include <QtCore/QMetaObject>
#include <QtCore/QScopedPointer>
#include <optional>
diff --git a/sources/shiboken6/ApiExtractor/abstractmetalang.cpp b/sources/shiboken6/ApiExtractor/abstractmetalang.cpp
index 8138b9d3f..ce0725378 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetalang.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetalang.cpp
@@ -349,7 +349,7 @@ void AbstractMetaClassPrivate::setFunctions(const AbstractMetaFunctionCList &fun
sortFunctions();
for (const auto &f : std::as_const(m_functions)) {
- qSharedPointerConstCast<AbstractMetaFunction>(f)->setOwnerClass(q);
+ std::const_pointer_cast<AbstractMetaFunction>(f)->setOwnerClass(q);
if (!f->isPublic())
m_hasNonpublic = true;
}
@@ -391,7 +391,7 @@ void AbstractMetaClassPrivate::addFunction(const AbstractMetaFunctionCPtr &funct
void AbstractMetaClass::addFunction(const AbstractMetaClassPtr &klass,
const AbstractMetaFunctionCPtr &function)
{
- auto nonConstF = qSharedPointerConstCast<AbstractMetaFunction>(function);
+ auto nonConstF = std::const_pointer_cast<AbstractMetaFunction>(function);
nonConstF->setOwnerClass(klass);
// Set the default value of the declaring class. This may be changed
@@ -465,7 +465,7 @@ const AbstractMetaClassCList &AbstractMetaClass::baseClasses() const
AbstractMetaClassCList AbstractMetaClass::typeSystemBaseClasses() const
{
AbstractMetaClassCList result = d->m_baseClasses;
- if (!d->m_defaultSuperclass.isNull()) {
+ if (d->m_defaultSuperclass) {
result.removeAll(d->m_defaultSuperclass);
result.prepend(d->m_defaultSuperclass);
}
@@ -546,7 +546,7 @@ bool AbstractMetaClass::isInlineNamespace() const
{
bool result = false;
if (d->m_typeEntry->isNamespace()) {
- const auto nte = qSharedPointerCast<const NamespaceTypeEntry>(d->m_typeEntry);
+ const auto nte = std::static_pointer_cast<const NamespaceTypeEntry>(d->m_typeEntry);
result = nte->isInlineNamespace();
}
return result;
@@ -564,7 +564,7 @@ QString AbstractMetaClass::qualifiedCppName() const
bool AbstractMetaClass::hasFunction(const QString &str) const
{
- return !findFunction(str).isNull();
+ return bool(findFunction(str));
}
AbstractMetaFunctionCPtr AbstractMetaClass::findFunction(QStringView functionName) const
@@ -803,7 +803,7 @@ bool AbstractMetaClass::hasCopyConstructor() const
bool AbstractMetaClass::hasPrivateCopyConstructor() const
{
const auto copyCt = copyConstructor();
- return !copyCt.isNull() && copyCt->isPrivate();
+ return copyCt && copyCt->isPrivate();
}
void AbstractMetaClassPrivate::addConstructor(AbstractMetaFunction::FunctionType t,
@@ -862,7 +862,7 @@ AbstractMetaFunction *
static AbstractMetaType boolType()
{
auto boolType = TypeDatabase::instance()->findType(u"bool"_s);
- Q_ASSERT(!boolType.isNull());
+ Q_ASSERT(boolType);
AbstractMetaType result(boolType);
result.decideUsagePattern();
return result;
@@ -1056,7 +1056,7 @@ static bool classHasParentManagement(const AbstractMetaClassCPtr &c)
TypeEntryCPtr parentManagementEntry(const AbstractMetaClassCPtr &klass)
{
if (klass->typeEntry()->isObject()) {
- if (auto c = recurseClassHierarchy(klass, classHasParentManagement); !c.isNull())
+ if (auto c = recurseClassHierarchy(klass, classHasParentManagement))
return c->typeEntry();
}
return nullptr;
@@ -1249,7 +1249,7 @@ AbstractMetaFunctionCList AbstractMetaClass::queryFunctionList(const AbstractMet
{
AbstractMetaFunctionCList result;
for (const auto &f : list) {
- if (queryFunction(f.data(), query))
+ if (queryFunction(f.get(), query))
result.append(f);
}
return result;
@@ -1259,7 +1259,7 @@ AbstractMetaFunctionCPtr AbstractMetaClass::queryFirstFunction(const AbstractMet
FunctionQueryOptions query)
{
for (const auto &f : list) {
- if (queryFunction(f.data(), query))
+ if (queryFunction(f.get(), query))
return f;
}
return {};
@@ -1391,7 +1391,7 @@ static void addExtraIncludesForFunction(const AbstractMetaClassPtr &metaClass,
const AbstractMetaFunctionCPtr &meta_function)
{
Q_ASSERT(metaClass);
- Q_ASSERT(!meta_function.isNull());
+ Q_ASSERT(meta_function);
addExtraIncludeForType(metaClass, meta_function->type());
const AbstractMetaArgumentList &arguments = meta_function->arguments();
@@ -1463,13 +1463,13 @@ void AbstractMetaClass::fixFunctions(const AbstractMetaClassPtr &klass)
for (const auto &f : std::as_const(funcs)) {
// Fishy: Setting up of implementing/declaring/base classes changes
// the applicable modifications; clear cached ones.
- qSharedPointerConstCast<AbstractMetaFunction>(f)->clearModificationsCache();
+ std::const_pointer_cast<AbstractMetaFunction>(f)->clearModificationsCache();
if (!f->isModifiedRemoved())
nonRemovedFuncs.append(f);
}
for (const auto &superClassC : d->m_baseClasses) {
- auto superClass = qSharedPointerConstCast<AbstractMetaClass>(superClassC);
+ auto superClass = std::const_pointer_cast<AbstractMetaClass>(superClassC);
AbstractMetaClass::fixFunctions(superClass);
// Since we always traverse the complete hierarchy we are only
// interrested in what each super class implements, not what
@@ -1503,8 +1503,8 @@ void AbstractMetaClass::fixFunctions(const AbstractMetaClassPtr &klass)
// virtual in case they override abstract functions.
bool add = addSuperFunction(sf);
for (const auto &cf : std::as_const(nonRemovedFuncs)) {
- AbstractMetaFunctionPtr f(qSharedPointerConstCast<AbstractMetaFunction>(cf));
- const AbstractMetaFunction::CompareResult cmp = cf->compareTo(sf.data());
+ AbstractMetaFunctionPtr f(std::const_pointer_cast<AbstractMetaFunction>(cf));
+ const AbstractMetaFunction::CompareResult cmp = cf->compareTo(sf.get());
if (cmp & AbstractMetaFunction::EqualModifiedName) {
add = false;
@@ -1538,7 +1538,7 @@ void AbstractMetaClass::fixFunctions(const AbstractMetaClassPtr &klass)
if (f->access() != sf->access()) {
qCWarning(lcShiboken, "%s",
- qPrintable(msgFunctionVisibilityModified(klass, f.data())));
+ qPrintable(msgFunctionVisibilityModified(klass, f.get())));
#if 0
// If new visibility is private, we can't
// do anything. If it isn't, then we
@@ -1583,7 +1583,7 @@ void AbstractMetaClass::fixFunctions(const AbstractMetaClassPtr &klass)
if (!hasNonFinalModifier && !isBaseImplPrivate) {
qCWarning(lcShiboken, "%s",
- qPrintable(msgShadowingFunction(sf.data(), f.data())));
+ qPrintable(msgShadowingFunction(sf.get(), f.get())));
}
}
}
@@ -1626,7 +1626,7 @@ void AbstractMetaClass::fixFunctions(const AbstractMetaClassPtr &klass)
bool hasPublicConstructors = false;
// Apply modifications after the declaring class has been set
for (const auto &func : std::as_const(funcs)) {
- auto ncFunc = qSharedPointerConstCast<AbstractMetaFunction>(func);
+ auto ncFunc = std::const_pointer_cast<AbstractMetaFunction>(func);
for (const auto &mod : func->modifications(klass)) {
if (mod.isRenameModifier())
ncFunc->setName(mod.renamedToName());
@@ -1697,7 +1697,7 @@ std::optional<AbstractMetaEnumValue>
if (lst.size() > 1) {
const auto &prefixName = lst.at(0);
const auto &enumName = lst.at(1);
- if (auto cl = findClass(classes, prefixName); !cl.isNull())
+ if (auto cl = findClass(classes, prefixName))
return cl->findEnumValue(enumName.toString());
}
@@ -1786,9 +1786,9 @@ bool inheritsFrom(const AbstractMetaClassCPtr &c, const AbstractMetaClassCPtr &c
if (c == cls || c->templateBaseClass() == cls)
return true;
- return !recurseClassHierarchy(c, [cls](const AbstractMetaClassCPtr &c) {
- return cls.data() == c.data();
- }).isNull();
+ return bool(recurseClassHierarchy(c, [cls](const AbstractMetaClassCPtr &c) {
+ return cls.get() == c.get();
+ }));
}
bool inheritsFrom(const AbstractMetaClassCPtr &c, const QString &name)
@@ -1801,16 +1801,16 @@ bool inheritsFrom(const AbstractMetaClassCPtr &c, const QString &name)
return true;
}
- return !recurseClassHierarchy(c, [&name](const AbstractMetaClassCPtr &c) {
+ return bool(recurseClassHierarchy(c, [&name](const AbstractMetaClassCPtr &c) {
return c->qualifiedCppName() == name;
- }).isNull();
+ }));
}
AbstractMetaClassCPtr findBaseClass(const AbstractMetaClassCPtr &c,
const QString &qualifiedName)
{
auto tp = c->templateBaseClass();
- if (!tp.isNull() && tp->qualifiedCppName() == qualifiedName)
+ if (tp && tp->qualifiedCppName() == qualifiedName)
return tp;
return recurseClassHierarchy(c, [&qualifiedName](const AbstractMetaClassCPtr &c) {
diff --git a/sources/shiboken6/ApiExtractor/abstractmetalang.h b/sources/shiboken6/ApiExtractor/abstractmetalang.h
index 471e3fcef..5bd291664 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetalang.h
+++ b/sources/shiboken6/ApiExtractor/abstractmetalang.h
@@ -380,7 +380,7 @@ AbstractMetaClassCPtr findBaseClass(const AbstractMetaClassCPtr &c,
/// Return type entry of the base class that declares the parent management
TypeEntryCPtr parentManagementEntry(const AbstractMetaClassCPtr &klass);
inline bool hasParentManagement(const AbstractMetaClassCPtr &c)
-{ return !parentManagementEntry(c).isNull(); }
+{ return bool(parentManagementEntry(c)); }
AbstractMetaClassCList allBaseClasses(const AbstractMetaClassCPtr metaClass);
diff --git a/sources/shiboken6/ApiExtractor/abstractmetalang_helpers.h b/sources/shiboken6/ApiExtractor/abstractmetalang_helpers.h
index a70c769c8..2a053ceaf 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetalang_helpers.h
+++ b/sources/shiboken6/ApiExtractor/abstractmetalang_helpers.h
@@ -7,7 +7,7 @@
#include "abstractmetalang_typedefs.h"
template <class MetaClass>
-QSharedPointer<MetaClass> findByName(const QList<QSharedPointer<MetaClass> > &haystack,
+std::shared_ptr<MetaClass> findByName(const QList<std::shared_ptr<MetaClass> > &haystack,
QStringView needle)
{
for (const auto &c : haystack) {
diff --git a/sources/shiboken6/ApiExtractor/abstractmetalang_typedefs.h b/sources/shiboken6/ApiExtractor/abstractmetalang_typedefs.h
index 1420dcbe9..802f549cf 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetalang_typedefs.h
+++ b/sources/shiboken6/ApiExtractor/abstractmetalang_typedefs.h
@@ -4,9 +4,10 @@
#ifndef ABSTRACTMETALANG_TYPEDEFS_H
#define ABSTRACTMETALANG_TYPEDEFS_H
-#include <QtCore/QSharedPointer>
#include <QtCore/QList>
+#include <memory>
+
class AbstractMetaClass;
class AbstractMetaField;
class AbstractMetaArgument;
@@ -16,10 +17,10 @@ class AbstractMetaFunction;
class AbstractMetaType;
struct UsingMember;
-using AbstractMetaFunctionPtr = QSharedPointer<AbstractMetaFunction>;
-using AbstractMetaFunctionCPtr = QSharedPointer<const AbstractMetaFunction>;
-using AbstractMetaClassPtr = QSharedPointer<AbstractMetaClass>;
-using AbstractMetaClassCPtr = QSharedPointer<const AbstractMetaClass>;
+using AbstractMetaFunctionPtr = std::shared_ptr<AbstractMetaFunction>;
+using AbstractMetaFunctionCPtr = std::shared_ptr<const AbstractMetaFunction>;
+using AbstractMetaClassPtr = std::shared_ptr<AbstractMetaClass>;
+using AbstractMetaClassCPtr = std::shared_ptr<const AbstractMetaClass>;
using AbstractMetaArgumentList = QList<AbstractMetaArgument>;
using AbstractMetaClassList = QList<AbstractMetaClassPtr>;
diff --git a/sources/shiboken6/ApiExtractor/abstractmetatype.cpp b/sources/shiboken6/ApiExtractor/abstractmetatype.cpp
index fa3ff7a1a..300735ce2 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetatype.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetatype.cpp
@@ -17,12 +17,13 @@
#include <QtCore/QHash>
#include <QtCore/QSharedData>
-#include <QtCore/QSharedPointer>
#include <QtCore/QStack>
+#include <memory>
+
using namespace Qt::StringLiterals;
-using AbstractMetaTypeCPtr = QSharedPointer<const AbstractMetaType>;
+using AbstractMetaTypeCPtr = std::shared_ptr<const AbstractMetaType>;
const QSet<QString> &AbstractMetaType::cppFloatTypes()
{
@@ -228,7 +229,7 @@ bool AbstractMetaType::applyArrayModification(QString *errorMessage)
*errorMessage = u"<array> modification already applied."_s;
return false;
}
- if (!d->m_arrayElementType.isNull()) {
+ if (d->m_arrayElementType) {
QTextStream(errorMessage) << "The type \"" << cppSignature()
<< "\" is an array of " << d->m_arrayElementType->name() << '.';
return false;
@@ -276,13 +277,13 @@ QString AbstractMetaType::originalTypeDescription() const
void AbstractMetaType::setOriginalTemplateType(const AbstractMetaType &type)
{
- if (d->m_originalTemplateType.isNull() || *d->m_originalTemplateType != type)
+ if (!d->m_originalTemplateType || *d->m_originalTemplateType != type)
d->m_originalTemplateType.reset(new AbstractMetaType(type));
}
const AbstractMetaType *AbstractMetaType::originalTemplateType() const
{
- return d->m_originalTemplateType.data();
+ return d->m_originalTemplateType.get();
}
AbstractMetaType AbstractMetaType::getSmartPointerInnerType() const
@@ -311,7 +312,7 @@ AbstractMetaTypeList AbstractMetaType::nestedArrayTypes() const
}
break;
case NativePointerAsArrayPattern:
- result.append(*d->m_arrayElementType.data());
+ result.append(*d->m_arrayElementType.get());
break;
default:
break;
@@ -417,12 +418,12 @@ int AbstractMetaType::arrayElementCount() const
const AbstractMetaType *AbstractMetaType::arrayElementType() const
{
- return d->m_arrayElementType.data();
+ return d->m_arrayElementType.get();
}
void AbstractMetaType::setArrayElementType(const AbstractMetaType &t)
{
- if (d->m_arrayElementType.isNull() || *d->m_arrayElementType != t) {
+ if (!d->m_arrayElementType || *d->m_arrayElementType != t) {
d->m_arrayElementType.reset(new AbstractMetaType(t));
d->m_signaturesDirty = true;
}
@@ -688,9 +689,9 @@ void AbstractMetaType::setVolatile(bool v)
static bool equalsCPtr(const AbstractMetaTypeCPtr &t1, const AbstractMetaTypeCPtr &t2)
{
- if (t1.isNull() != t2.isNull())
+ if (bool(t1) != bool(t2))
return false;
- return t1.isNull() || *t1 == *t2;
+ return !t1 || *t1 == *t2;
}
bool AbstractMetaTypeData::isEquivalent(const AbstractMetaTypeData &rhs) const
@@ -730,12 +731,12 @@ bool AbstractMetaType::isEquivalent(const AbstractMetaType &rhs) const
const AbstractMetaType *AbstractMetaType::viewOn() const
{
- return d->m_viewOn.data();
+ return d->m_viewOn.get();
}
void AbstractMetaType::setViewOn(const AbstractMetaType &v)
{
- if (d->m_viewOn.isNull() || *d->m_viewOn != v)
+ if (!d->m_viewOn || *d->m_viewOn != v)
d->m_viewOn.reset(new AbstractMetaType(v));
}
@@ -744,7 +745,7 @@ AbstractMetaType AbstractMetaType::createVoid()
static QScopedPointer<AbstractMetaType> metaType;
if (metaType.isNull()) {
static TypeEntryCPtr voidTypeEntry = TypeDatabase::instance()->findType(u"void"_s);
- Q_ASSERT(!voidTypeEntry.isNull());
+ Q_ASSERT(voidTypeEntry);
metaType.reset(new AbstractMetaType(voidTypeEntry));
metaType->decideUsagePattern();
}
@@ -871,7 +872,7 @@ bool AbstractMetaType::isValueTypeWithCopyConstructorOnly() const
{
bool result = false;
if (d->m_typeEntry->isComplex()) {
- const auto cte = qSharedPointerCast<const ComplexTypeEntry>(d->m_typeEntry);
+ const auto cte = std::static_pointer_cast<const ComplexTypeEntry>(d->m_typeEntry);
result = cte->isValueTypeWithCopyConstructorOnly();
}
return result;
@@ -940,7 +941,7 @@ bool AbstractMetaTypeData::generateOpaqueContainer(Predicate pred) const
return false;
if (m_indirections.size() > 1)
return false;
- auto containerTypeEntry = qSharedPointerCast<const ContainerTypeEntry>(m_typeEntry);
+ auto containerTypeEntry = std::static_pointer_cast<const ContainerTypeEntry>(m_typeEntry);
auto kind = containerTypeEntry->containerKind();
if (kind != ContainerTypeEntry::ListContainer)
return false;
diff --git a/sources/shiboken6/ApiExtractor/abstractmetatype.h b/sources/shiboken6/ApiExtractor/abstractmetatype.h
index c7052cafb..10ed900ee 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetatype.h
+++ b/sources/shiboken6/ApiExtractor/abstractmetatype.h
@@ -262,7 +262,7 @@ inline bool operator!=(const AbstractMetaType &t1, const AbstractMetaType &t2)
{ return !t1.equals(t2); }
inline size_t qHash(const AbstractMetaType &t, size_t seed)
-{ return qHash(t.typeEntry(), seed); }
+{ return qHash(t.typeEntry().get(), seed); }
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug d, const AbstractMetaType &at);
diff --git a/sources/shiboken6/ApiExtractor/addedfunction.cpp b/sources/shiboken6/ApiExtractor/addedfunction.cpp
index 6525c1ed7..3f781bf56 100644
--- a/sources/shiboken6/ApiExtractor/addedfunction.cpp
+++ b/sources/shiboken6/ApiExtractor/addedfunction.cpp
@@ -182,7 +182,7 @@ AddedFunction::AddedFunctionPtr
arguments.append({type, p.name, p.defaultValue});
}
- AddedFunctionPtr result(new AddedFunction(name, arguments, returnType));
+ auto result = std::make_shared<AddedFunction>(name, arguments, returnType);
result->setConstant(isConst);
return result;
}
diff --git a/sources/shiboken6/ApiExtractor/addedfunction.h b/sources/shiboken6/ApiExtractor/addedfunction.h
index 0f5dc89ef..8a0475f33 100644
--- a/sources/shiboken6/ApiExtractor/addedfunction.h
+++ b/sources/shiboken6/ApiExtractor/addedfunction.h
@@ -8,9 +8,10 @@
#include "parser/typeinfo.h"
#include <QtCore/QList>
-#include <QtCore/QSharedPointer>
#include <QtCore/QString>
+#include <memory>
+
QT_FORWARD_DECLARE_CLASS(QDebug)
/// \internal
@@ -19,7 +20,7 @@ QT_FORWARD_DECLARE_CLASS(QDebug)
/// will be inserted into the right AbstractMetaClass.
struct AddedFunction
{
- using AddedFunctionPtr = QSharedPointer<AddedFunction>;
+ using AddedFunctionPtr = std::shared_ptr<AddedFunction>;
/// Function access types.
enum Access {
diff --git a/sources/shiboken6/ApiExtractor/apiextractor.cpp b/sources/shiboken6/ApiExtractor/apiextractor.cpp
index 0f7c97722..4a707104e 100644
--- a/sources/shiboken6/ApiExtractor/apiextractor.cpp
+++ b/sources/shiboken6/ApiExtractor/apiextractor.cpp
@@ -486,7 +486,7 @@ static void addOwnerModification(const AbstractMetaFunctionCList &functions,
for (const auto &f : functions) {
if (!f->arguments().isEmpty()
&& f->arguments().constFirst().type().indirections() > 0) {
- qSharedPointerConstCast<AbstractMetaFunction>(f)->clearModificationsCache();
+ std::const_pointer_cast<AbstractMetaFunction>(f)->clearModificationsCache();
typeEntry->addFunctionModification(invalidateArgMod(f));
}
}
@@ -502,7 +502,7 @@ void ApiExtractorPrivate::addInstantiatedSmartPointer(InstantiationCollectContex
Q_ASSERT(smp.smartPointer);
const auto &instantiatedType = type.instantiations().constFirst();
- const auto ste = qSharedPointerCast<const SmartPointerTypeEntry>(smp.smartPointer->typeEntry());
+ const auto ste = std::static_pointer_cast<const SmartPointerTypeEntry>(smp.smartPointer->typeEntry());
QString name = ste->getTargetName(smp.type);
auto parentTypeEntry = ste->parent();
InheritTemplateFlags flags;
@@ -530,8 +530,8 @@ void ApiExtractorPrivate::addInstantiatedSmartPointer(InstantiationCollectContex
Q_ASSERT(smp.specialized);
if (withinNameSpace) { // move class to desired namespace
const auto enclClass = AbstractMetaClass::findClass(m_builder->classes(), parentTypeEntry);
- Q_ASSERT(!enclClass.isNull());
- auto specialized = qSharedPointerConstCast<AbstractMetaClass>(smp.specialized);
+ Q_ASSERT(enclClass);
+ auto specialized = std::const_pointer_cast<AbstractMetaClass>(smp.specialized);
specialized->setEnclosingClass(enclClass);
enclClass->addInnerClass(specialized);
}
@@ -572,7 +572,7 @@ ApiExtractorPrivate::collectInstantiatedContainersAndSmartPointers(Instantiation
// instantiations are specified to be in namespaces.
auto &innerClasses = metaClass->innerClasses();
for (auto i = innerClasses.size() - 1; i >= 0; --i) {
- const auto &innerClass = innerClasses.at(i);
+ const auto innerClass = innerClasses.at(i);
if (!innerClass->typeEntry()->isSmartPointer())
collectInstantiatedContainersAndSmartPointers(context, innerClass);
}
@@ -632,12 +632,12 @@ static void getCode(QStringList &code, const CodeSnipList &codeSnips)
static void getCode(QStringList &code, const TypeEntryCPtr &type)
{
if (type->isComplex())
- getCode(code, qSharedPointerCast<const ComplexTypeEntry>(type)->codeSnips());
+ getCode(code, std::static_pointer_cast<const ComplexTypeEntry>(type)->codeSnips());
else if (type->isTypeSystem())
- getCode(code, qSharedPointerCast<const TypeSystemTypeEntry>(type)->codeSnips());
+ getCode(code, std::static_pointer_cast<const TypeSystemTypeEntry>(type)->codeSnips());
auto customConversion = CustomConversion::getCustomConversion(type);
- if (customConversion.isNull())
+ if (!customConversion)
return;
if (!customConversion->nativeToTargetConversion().isEmpty())
@@ -665,7 +665,7 @@ void ApiExtractorPrivate::collectContainerTypesFromSnippets(InstantiationCollect
getCode(snips, metaClass->typeEntry());
const auto moduleEntry = td->defaultTypeSystemType();
- Q_ASSERT(!moduleEntry.isNull());
+ Q_ASSERT(moduleEntry);
getCode(snips, moduleEntry);
for (const auto &func : m_builder->globalFunctions())
diff --git a/sources/shiboken6/ApiExtractor/apiextractorresult.cpp b/sources/shiboken6/ApiExtractor/apiextractorresult.cpp
index 40e8fb997..7f7a7f5c1 100644
--- a/sources/shiboken6/ApiExtractor/apiextractorresult.cpp
+++ b/sources/shiboken6/ApiExtractor/apiextractorresult.cpp
@@ -63,8 +63,8 @@ void ApiExtractorResult::setFlags(ApiExtractorFlags f)
std::optional<AbstractMetaEnum>
ApiExtractorResult::findAbstractMetaEnum(TypeEntryCPtr typeEntry) const
{
- if (!typeEntry.isNull() && typeEntry->isFlags())
- typeEntry = qSharedPointerCast<const FlagsTypeEntry>(typeEntry)->originator();
+ if (typeEntry && typeEntry->isFlags())
+ typeEntry = std::static_pointer_cast<const FlagsTypeEntry>(typeEntry)->originator();
const auto it = m_enums.constFind(typeEntry);
if (it == m_enums.constEnd())
return {};
diff --git a/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp
index e0d25f798..dce28f301 100644
--- a/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp
+++ b/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp
@@ -182,7 +182,7 @@ public:
void addBaseClass(const CXCursor &cursor);
template <class Item>
- void qualifyTypeDef(const CXCursor &typeRefCursor, const QSharedPointer<Item> &item) const;
+ void qualifyTypeDef(const CXCursor &typeRefCursor, const std::shared_ptr<Item> &item) const;
bool visitHeader(const QString &fileName) const;
@@ -222,7 +222,7 @@ bool BuilderPrivate::addClass(const CXCursor &cursor, CodeModel::ClassType t)
{
QString className = getCursorSpelling(cursor);
m_currentClass.reset(new _ClassModelItem(m_model, className));
- setFileName(cursor, m_currentClass.data());
+ setFileName(cursor, m_currentClass.get());
m_currentClass->setClassType(t);
// Some inner class? Note that it does not need to be (lexically) contained in a
// class since it is possible to forward declare an inner class:
@@ -326,8 +326,8 @@ FunctionModelItem BuilderPrivate::createFunction(const CXCursor &cursor,
// Apply type fixes to "operator X &" -> "operator X&"
if (name.startsWith(u"operator "))
name = fixTypeName(name);
- FunctionModelItem result(new _FunctionModelItem(m_model, name));
- setFileName(cursor, result.data());
+ auto result = std::make_shared<_FunctionModelItem>(m_model, name);
+ setFileName(cursor, result.get());
result->setType(createTypeInfo(clang_getCursorResultType(cursor)));
result->setFunctionType(t);
result->setScope(m_scope);
@@ -404,7 +404,7 @@ void BuilderPrivate::qualifyConstructor(const CXCursor &cursor)
TemplateParameterModelItem BuilderPrivate::createTemplateParameter(const CXCursor &cursor) const
{
- return TemplateParameterModelItem(new _TemplateParameterModelItem(m_model, getCursorSpelling(cursor)));
+ return std::make_shared<_TemplateParameterModelItem>(m_model, getCursorSpelling(cursor));
}
TemplateParameterModelItem BuilderPrivate::createNonTypeTemplateParameter(const CXCursor &cursor) const
@@ -417,7 +417,7 @@ TemplateParameterModelItem BuilderPrivate::createNonTypeTemplateParameter(const
// CXCursor_VarDecl, CXCursor_FieldDecl cursors
void BuilderPrivate::addField(const CXCursor &cursor)
{
- VariableModelItem field(new _VariableModelItem(m_model, getCursorSpelling(cursor)));
+ auto field = std::make_shared<_VariableModelItem>(m_model, getCursorSpelling(cursor));
field->setAccessPolicy(accessPolicy(clang_getCXXAccessSpecifier(cursor)));
field->setScope(m_scope);
field->setType(createTypeInfo(cursor));
@@ -565,14 +565,14 @@ TypeInfo BuilderPrivate::createTypeInfoUncached(const CXType &type,
// the typedef source is named "type-parameter-0-0". Convert it back to the
// template parameter name. The CXTypes are the same for all templates and
// must not be cached.
- if (!m_currentClass.isNull() && typeName.startsWith(u"type-parameter-0-")) {
+ if (m_currentClass && typeName.startsWith(u"type-parameter-0-")) {
if (cacheable != nullptr)
*cacheable = false;
bool ok;
const int n = QStringView{typeName}.mid(17).toInt(&ok);
if (ok) {
auto currentTemplate = currentTemplateClass();
- if (!currentTemplate.isNull() && n < currentTemplate->templateParameters().size())
+ if (currentTemplate && n < currentTemplate->templateParameters().size())
typeName = currentTemplate->templateParameters().at(n)->name();
}
}
@@ -603,8 +603,8 @@ TypeInfo BuilderPrivate::createTypeInfo(const CXType &type) const
void BuilderPrivate::addTypeDef(const CXCursor &cursor, const CXType &cxType)
{
const QString target = getCursorSpelling(cursor);
- TypeDefModelItem item(new _TypeDefModelItem(m_model, target));
- setFileName(cursor, item.data());
+ auto item = std::make_shared<_TypeDefModelItem>(m_model, target);
+ setFileName(cursor, item.get());
item->setType(createTypeInfo(cxType));
item->setScope(m_scope);
m_scopeStack.back()->addTypeDef(item);
@@ -614,8 +614,8 @@ void BuilderPrivate::addTypeDef(const CXCursor &cursor, const CXType &cxType)
ClassModelItem BuilderPrivate::currentTemplateClass() const
{
for (auto i = m_scopeStack.size() - 1; i >= 0; --i) {
- auto klass = qSharedPointerDynamicCast<_ClassModelItem>(m_scopeStack.at(i));
- if (!klass.isNull() && klass->isTemplate())
+ auto klass = std::dynamic_pointer_cast<_ClassModelItem>(m_scopeStack.at(i));
+ if (klass && klass->isTemplate())
return klass;
}
return {};
@@ -625,7 +625,7 @@ void BuilderPrivate::startTemplateTypeAlias(const CXCursor &cursor)
{
const QString target = getCursorSpelling(cursor);
m_currentTemplateTypeAlias.reset(new _TemplateTypeAliasModelItem(m_model, target));
- setFileName(cursor, m_currentTemplateTypeAlias.data());
+ setFileName(cursor, m_currentTemplateTypeAlias.get());
m_currentTemplateTypeAlias->setScope(m_scope);
}
@@ -756,7 +756,7 @@ static inline CXCursor definitionFromTypeRef(const CXCursor &typeRefCursor)
// ^^ ditto
template <class Item> // ArgumentModelItem, VariableModelItem
-void BuilderPrivate::qualifyTypeDef(const CXCursor &typeRefCursor, const QSharedPointer<Item> &item) const
+void BuilderPrivate::qualifyTypeDef(const CXCursor &typeRefCursor, const std::shared_ptr<Item> &item) const
{
TypeInfo type = item->type();
if (type.qualifiedName().size() == 1) { // item's type is unqualified.
@@ -869,7 +869,7 @@ FileModelItem Builder::dom() const
Q_ASSERT(!d->m_scopeStack.isEmpty());
auto rootScope = d->m_scopeStack.constFirst();
rootScope->purgeClassDeclarations();
- return qSharedPointerDynamicCast<_FileModelItem>(rootScope);
+ return std::dynamic_pointer_cast<_FileModelItem>(rootScope);
}
static QString msgOutOfOrder(const CXCursor &cursor, const char *expectedScope)
@@ -932,7 +932,7 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor)
}
break;
case CXCursor_CXXBaseSpecifier:
- if (d->m_currentClass.isNull()) {
+ if (!d->m_currentClass) {
const Diagnostic d(msgOutOfOrder(cursor, "class"), cursor, CXDiagnostic_Error);
qWarning() << d;
appendDiagnostic(d);
@@ -971,19 +971,19 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor)
kind = EnumClass;
}
d->m_currentEnum.reset(new _EnumModelItem(d->m_model, name));
- d->setFileName(cursor, d->m_currentEnum.data());
+ d->setFileName(cursor, d->m_currentEnum.get());
d->m_currentEnum->setScope(d->m_scope);
d->m_currentEnum->setEnumKind(kind);
if (clang_getCursorAvailability(cursor) == CXAvailability_Deprecated)
d->m_currentEnum->setDeprecated(true);
d->m_currentEnum->setSigned(isSigned(clang_getEnumDeclIntegerType(cursor).kind));
- if (!qSharedPointerDynamicCast<_ClassModelItem>(d->m_scopeStack.back()).isNull())
+ if (std::dynamic_pointer_cast<_ClassModelItem>(d->m_scopeStack.back()))
d->m_currentEnum->setAccessPolicy(accessPolicy(clang_getCXXAccessSpecifier(cursor)));
}
break;
case CXCursor_EnumConstantDecl: {
const QString name = getCursorSpelling(cursor);
- if (d->m_currentEnum.isNull()) {
+ if (!d->m_currentEnum) {
const Diagnostic d(msgOutOfOrder(cursor, "enum"), cursor, CXDiagnostic_Error);
qWarning() << d;
appendDiagnostic(d);
@@ -994,7 +994,7 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor)
enumValue.setValue(clang_getEnumConstantDeclValue(cursor));
else
enumValue.setUnsignedValue(clang_getEnumConstantDeclUnsignedValue(cursor));
- EnumeratorModelItem enumConstant(new _EnumeratorModelItem(d->m_model, name));
+ auto enumConstant = std::make_shared<_EnumeratorModelItem>(d->m_model, name);
enumConstant->setStringValue(d->cursorValueExpression(this, cursor));
enumConstant->setValue(enumValue);
if (clang_getCursorAvailability(cursor) == CXAvailability_Deprecated)
@@ -1065,8 +1065,8 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor)
if (type == NamespaceType::Anonymous)
return Skip;
const QString name = getCursorSpelling(cursor);
- const NamespaceModelItem parentNamespaceItem = qSharedPointerDynamicCast<_NamespaceModelItem>(d->m_scopeStack.back());
- if (parentNamespaceItem.isNull()) {
+ const auto parentNamespaceItem = std::dynamic_pointer_cast<_NamespaceModelItem>(d->m_scopeStack.back());
+ if (!parentNamespaceItem) {
const QString message = msgOutOfOrder(cursor, "namespace")
+ u" (current scope: "_s + d->m_scopeStack.back()->name() + u')';
const Diagnostic d(message, cursor, CXDiagnostic_Error);
@@ -1078,7 +1078,7 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor)
// in subsequent modules.
NamespaceModelItem namespaceItem = parentNamespaceItem->findNamespace(name);
namespaceItem.reset(new _NamespaceModelItem(d->m_model, name));
- d->setFileName(cursor, namespaceItem.data());
+ d->setFileName(cursor, namespaceItem.get());
namespaceItem->setScope(d->m_scope);
namespaceItem->setType(type);
parentNamespaceItem->addNamespace(namespaceItem);
@@ -1088,7 +1088,7 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor)
case CXCursor_ParmDecl:
// Skip in case of nested CXCursor_ParmDecls in case one parameter is a function pointer
// and function pointer typedefs.
- if (d->m_currentArgument.isNull() && !d->m_currentFunction.isNull()) {
+ if (!d->m_currentArgument && d->m_currentFunction) {
const QString name = getCursorSpelling(cursor);
d->m_currentArgument.reset(new _ArgumentModelItem(d->m_model, name));
d->m_currentArgument->setType(d->createTypeInfo(cursor));
@@ -1107,11 +1107,11 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor)
const TemplateParameterModelItem tItem = cursor.kind == CXCursor_TemplateTemplateParameter
? d->createTemplateParameter(cursor) : d->createNonTypeTemplateParameter(cursor);
// Apply to function/member template?
- if (!d->m_currentFunction.isNull()) {
+ if (d->m_currentFunction) {
d->m_currentFunction->setTemplateParameters(d->m_currentFunction->templateParameters() << tItem);
- } else if (!d->m_currentTemplateTypeAlias.isNull()) {
+ } else if (d->m_currentTemplateTypeAlias) {
d->m_currentTemplateTypeAlias->addTemplateParameter(tItem);
- } else if (!d->m_currentClass.isNull()) { // Apply to class
+ } else if (d->m_currentClass) { // Apply to class
const QString &tplParmName = tItem->name();
if (Q_UNLIKELY(!insertTemplateParameterIntoClassName(tplParmName, d->m_currentClass)
|| !insertTemplateParameterIntoClassName(tplParmName, &d->m_scope.back()))) {
@@ -1130,7 +1130,7 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor)
d->startTemplateTypeAlias(cursor);
break;
case CXCursor_TypeAliasDecl: // May contain nested CXCursor_TemplateTypeParameter
- if (d->m_currentTemplateTypeAlias.isNull()) {
+ if (!d->m_currentTemplateTypeAlias) {
const CXType type = clang_getCanonicalType(clang_getCursorType(cursor));
if (type.kind > CXType_Unexposed)
d->addTypeDef(cursor, type);
@@ -1158,31 +1158,31 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor)
d->m_usingTypeRef = getCursorSpelling(cursor);
break;
case CXCursor_TypeRef:
- if (!d->m_currentFunction.isNull()) {
- if (d->m_currentArgument.isNull())
+ if (d->m_currentFunction) {
+ if (!d->m_currentArgument)
d->qualifyTypeDef(cursor, d->m_currentFunction); // return type
else
d->qualifyTypeDef(cursor, d->m_currentArgument);
- } else if (!d->m_currentField.isNull()) {
+ } else if (d->m_currentField) {
d->qualifyTypeDef(cursor, d->m_currentField);
} else if (d->m_withinUsingDeclaration && d->m_usingTypeRef.isEmpty()) {
d->m_usingTypeRef = d->getBaseClass(clang_getCursorType(cursor)).first;
}
break;
case CXCursor_CXXFinalAttr:
- if (!d->m_currentFunction.isNull())
+ if (d->m_currentFunction)
d->m_currentFunction->setFinal(true);
- else if (!d->m_currentClass.isNull())
+ else if (d->m_currentClass)
d->m_currentClass->setFinal(true);
break;
case CXCursor_CXXOverrideAttr:
- if (!d->m_currentFunction.isNull())
+ if (d->m_currentFunction)
d->m_currentFunction->setOverride(true);
break;
case CXCursor_StaticAssert:
// Check for Q_PROPERTY() (see PySide6/global.h.in for an explanation
// how it is defined, and qdoc).
- if (clang_isDeclaration(cursor.kind) && !d->m_currentClass.isNull()) {
+ if (clang_isDeclaration(cursor.kind) && d->m_currentClass) {
auto snippet = getCodeSnippet(cursor);
const auto length = snippet.size();
if (length > 12 && *snippet.rbegin() == ')'
@@ -1194,7 +1194,7 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor)
break;
// UsingDeclaration: consists of a TypeRef (base) and OverloadedDeclRef (member name)
case CXCursor_UsingDeclaration:
- if (!d->m_currentClass.isNull())
+ if (d->m_currentClass)
d->m_withinUsingDeclaration = true;
break;
case CXCursor_OverloadedDeclRef:
@@ -1222,51 +1222,51 @@ bool Builder::endToken(const CXCursor &cursor)
case CXCursor_ClassTemplatePartialSpecialization:
d->popScope();
// Continue in outer class after leaving inner class?
- if (ClassModelItem lastClass = qSharedPointerDynamicCast<_ClassModelItem>(d->m_scopeStack.back()))
+ if (auto lastClass = std::dynamic_pointer_cast<_ClassModelItem>(d->m_scopeStack.back()))
d->m_currentClass = lastClass;
else
- d->m_currentClass.clear();
+ d->m_currentClass.reset();
d->m_currentFunctionType = CodeModel::Normal;
break;
case CXCursor_EnumDecl:
- if (!d->m_currentEnum.isNull())
+ if (d->m_currentEnum)
d->m_scopeStack.back()->addEnum(d->m_currentEnum);
- d->m_currentEnum.clear();
+ d->m_currentEnum.reset();
break;
case CXCursor_FriendDecl:
d->m_withinFriendDecl = false;
break;
case CXCursor_VarDecl:
case CXCursor_FieldDecl:
- d->m_currentField.clear();
+ d->m_currentField.reset();
break;
case CXCursor_Constructor:
d->qualifyConstructor(cursor);
- if (!d->m_currentFunction.isNull()) {
+ if (d->m_currentFunction) {
d->m_currentFunction->_determineType();
- d->m_currentFunction.clear();
+ d->m_currentFunction.reset();
}
break;
case CXCursor_Destructor:
case CXCursor_CXXMethod:
case CXCursor_FunctionDecl:
case CXCursor_FunctionTemplate:
- if (!d->m_currentFunction.isNull()) {
+ if (d->m_currentFunction) {
d->m_currentFunction->_determineType();
- d->m_currentFunction.clear();
+ d->m_currentFunction.reset();
}
break;
case CXCursor_ConversionFunction:
- if (!d->m_currentFunction.isNull()) {
+ if (d->m_currentFunction) {
d->m_currentFunction->setFunctionType(CodeModel::ConversionOperator);
- d->m_currentFunction.clear();
+ d->m_currentFunction.reset();
}
break;
case CXCursor_Namespace:
d->popScope();
break;
case CXCursor_ParmDecl:
- d->m_currentArgument.clear();
+ d->m_currentArgument.reset();
break;
case CXCursor_TypeAliasTemplateDecl:
d->m_currentTemplateTypeAlias.reset();
diff --git a/sources/shiboken6/ApiExtractor/codesnip.cpp b/sources/shiboken6/ApiExtractor/codesnip.cpp
index 81977ceb1..f79c68ca8 100644
--- a/sources/shiboken6/ApiExtractor/codesnip.cpp
+++ b/sources/shiboken6/ApiExtractor/codesnip.cpp
@@ -14,7 +14,7 @@ using namespace Qt::StringLiterals;
QString TemplateInstance::expandCode() const
{
const auto templateEntry = TypeDatabase::instance()->findTemplate(m_name);
- if (templateEntry.isNull()) {
+ if (!templateEntry) {
const QString m = u"<insert-template> referring to non-existing template '"_s
+ m_name + u"'."_s;
throw Exception(m);
diff --git a/sources/shiboken6/ApiExtractor/codesnip.h b/sources/shiboken6/ApiExtractor/codesnip.h
index 7a1ab0624..86834a1db 100644
--- a/sources/shiboken6/ApiExtractor/codesnip.h
+++ b/sources/shiboken6/ApiExtractor/codesnip.h
@@ -9,9 +9,10 @@
#include <QtCore/QList>
#include <QtCore/QHash>
-#include <QtCore/QSharedPointer>
#include <QtCore/QString>
+#include <memory>
+
class TemplateInstance
{
public:
@@ -34,7 +35,7 @@ private:
QHash<QString, QString> replaceRules;
};
-using TemplateInstancePtr = QSharedPointer<TemplateInstance>;
+using TemplateInstancePtr = std::shared_ptr<TemplateInstance>;
class CodeSnipFragment
{
@@ -43,7 +44,7 @@ public:
explicit CodeSnipFragment(const QString &code) : m_code(code) {}
explicit CodeSnipFragment(const TemplateInstancePtr &instance) : m_instance(instance) {}
- bool isEmpty() const { return m_code.isEmpty() && m_instance.isNull(); }
+ bool isEmpty() const { return m_code.isEmpty() && !m_instance; }
QString code() const;
@@ -51,7 +52,7 @@ public:
private:
QString m_code;
- QSharedPointer<TemplateInstance> m_instance;
+ std::shared_ptr<TemplateInstance> m_instance;
};
class CodeSnipAbstract : public CodeSnipHelpers
diff --git a/sources/shiboken6/ApiExtractor/customconversion.cpp b/sources/shiboken6/ApiExtractor/customconversion.cpp
index 4632e4e76..4cfd1b974 100644
--- a/sources/shiboken6/ApiExtractor/customconversion.cpp
+++ b/sources/shiboken6/ApiExtractor/customconversion.cpp
@@ -99,7 +99,7 @@ QString TargetToNativeConversion::sourceTypeCheck() const
return m_sourceTypeCheck;
if (m_sourceType != nullptr && m_sourceType->isCustom()) {
- const auto cte = qSharedPointerCast<const CustomTypeEntry>(m_sourceType);
+ const auto cte = std::static_pointer_cast<const CustomTypeEntry>(m_sourceType);
if (cte->hasCheckFunction()) {
QString result = cte->checkFunction();
if (result != u"true") // For PyObject, which is always true
@@ -134,11 +134,11 @@ void TargetToNativeConversion::formatDebug(QDebug &debug) const
CustomConversionPtr CustomConversion::getCustomConversion(const TypeEntryCPtr &type)
{
if (type->isPrimitive())
- return qSharedPointerCast<const PrimitiveTypeEntry>(type)->customConversion();
+ return std::static_pointer_cast<const PrimitiveTypeEntry>(type)->customConversion();
if (type->isContainer())
- return qSharedPointerCast<const ContainerTypeEntry>(type)->customConversion();
+ return std::static_pointer_cast<const ContainerTypeEntry>(type)->customConversion();
if (type->isValue())
- return qSharedPointerCast<const ValueTypeEntry>(type)->customConversion();
+ return std::static_pointer_cast<const ValueTypeEntry>(type)->customConversion();
return {};
}
@@ -188,7 +188,7 @@ QDebug operator<<(QDebug debug, const CustomConversionPtr &cptr)
debug.noquote();
debug.nospace();
debug << "CustomConversionPtr";
- if (auto *c = cptr.data()) {
+ if (auto *c = cptr.get()) {
c->formatDebug(debug);
} else {
debug << "(0)";
diff --git a/sources/shiboken6/ApiExtractor/customconversion_typedefs.h b/sources/shiboken6/ApiExtractor/customconversion_typedefs.h
index a928378b7..6528f7d7b 100644
--- a/sources/shiboken6/ApiExtractor/customconversion_typedefs.h
+++ b/sources/shiboken6/ApiExtractor/customconversion_typedefs.h
@@ -5,9 +5,10 @@
#define CUSTOMCONVERSION_TYPEDEFS_H
#include <QtCore/QList>
-#include <QtCore/QSharedPointer>
+
+#include <memory>
class CustomConversion;
-using CustomConversionPtr = QSharedPointer<CustomConversion>;
+using CustomConversionPtr = std::shared_ptr<CustomConversion>;
#endif // CUSTOMCONVERSION_TYPEDEFS_H
diff --git a/sources/shiboken6/ApiExtractor/debughelpers_p.h b/sources/shiboken6/ApiExtractor/debughelpers_p.h
index e39a06c88..81ebbb3b9 100644
--- a/sources/shiboken6/ApiExtractor/debughelpers_p.h
+++ b/sources/shiboken6/ApiExtractor/debughelpers_p.h
@@ -5,6 +5,16 @@
#define DEBUGHELPERS_P_H
#include <QtCore/QDebug>
+#include <memory>
+
+template <class T>
+inline QDebug operator<<(QDebug debug, const std::shared_ptr<T> &ptr)
+{
+ QDebugStateSaver saver(debug);
+ debug.nospace();
+ debug << "std::shared_ptr(" << ptr.get() << ")";
+ return debug;
+}
template <class It>
inline void formatSequence(QDebug &d, It i1, It i2,
@@ -24,7 +34,7 @@ inline static void formatPtrSequence(QDebug &d, It i1, It i2,
for (It i = i1; i != i2; ++i) {
if (i != i1)
d << separator;
- d << i->data();
+ d << i->get();
}
}
diff --git a/sources/shiboken6/ApiExtractor/docparser.cpp b/sources/shiboken6/ApiExtractor/docparser.cpp
index 137313cef..dbb09842a 100644
--- a/sources/shiboken6/ApiExtractor/docparser.cpp
+++ b/sources/shiboken6/ApiExtractor/docparser.cpp
@@ -90,7 +90,7 @@ DocModificationList DocParser::getDocModifications(const AbstractMetaClassCPtr &
const AbstractMetaFunctionCPtr &func)
{
auto te = cppClass->typeEntry();
- if (func.isNull())
+ if (!func)
return te->docModifications();
if (func->isUserAdded())
diff --git a/sources/shiboken6/ApiExtractor/docparser.h b/sources/shiboken6/ApiExtractor/docparser.h
index d037fc4e4..664ace412 100644
--- a/sources/shiboken6/ApiExtractor/docparser.h
+++ b/sources/shiboken6/ApiExtractor/docparser.h
@@ -7,7 +7,8 @@
#include "modifications_typedefs.h"
#include <QtCore/QString>
-#include <QtCore/QSharedPointer>
+
+#include <memory>
class AbstractMetaClass;
class DocModification;
@@ -22,7 +23,7 @@ class DocParser
public:
Q_DISABLE_COPY(DocParser)
- using XQueryPtr = QSharedPointer<XQuery>;
+ using XQueryPtr = std::shared_ptr<XQuery>;
DocParser();
virtual ~DocParser();
diff --git a/sources/shiboken6/ApiExtractor/doxygenparser.cpp b/sources/shiboken6/ApiExtractor/doxygenparser.cpp
index 230b73fcf..a1c93c127 100644
--- a/sources/shiboken6/ApiExtractor/doxygenparser.cpp
+++ b/sources/shiboken6/ApiExtractor/doxygenparser.cpp
@@ -76,7 +76,7 @@ void DoxygenParser::fillDocumentation(const AbstractMetaClassPtr &metaClass)
QString errorMessage;
XQueryPtr xquery = XQuery::create(doxyFilePath, &errorMessage);
- if (xquery.isNull()) {
+ if (!xquery) {
qCWarning(lcShibokenDoc, "%s", qPrintable(errorMessage));
return;
}
@@ -154,13 +154,13 @@ void DoxygenParser::fillDocumentation(const AbstractMetaClassPtr &metaClass)
DocParser::getDocModifications(metaClass, func));
if (doc.isEmpty()) {
qCWarning(lcShibokenDoc, "%s",
- qPrintable(msgCannotFindDocumentation(doxyFilePath, func.data(),
+ qPrintable(msgCannotFindDocumentation(doxyFilePath, func.get(),
funcQuery)));
} else {
funcDoc.setValue(doc, tag.first);
}
}
- qSharedPointerConstCast<AbstractMetaFunction>(func)->setDocumentation(funcDoc);
+ std::const_pointer_cast<AbstractMetaFunction>(func)->setDocumentation(funcDoc);
isProperty = false;
}
@@ -212,7 +212,7 @@ Documentation DoxygenParser::retrieveModuleDocumentation(const QString& name){
QString errorMessage;
XQueryPtr xquery = XQuery::create(sourceFile, &errorMessage);
- if (xquery.isNull()) {
+ if (!xquery) {
qCWarning(lcShibokenDoc, "%s", qPrintable(errorMessage));
return {};
}
diff --git a/sources/shiboken6/ApiExtractor/enclosingclassmixin.cpp b/sources/shiboken6/ApiExtractor/enclosingclassmixin.cpp
index 05883e0cf..2421ae527 100644
--- a/sources/shiboken6/ApiExtractor/enclosingclassmixin.cpp
+++ b/sources/shiboken6/ApiExtractor/enclosingclassmixin.cpp
@@ -7,7 +7,7 @@
AbstractMetaClassCPtr EnclosingClassMixin::targetLangEnclosingClass() const
{
- auto result = m_enclosingClass.toStrongRef();
+ auto result = m_enclosingClass.lock();
while (result && !NamespaceTypeEntry::isVisibleScope(result->typeEntry()))
result = result->enclosingClass();
return result;
diff --git a/sources/shiboken6/ApiExtractor/enclosingclassmixin.h b/sources/shiboken6/ApiExtractor/enclosingclassmixin.h
index 0fe8445ac..8d735d5ec 100644
--- a/sources/shiboken6/ApiExtractor/enclosingclassmixin.h
+++ b/sources/shiboken6/ApiExtractor/enclosingclassmixin.h
@@ -12,13 +12,13 @@ class EnclosingClassMixin {
public:
const AbstractMetaClassCPtr enclosingClass() const
- { return m_enclosingClass.toStrongRef(); }
+ { return m_enclosingClass.lock(); }
void setEnclosingClass(const AbstractMetaClassCPtr &cls)
- { m_enclosingClass = cls.toWeakRef(); }
+ { m_enclosingClass = cls; }
AbstractMetaClassCPtr targetLangEnclosingClass() const;
private:
- QWeakPointer<const AbstractMetaClass> m_enclosingClass;
+ std::weak_ptr<const AbstractMetaClass> m_enclosingClass;
};
#endif // ENCLOSINGCLASSMIXIN_H
diff --git a/sources/shiboken6/ApiExtractor/messages.cpp b/sources/shiboken6/ApiExtractor/messages.cpp
index ad70f4ee8..e7af80fe3 100644
--- a/sources/shiboken6/ApiExtractor/messages.cpp
+++ b/sources/shiboken6/ApiExtractor/messages.cpp
@@ -77,7 +77,7 @@ QString msgTypeModificationFailed(const QString &type, int n,
str << "type of argument " << n;
str << " of ";
- if (auto c = func->ownerClass(); !c.isNull())
+ if (auto c = func->ownerClass())
str << c->name() << "::";
str << func->signature() << " to \"" << type << "\": " << why;
return result;
@@ -111,7 +111,7 @@ QString msgArgumentRemovalFailed(const AbstractMetaFunction *func, int n,
QString result;
QTextStream str(&result);
str << "Unable to remove argument " << n << " of ";
- if (auto c = func->ownerClass(); !c.isNull())
+ if (auto c = func->ownerClass())
str << c->name() << "::";
str << func->signature() << ": " << why;
return result;
@@ -732,7 +732,7 @@ QString msgCyclicDependency(const QString &funcName, const QString &graphName,
if (i)
str << ", \"";
str << involvedConversions.at(i)->signature() << '"';
- if (const auto c = involvedConversions.at(i)->implementingClass(); !c.isNull())
+ if (const auto c = involvedConversions.at(i)->implementingClass())
str << '(' << c->name() << ')';
}
}
@@ -761,7 +761,7 @@ QString msgUnknownOperator(const AbstractMetaFunction *func)
{
QString result = u"Unknown operator: \""_s + func->originalName()
+ u'"';
- if (const auto c = func->implementingClass(); !c.isNull())
+ if (const auto c = func->implementingClass())
result += u" in class: "_s + c->name();
return result;
}
@@ -772,7 +772,7 @@ QString msgWrongIndex(const char *varName, const QString &capture,
QString result;
QTextStream str(&result);
str << "Wrong index for " << varName << " variable (" << capture << ") on ";
- if (const auto c = func->implementingClass(); !c.isNull())
+ if (const auto c = func->implementingClass())
str << c->name() << "::";
str << func->signature();
return result;
diff --git a/sources/shiboken6/ApiExtractor/modifications.cpp b/sources/shiboken6/ApiExtractor/modifications.cpp
index d42cfb460..75632a818 100644
--- a/sources/shiboken6/ApiExtractor/modifications.cpp
+++ b/sources/shiboken6/ApiExtractor/modifications.cpp
@@ -188,7 +188,7 @@ QDebug operator<<(QDebug d, const CodeSnip &s)
if (i)
d << ", ";
d << '#' << i << ' ';
- if (f.instance().isNull()) {
+ if (!f.instance()) {
d << '"';
const QString &code = f.code();
const auto lines = QStringView{code}.split(u'\n');
diff --git a/sources/shiboken6/ApiExtractor/modifications_typedefs.h b/sources/shiboken6/ApiExtractor/modifications_typedefs.h
index c827335ab..3b86c55d3 100644
--- a/sources/shiboken6/ApiExtractor/modifications_typedefs.h
+++ b/sources/shiboken6/ApiExtractor/modifications_typedefs.h
@@ -5,7 +5,8 @@
#define MODIFICATIONS_TYPEDEFS_H
#include <QtCore/QList>
-#include <QtCore/QSharedPointer>
+
+#include <memory>
class CodeSnip;
class DocModification;
@@ -14,7 +15,7 @@ struct AddedFunction;
class FieldModification;
class FunctionModification;
-using AddedFunctionPtr = QSharedPointer<AddedFunction>;
+using AddedFunctionPtr = std::shared_ptr<AddedFunction>;
using AddedFunctionList = QList<AddedFunctionPtr>;
using CodeSnipList = QList<CodeSnip>;
using DocModificationList = QList<DocModification>;
diff --git a/sources/shiboken6/ApiExtractor/parser/codemodel.cpp b/sources/shiboken6/ApiExtractor/parser/codemodel.cpp
index 828a7a711..346deceef 100644
--- a/sources/shiboken6/ApiExtractor/parser/codemodel.cpp
+++ b/sources/shiboken6/ApiExtractor/parser/codemodel.cpp
@@ -18,22 +18,22 @@
using namespace Qt::StringLiterals;
-// Predicate to find an item by name in a list of QSharedPointer<Item>
+// Predicate to find an item by name in a list of std::shared_ptr<Item>
template <class T> class ModelItemNamePredicate
{
public:
explicit ModelItemNamePredicate(const QString &name) : m_name(name) {}
- bool operator()(const QSharedPointer<T> &item) const { return item->name() == m_name; }
+ bool operator()(const std::shared_ptr<T> &item) const { return item->name() == m_name; }
private:
const QString m_name;
};
template <class T>
-static QSharedPointer<T> findModelItem(const QList<QSharedPointer<T> > &list, const QString &name)
+static std::shared_ptr<T> findModelItem(const QList<std::shared_ptr<T> > &list, const QString &name)
{
const auto it = std::find_if(list.cbegin(), list.cend(), ModelItemNamePredicate<T>(name));
- return it != list.cend() ? *it : QSharedPointer<T>();
+ return it != list.cend() ? *it : std::shared_ptr<T>();
}
// ---------------------------------------------------------------------------
@@ -76,7 +76,7 @@ static CodeModelItem findRecursion(const ScopeModelItem &scope,
}
if (auto nestedClass = scope->findClass(nameSegment))
return findRecursion(nestedClass, qualifiedName, segment + 1);
- if (auto namespaceItem = qSharedPointerDynamicCast<_NamespaceModelItem>(scope)) {
+ if (auto namespaceItem = std::dynamic_pointer_cast<_NamespaceModelItem>(scope)) {
for (const auto &nestedNamespace : namespaceItem->namespaces()) {
if (nestedNamespace->name() == nameSegment) {
if (auto item = findRecursion(nestedNamespace, qualifiedName, segment + 1))
@@ -121,7 +121,7 @@ QDebug operator<<(QDebug d, const CodeModel *m)
d << "CodeModel(";
if (m) {
const NamespaceModelItem globalNamespaceP = m->globalNamespace();
- if (globalNamespaceP.data())
+ if (globalNamespaceP)
globalNamespaceP->formatDebug(d);
} else {
d << '0';
@@ -705,8 +705,8 @@ _ScopeModelItem::FindEnumByValueReturn
if (searchSiblingNamespaces && scope->kind() == Kind_Namespace) {
if (auto *enclosingNamespace = dynamic_cast<const _NamespaceModelItem *>(enclosingScope)) {
for (const auto &sibling : enclosingNamespace->namespaces()) {
- if (sibling.data() != scope && sibling->name() == scope->name()) {
- if (const auto e = findEnumByValueRecursion(sibling.data(),
+ if (sibling.get() != scope && sibling->name() == scope->name()) {
+ if (const auto e = findEnumByValueRecursion(sibling.get(),
fullValue, enumValue, false)) {
return e;
}
@@ -722,8 +722,8 @@ _ScopeModelItem::FindEnumByValueReturn
// PYSIDE-331: We need to also search the base classes.
if (auto *classItem = dynamic_cast<const _ClassModelItem *>(scope)) {
for (const auto &base : classItem->baseClasses()) {
- if (!base.klass.isNull()) {
- auto *c = base.klass.data();
+ if (base.klass) {
+ auto *c = base.klass.get();
if (const auto e = findEnumByValueRecursion(c, fullValue, enumValue))
return e;
}
diff --git a/sources/shiboken6/ApiExtractor/parser/codemodel.h b/sources/shiboken6/ApiExtractor/parser/codemodel.h
index 97a851995..a9e9f249c 100644
--- a/sources/shiboken6/ApiExtractor/parser/codemodel.h
+++ b/sources/shiboken6/ApiExtractor/parser/codemodel.h
@@ -198,7 +198,7 @@ public:
struct FindEnumByValueReturn
{
- operator bool() const { return !item.isNull(); }
+ operator bool() const { return bool(item); }
EnumModelItem item;
QString qualifiedName;
diff --git a/sources/shiboken6/ApiExtractor/parser/codemodel_fwd.h b/sources/shiboken6/ApiExtractor/parser/codemodel_fwd.h
index a3adf6678..f0a25c9db 100644
--- a/sources/shiboken6/ApiExtractor/parser/codemodel_fwd.h
+++ b/sources/shiboken6/ApiExtractor/parser/codemodel_fwd.h
@@ -7,7 +7,8 @@
#define CODEMODEL_FWD_H
#include <QtCore/QList>
-#include <QtCore/QSharedPointer>
+
+#include <memory>
// forward declarations
class CodeModel;
@@ -27,20 +28,20 @@ class _VariableModelItem;
class _MemberModelItem;
class TypeInfo;
-using ArgumentModelItem = QSharedPointer<_ArgumentModelItem>;
-using ClassModelItem = QSharedPointer<_ClassModelItem>;
-using CodeModelItem = QSharedPointer<_CodeModelItem>;
-using EnumModelItem = QSharedPointer<_EnumModelItem>;
-using EnumeratorModelItem = QSharedPointer<_EnumeratorModelItem>;
-using FileModelItem = QSharedPointer<_FileModelItem>;
-using FunctionModelItem = QSharedPointer<_FunctionModelItem>;
-using NamespaceModelItem = QSharedPointer<_NamespaceModelItem>;
-using ScopeModelItem = QSharedPointer<_ScopeModelItem>;
-using TemplateParameterModelItem = QSharedPointer<_TemplateParameterModelItem>;
-using TypeDefModelItem = QSharedPointer<_TypeDefModelItem>;
-using TemplateTypeAliasModelItem = QSharedPointer<_TemplateTypeAliasModelItem>;
-using VariableModelItem = QSharedPointer<_VariableModelItem>;
-using MemberModelItem = QSharedPointer<_MemberModelItem>;
+using ArgumentModelItem = std::shared_ptr<_ArgumentModelItem>;
+using ClassModelItem = std::shared_ptr<_ClassModelItem>;
+using CodeModelItem = std::shared_ptr<_CodeModelItem>;
+using EnumModelItem = std::shared_ptr<_EnumModelItem>;
+using EnumeratorModelItem = std::shared_ptr<_EnumeratorModelItem>;
+using FileModelItem = std::shared_ptr<_FileModelItem>;
+using FunctionModelItem = std::shared_ptr<_FunctionModelItem>;
+using NamespaceModelItem = std::shared_ptr<_NamespaceModelItem>;
+using ScopeModelItem = std::shared_ptr<_ScopeModelItem>;
+using TemplateParameterModelItem = std::shared_ptr<_TemplateParameterModelItem>;
+using TypeDefModelItem = std::shared_ptr<_TypeDefModelItem>;
+using TemplateTypeAliasModelItem = std::shared_ptr<_TemplateTypeAliasModelItem>;
+using VariableModelItem = std::shared_ptr<_VariableModelItem>;
+using MemberModelItem = std::shared_ptr<_MemberModelItem>;
using ArgumentList = QList<ArgumentModelItem>;
using ClassList = QList<ClassModelItem>;
diff --git a/sources/shiboken6/ApiExtractor/parser/typeinfo.cpp b/sources/shiboken6/ApiExtractor/parser/typeinfo.cpp
index b0fdc0ca9..2e1406d52 100644
--- a/sources/shiboken6/ApiExtractor/parser/typeinfo.cpp
+++ b/sources/shiboken6/ApiExtractor/parser/typeinfo.cpp
@@ -287,14 +287,14 @@ TypeInfo TypeInfo::resolveType(CodeModelItem __item, TypeInfo const &__type, con
otherType.setQualifiedName(__item->qualifiedName());
}
- if (TypeDefModelItem __typedef = qSharedPointerDynamicCast<_TypeDefModelItem>(__item)) {
+ if (TypeDefModelItem __typedef = std::dynamic_pointer_cast<_TypeDefModelItem>(__item)) {
const TypeInfo combined = TypeInfo::combine(__typedef->type(), otherType);
const CodeModelItem nextItem = __scope->model()->findItem(combined.qualifiedName(), __scope);
if (!nextItem)
return combined;
// PYSIDE-362, prevent recursion on opaque structs like
// typedef struct xcb_connection_t xcb_connection_t;
- if (nextItem.data() ==__item.data()) {
+ if (nextItem.get() ==__item.get()) {
std::cerr << "** WARNING Bailing out recursion of " << __FUNCTION__
<< "() on " << qPrintable(__type.qualifiedName().join(u"::"_s))
<< std::endl;
@@ -303,7 +303,7 @@ TypeInfo TypeInfo::resolveType(CodeModelItem __item, TypeInfo const &__type, con
return resolveType(nextItem, combined, __scope);
}
- if (TemplateTypeAliasModelItem templateTypeAlias = qSharedPointerDynamicCast<_TemplateTypeAliasModelItem>(__item)) {
+ if (TemplateTypeAliasModelItem templateTypeAlias = std::dynamic_pointer_cast<_TemplateTypeAliasModelItem>(__item)) {
TypeInfo combined = TypeInfo::combine(templateTypeAlias->type(), otherType);
// For the alias "template<typename T> using QList = QVector<T>" with
diff --git a/sources/shiboken6/ApiExtractor/qtdocparser.cpp b/sources/shiboken6/ApiExtractor/qtdocparser.cpp
index 9c375edc6..badf6b7af 100644
--- a/sources/shiboken6/ApiExtractor/qtdocparser.cpp
+++ b/sources/shiboken6/ApiExtractor/qtdocparser.cpp
@@ -57,7 +57,7 @@ static void formatFunctionUnqualifiedArgTypeQuery(QTextStream &str,
case AbstractMetaType::FlagsPattern: {
// Modify qualified name "QFlags<Qt::AlignmentFlag>" with name "Alignment"
// to "Qt::Alignment" as seen by qdoc.
- const auto flagsEntry = qSharedPointerCast<const FlagsTypeEntry>(metaType.typeEntry());
+ const auto flagsEntry = std::static_pointer_cast<const FlagsTypeEntry>(metaType.typeEntry());
QString name = flagsEntry->qualifiedCppName();
if (name.endsWith(u'>') && name.startsWith(u"QFlags<")) {
const int lastColon = name.lastIndexOf(u':');
@@ -127,7 +127,7 @@ QString QtDocParser::queryFunctionDocumentation(const QString &sourceFileName,
FunctionDocumentationList candidates =
classDocumentation.findFunctionCandidates(func->name(), func->isConstant());
if (candidates.isEmpty()) {
- *errorMessage = msgCannotFindDocumentation(sourceFileName, func.data())
+ *errorMessage = msgCannotFindDocumentation(sourceFileName, func.get())
+ u" (no matches)"_s;
return {};
}
@@ -172,13 +172,13 @@ QString QtDocParser::queryFunctionDocumentation(const QString &sourceFileName,
candidates.erase(pend, candidates.end());
if (candidates.size() == 1) {
const auto &match = candidates.constFirst();
- QTextStream(errorMessage) << msgFallbackForDocumentation(sourceFileName, func.data())
+ QTextStream(errorMessage) << msgFallbackForDocumentation(sourceFileName, func.get())
<< "\n Falling back to \"" << match.signature
<< "\" obtained by matching the argument count only.";
return candidates.constFirst().description;
}
- QTextStream(errorMessage) << msgCannotFindDocumentation(sourceFileName, func.data())
+ QTextStream(errorMessage) << msgCannotFindDocumentation(sourceFileName, func.get())
<< " (" << candidates.size() << " candidates matching the argument count)";
return {};
}
@@ -204,12 +204,12 @@ static QString extractBrief(QString *value)
void QtDocParser::fillDocumentation(const AbstractMetaClassPtr &metaClass)
{
- if (metaClass.isNull())
+ if (!metaClass)
return;
auto context = metaClass->enclosingClass();
- while (!context.isNull()) {
- if (context->enclosingClass().isNull())
+ while (context) {
+ if (!context->enclosingClass())
break;
context = context->enclosingClass();
}
@@ -267,7 +267,7 @@ void QtDocParser::fillDocumentation(const AbstractMetaClassPtr &metaClass)
if (!errorMessage.isEmpty())
qCWarning(lcShibokenDoc, "%s", qPrintable(errorMessage));
const Documentation documentation(detailed, {});
- qSharedPointerConstCast<AbstractMetaFunction>(func)->setDocumentation(documentation);
+ std::const_pointer_cast<AbstractMetaFunction>(func)->setDocumentation(documentation);
}
#if 0
// Fields
diff --git a/sources/shiboken6/ApiExtractor/tests/testabstractmetaclass.cpp b/sources/shiboken6/ApiExtractor/tests/testabstractmetaclass.cpp
index 6f96f6de5..a1940b762 100644
--- a/sources/shiboken6/ApiExtractor/tests/testabstractmetaclass.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testabstractmetaclass.cpp
@@ -23,7 +23,7 @@ void TestAbstractMetaClass::testClassName()
<value-type name="ClassName"/>
</typesystem>)";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 1);
QCOMPARE(classes[0]->name(), u"ClassName");
@@ -39,7 +39,7 @@ void TestAbstractMetaClass::testClassNameUnderNamespace()
</namespace-type>
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2); // 1 namespace + 1 class
if (classes.constFirst()->name() != u"ClassName")
@@ -110,14 +110,14 @@ public:
</typesystem>
)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 4);
const auto a = AbstractMetaClass::findClass(classes, u"A");
const auto b = AbstractMetaClass::findClass(classes, u"B");
const auto c = AbstractMetaClass::findClass(classes, u"C");
const auto f = AbstractMetaClass::findClass(classes, u"F");
- QVERIFY(!f.isNull());
+ QVERIFY(f);
QCOMPARE(a->baseClass(), nullptr);
QCOMPARE(b->baseClass(), a);
@@ -194,10 +194,10 @@ class Derived : public Base {};
</typesystem>
)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto base = AbstractMetaClass::findClass(classes, u"Base");
- QVERIFY(!base.isNull());
+ QVERIFY(base);
QVERIFY(base->isPolymorphic());
const auto derived = AbstractMetaClass::findClass(classes, u"Derived");
QVERIFY(derived);
@@ -218,7 +218,7 @@ void TestAbstractMetaClass::testDefaultValues()
</value-type>
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
const auto classA = AbstractMetaClass::findClass(classes, u"A");
@@ -248,7 +248,7 @@ void TestAbstractMetaClass::testModifiedDefaultValues()
</value-type>
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
const auto classA = AbstractMetaClass::findClass(classes, u"A");
@@ -274,14 +274,14 @@ void TestAbstractMetaClass::testInnerClassOfAPolymorphicOne()
</object-type>
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
QVERIFY(classA->isPolymorphic());
const auto classB = AbstractMetaClass::findClass(classes, u"A::B");
- QVERIFY(!classB.isNull());
+ QVERIFY(classB);
QVERIFY(!classB->isPolymorphic());
}
@@ -302,15 +302,15 @@ void TestAbstractMetaClass::testForwardDeclaredInnerClass()
</value-type>
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
const auto classB = AbstractMetaClass::findClass(classes, u"A::B");
- QVERIFY(!classB.isNull());
+ QVERIFY(classB);
const auto fooF = classB->findFunction(u"foo");
- QVERIFY(!fooF.isNull());
+ QVERIFY(fooF);
}
void TestAbstractMetaClass::testSpecialFunctions()
@@ -333,12 +333,12 @@ void TestAbstractMetaClass::testSpecialFunctions()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
auto ctors = classA->queryFunctions(FunctionQueryOption::AnyConstructor);
QCOMPARE(ctors.size(), 2);
QCOMPARE(ctors.constFirst()->functionType(), AbstractMetaFunction::ConstructorFunction);
@@ -349,7 +349,7 @@ void TestAbstractMetaClass::testSpecialFunctions()
AbstractMetaFunction::AssignmentOperatorFunction);
const auto classB = AbstractMetaClass::findClass(classes, u"B");
- QVERIFY(!classB.isNull());
+ QVERIFY(classB);
ctors = classB->queryFunctions(FunctionQueryOption::AnyConstructor);
QCOMPARE(ctors.size(), 2);
QCOMPARE(ctors.constFirst()->functionType(), AbstractMetaFunction::ConstructorFunction);
@@ -399,7 +399,7 @@ void TestAbstractMetaClass::testClassDefaultConstructors()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 6);
@@ -418,28 +418,28 @@ void TestAbstractMetaClass::testClassDefaultConstructors()
QCOMPARE(ctors[1]->minimalSignature(), u"A(A)");
const auto classB = AbstractMetaClass::findClass(classes, u"B");
- QVERIFY(!classB.isNull());
+ QVERIFY(classB);
QCOMPARE(classB->functions().size(), 2);
QCOMPARE(classB->functions().constFirst()->minimalSignature(), u"B()");
const auto classC = AbstractMetaClass::findClass(classes, u"C");
- QVERIFY(!classC.isNull());
+ QVERIFY(classC);
QCOMPARE(classC->functions().size(), 1);
QCOMPARE(classC->functions().constFirst()->minimalSignature(), u"C(C)");
const auto classD = AbstractMetaClass::findClass(classes, u"D");
- QVERIFY(!classD.isNull());
+ QVERIFY(classD);
QCOMPARE(classD->functions().size(), 1);
QCOMPARE(classD->functions().constFirst()->minimalSignature(), u"D(D)");
QVERIFY(classD->functions().constFirst()->isPrivate());
const auto classE = AbstractMetaClass::findClass(classes, u"E");
- QVERIFY(!classE.isNull());
+ QVERIFY(classE);
QVERIFY(classE->hasPrivateDestructor());
QCOMPARE(classE->functions().size(), 0);
const auto classF = AbstractMetaClass::findClass(classes, u"F");
- QVERIFY(!classF.isNull());
+ QVERIFY(classF);
ctors = classF->queryFunctions(FunctionQueryOption::AnyConstructor);
QCOMPARE(ctors.size(), 2);
@@ -468,7 +468,7 @@ void TestAbstractMetaClass::testClassInheritedDefaultConstructors()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
const auto classA = AbstractMetaClass::findClass(classes, u"A");
@@ -486,7 +486,7 @@ void TestAbstractMetaClass::testClassInheritedDefaultConstructors()
QVERIFY(ctors[1]->isPrivate());
const auto classB = AbstractMetaClass::findClass(classes, u"B");
- QVERIFY(!classB.isNull());
+ QVERIFY(classB);
ctors = classB->queryFunctions(FunctionQueryOption::Constructors);
QCOMPARE(ctors.size(), 1);
@@ -506,11 +506,11 @@ void TestAbstractMetaClass::testAbstractClassDefaultConstructors()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 1);
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
const auto ctors = classA->queryFunctions(FunctionQueryOption::Constructors);
QCOMPARE(ctors.size(), 1);
@@ -527,11 +527,11 @@ void TestAbstractMetaClass::testObjectTypesMustNotHaveCopyConstructors()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 1);
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
const auto ctors = classA->queryFunctions(FunctionQueryOption::Constructors);
QCOMPARE(ctors.size(), 1);
@@ -563,7 +563,7 @@ void TestAbstractMetaClass::testIsPolymorphic()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
const auto b = AbstractMetaClass::findClass(classes, u"A");
@@ -593,13 +593,13 @@ class Derived : public BaseAlias2 {
)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
const auto base = AbstractMetaClass::findClass(classes, u"Base");
- QVERIFY(!base.isNull());
+ QVERIFY(base);
const auto derived = AbstractMetaClass::findClass(classes, u"Derived");
- QVERIFY(!derived.isNull());
+ QVERIFY(derived);
QCOMPARE(derived->baseClasses().value(0), base);
}
@@ -644,7 +644,7 @@ void TestAbstractMetaClass::testFreeOperators()
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(code.constData(), xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
const auto classes = builder->classes();
QCOMPARE(classes.size(), 1);
QVERIFY(classes.constFirst()->hasArithmeticOperatorOverload());
@@ -678,13 +678,13 @@ public:
)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
const auto base = AbstractMetaClass::findClass(classes, u"Base");
- QVERIFY(!base.isNull());
+ QVERIFY(base);
const auto derived = AbstractMetaClass::findClass(classes, u"Derived");
- QVERIFY(!derived.isNull());
+ QVERIFY(derived);
const auto usingMembers = derived->usingMembers();
QCOMPARE(usingMembers.size(), 2);
for (const auto &um : usingMembers) {
@@ -733,10 +733,10 @@ void TestAbstractMetaClass::testUsingTemplateMembers()
)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(code.constData(), xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto valueList = AbstractMetaClass::findClass(classes, u"ValueList");
- QVERIFY(!valueList.isNull());
+ QVERIFY(valueList);
auto list = valueList->templateBaseClass();
QVERIFY(valueList->isUsingMember(list, u"append"_s, Access::Public));
QCOMPARE(valueList->queryFunctionsByName(u"append"_s).size(), 2);
@@ -763,7 +763,7 @@ public:
)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto tc = AbstractMetaClass::findClass(classes, u"TestClass");
// Verify that the constructor and 2 functions are generated.
diff --git a/sources/shiboken6/ApiExtractor/tests/testabstractmetatype.cpp b/sources/shiboken6/ApiExtractor/tests/testabstractmetatype.cpp
index 2c6cb5324..644ae8aa1 100644
--- a/sources/shiboken6/ApiExtractor/tests/testabstractmetatype.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testabstractmetatype.cpp
@@ -54,7 +54,7 @@ void TestAbstractMetaType::testConstCharPtrType()
<function signature='justAtest()' />\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
QCOMPARE(builder->globalFunctions().size(), 1);
const auto func = builder->globalFunctions().constFirst();
AbstractMetaType rtype = func->type();
@@ -87,7 +87,7 @@ void TestAbstractMetaType::testApiVersionSupported()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode,
false, u"1.0"_s));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
@@ -105,7 +105,7 @@ void TestAbstractMetaType::testApiVersionNotSupported()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode,
true, u"0.1"_s));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 1);
@@ -120,7 +120,7 @@ void TestAbstractMetaType::testCharType()
<function signature='justAtest()'/>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 1);
@@ -157,12 +157,12 @@ void TestAbstractMetaType::testTypedef()
<value-type name='C' />\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 1);
const auto c = AbstractMetaClass::findClass(classes, u"C");
- QVERIFY(!c.isNull());
+ QVERIFY(c);
QVERIFY(c->isTypeDef());
}
@@ -182,7 +182,7 @@ void TestAbstractMetaType::testTypedefWithTemplates()
<function signature='func(A&lt;B&gt;)'/>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 1);
@@ -207,12 +207,12 @@ void TestAbstractMetaType::testObjectTypeUsedAsValue()
<object-type name='A'/>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 1);
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
const auto overloads = classA->queryFunctionsByName(u"method"_s);
QCOMPARE(overloads.size(), 1);
const auto method = overloads.constFirst();
diff --git a/sources/shiboken6/ApiExtractor/tests/testaddfunction.cpp b/sources/shiboken6/ApiExtractor/tests/testaddfunction.cpp
index 883cc62e0..c3d6e4a8a 100644
--- a/sources/shiboken6/ApiExtractor/tests/testaddfunction.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testaddfunction.cpp
@@ -26,7 +26,7 @@ void TestAddFunction::testParsingFuncNameAndConstness()
QString errorMessage;
auto f1 = AddedFunction::createAddedFunction(QLatin1StringView(sig1), u"void"_s,
&errorMessage);
- QVERIFY2(!f1.isNull(), qPrintable(errorMessage));
+ QVERIFY2(f1, qPrintable(errorMessage));
QCOMPARE(f1->name(), u"func");
QCOMPARE(f1->arguments().size(), 3);
TypeInfo retval = f1->returnType();
@@ -40,7 +40,7 @@ void TestAddFunction::testParsingFuncNameAndConstness()
auto f2 = AddedFunction::createAddedFunction(QLatin1StringView(sig2),
u"const Abc<int& , C<char*> * > * *"_s,
&errorMessage);
- QVERIFY2(!f2.isNull(), qPrintable(errorMessage));
+ QVERIFY2(f2, qPrintable(errorMessage));
QCOMPARE(f2->name(), u"_fu__nc_");
const auto &args = f2->arguments();
QCOMPARE(args.size(), 4);
@@ -69,7 +69,7 @@ void TestAddFunction::testParsingFuncNameAndConstness()
const char sig3[] = "func()";
auto f3 = AddedFunction::createAddedFunction(QLatin1StringView(sig3), u"void"_s,
&errorMessage);
- QVERIFY2(!f3.isNull(), qPrintable(errorMessage));
+ QVERIFY2(f3, qPrintable(errorMessage));
QCOMPARE(f3->name(), u"func");
QCOMPARE(f3->arguments().size(), 0);
@@ -77,7 +77,7 @@ void TestAddFunction::testParsingFuncNameAndConstness()
const char sig4[] = "operator()(int)const";
auto f4 = AddedFunction::createAddedFunction(QLatin1StringView(sig4), u"int"_s,
&errorMessage);
- QVERIFY2(!f4.isNull(), qPrintable(errorMessage));
+ QVERIFY2(f4, qPrintable(errorMessage));
QCOMPARE(f4->name(), u"operator()");
QCOMPARE(f4->arguments().size(), 1);
QVERIFY(f4->isConstant());
@@ -102,11 +102,11 @@ struct A {
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
auto *typeDb = TypeDatabase::instance();
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
// default ctor, default copy ctor, func a() and the added functions
QCOMPARE(classA->functions().size(), 5);
@@ -146,10 +146,10 @@ void TestAddFunction::testAddFunctionConstructor()
</value-type>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
QCOMPARE(classA->functions().size(), 3); // default and added ctors
const auto addedFunc = classA->functions().constLast();
QCOMPARE(addedFunc->access(), Access::Public);
@@ -169,10 +169,10 @@ void TestAddFunction::testAddFunctionTagDefaultValues()
</value-type>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
// default ctor, default copy ctor and the added function
QCOMPARE(classA->functions().size(), 3);
const auto addedFunc = classA->functions().constLast();
@@ -195,10 +195,10 @@ void TestAddFunction::testAddFunctionCodeSnippets()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
const auto addedFunc = classA->functions().constLast();
QVERIFY(addedFunc->hasInjectedCode());
}
@@ -209,7 +209,7 @@ void TestAddFunction::testAddFunctionWithoutParenteses()
QString errorMessage;
auto f1 = AddedFunction::createAddedFunction(QLatin1StringView(sig1), u"void"_s,
&errorMessage);
- QVERIFY2(!f1.isNull(), qPrintable(errorMessage));
+ QVERIFY2(f1, qPrintable(errorMessage));
QCOMPARE(f1->name(), u"func");
QCOMPARE(f1->arguments().size(), 0);
QCOMPARE(f1->isConstant(), false);
@@ -225,12 +225,12 @@ void TestAddFunction::testAddFunctionWithoutParenteses()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
const auto addedFunc = classA->findFunction(u"func");
- QVERIFY(!addedFunc.isNull());
+ QVERIFY(addedFunc);
QVERIFY(addedFunc->hasInjectedCode());
const auto snips = addedFunc->injectedCodeSnips(TypeSystem::CodeSnipPositionAny,
TypeSystem::TargetLangCode);
@@ -243,7 +243,7 @@ void TestAddFunction::testAddFunctionWithDefaultArgs()
QString errorMessage;
auto f1 = AddedFunction::createAddedFunction(QLatin1StringView(sig1), u"void"_s,
&errorMessage);
- QVERIFY2(!f1.isNull(), qPrintable(errorMessage));
+ QVERIFY2(f1, qPrintable(errorMessage));
QCOMPARE(f1->name(), u"func");
QCOMPARE(f1->arguments().size(), 0);
QCOMPARE(f1->isConstant(), false);
@@ -262,12 +262,12 @@ void TestAddFunction::testAddFunctionWithDefaultArgs()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
const auto addedFunc = classA->findFunction(u"func");
- QVERIFY(!addedFunc.isNull());
+ QVERIFY(addedFunc);
const AbstractMetaArgument &arg = addedFunc->arguments().at(1);
QCOMPARE(arg.defaultValueExpression(), u"2");
}
@@ -285,10 +285,10 @@ void TestAddFunction::testAddFunctionAtModuleLevel()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
auto *typeDb = TypeDatabase::instance();
@@ -310,7 +310,7 @@ void TestAddFunction::testAddFunctionWithVarargs()
QString errorMessage;
auto f1 = AddedFunction::createAddedFunction(QLatin1StringView(sig1), u"void"_s,
&errorMessage);
- QVERIFY2(!f1.isNull(), qPrintable(errorMessage));
+ QVERIFY2(f1, qPrintable(errorMessage));
QCOMPARE(f1->name(), u"func");
QCOMPARE(f1->arguments().size(), 3);
QVERIFY(!f1->isConstant());
@@ -326,12 +326,12 @@ void TestAddFunction::testAddFunctionWithVarargs()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
const auto addedFunc = classA->findFunction(u"func");
- QVERIFY(!addedFunc.isNull());
+ QVERIFY(addedFunc);
const AbstractMetaArgument &arg = addedFunc->arguments().constLast();
QVERIFY(arg.type().isVarargs());
QVERIFY(arg.type().typeEntry()->isVarargs());
@@ -350,12 +350,12 @@ void TestAddFunction::testAddStaticFunction()
</value-type>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
const auto addedFunc = classA->findFunction(u"func");
- QVERIFY(!addedFunc.isNull());
+ QVERIFY(addedFunc);
QVERIFY(addedFunc->isStatic());
}
@@ -375,7 +375,7 @@ void TestAddFunction::testAddGlobalFunction()
<value-type name='B'/>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
const auto globalFuncs = builder->globalFunctions();
QCOMPARE(globalFuncs.size(), 2);
const auto classB = AbstractMetaClass::findClass(builder->classes(), u"B");
@@ -401,7 +401,7 @@ void TestAddFunction::testAddFunctionWithApiVersion()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode,
true, u"0.1"_s));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
const auto globalFuncs = builder->globalFunctions();
QCOMPARE(globalFuncs.size(), 1);
}
@@ -424,11 +424,11 @@ void TestAddFunction::testModifyAddedFunction()
</typesystem>
)";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto foo = AbstractMetaClass::findClass(classes, u"Foo");
const auto method = foo->findFunction(u"method");
- QVERIFY(!method.isNull());
+ QVERIFY(method);
QCOMPARE(method->arguments().size(), 2);
const AbstractMetaArgument &arg = method->arguments().at(1);
QCOMPARE(arg.defaultValueExpression(), u"0");
@@ -451,17 +451,17 @@ void TestAddFunction::testAddFunctionOnTypedef()
</value-type>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto foo = AbstractMetaClass::findClass(classes, u"FooInt");
- QVERIFY(!foo.isNull());
+ QVERIFY(foo);
QVERIFY(foo->hasNonPrivateConstructor());
const auto &lst = foo->queryFunctions(FunctionQueryOption::AnyConstructor);
for (const auto &f : lst)
QVERIFY(f->signature().startsWith(f->name()));
QCOMPARE(lst.size(), 2);
const auto method = foo->findFunction(u"method");
- QVERIFY(!method.isNull());
+ QVERIFY(method);
}
void TestAddFunction::testAddFunctionWithTemplateArg()
@@ -475,7 +475,7 @@ void TestAddFunction::testAddFunctionWithTemplateArg()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
QCOMPARE(builder->globalFunctions().size(), 1);
const auto func = builder->globalFunctions().constFirst();
const AbstractMetaArgument &arg = func->arguments().constFirst();
diff --git a/sources/shiboken6/ApiExtractor/tests/testarrayargument.cpp b/sources/shiboken6/ApiExtractor/tests/testarrayargument.cpp
index 6b6f7e599..f4b22b27e 100644
--- a/sources/shiboken6/ApiExtractor/tests/testarrayargument.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testarrayargument.cpp
@@ -35,7 +35,7 @@ void TestArrayArgument::testArrayArgumentWithSizeDefinedByInteger()
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
QVERIFY(!builder.isNull());
const auto classA = AbstractMetaClass::findClass(builder->classes(), u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
const AbstractMetaArgument &arg = classA->functions().constLast()->arguments().constFirst();
QVERIFY(arg.type().isArray());
@@ -46,7 +46,7 @@ void TestArrayArgument::testArrayArgumentWithSizeDefinedByInteger()
static QString functionMinimalSignature(const AbstractMetaClassCPtr &c, const QString &name)
{
const auto f = c->findFunction(name);
- return f.isNull() ? QString() : f->minimalSignature();
+ return f ? f->minimalSignature() : QString();
}
void TestArrayArgument::testArraySignature()
@@ -109,7 +109,7 @@ void TestArrayArgument::testArrayArgumentWithSizeDefinedByEnumValue()
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
QVERIFY(!builder.isNull());
AbstractMetaClassPtr classA = AbstractMetaClass::findClass(builder->classes(), u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
auto someEnum = classA->findEnum(u"SomeEnum"_s);
QVERIFY(someEnum.has_value());
@@ -138,9 +138,9 @@ void TestArrayArgument::testArrayArgumentWithSizeDefinedByEnumValueFromGlobalEnu
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
const auto classA = AbstractMetaClass::findClass(builder->classes(), u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
AbstractMetaEnum someEnum = builder->globalEnums().constFirst();
auto nvalues = someEnum.findEnumValue(u"NValues");
diff --git a/sources/shiboken6/ApiExtractor/tests/testcodeinjection.cpp b/sources/shiboken6/ApiExtractor/tests/testcodeinjection.cpp
index ed71e6d55..58aaaf9b3 100644
--- a/sources/shiboken6/ApiExtractor/tests/testcodeinjection.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testcodeinjection.cpp
@@ -59,14 +59,14 @@ void TestCodeInjections::testReadFile()
</value-type>\n\
</typesystem>\n"_s;
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode.toLocal8Bit().constData()));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
QCOMPARE(classA->typeEntry()->codeSnips().size(), 1);
QString code = classA->typeEntry()->codeSnips().constFirst().code();
QVERIFY(code.indexOf(expected) != -1);
QVERIFY(classA->typeEntry()->isValue());
- auto vte = qSharedPointerCast<const ValueTypeEntry>(classA->typeEntry());
+ auto vte = std::static_pointer_cast<const ValueTypeEntry>(classA->typeEntry());
code = vte->targetConversionRule();
QVERIFY(code.indexOf(expected) != -1);
}
@@ -85,7 +85,7 @@ void TestCodeInjections::testInjectWithValidApiVersion()
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode,
true, u"1.0"_s));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
QCOMPARE(classA->typeEntry()->codeSnips().size(), 1);
@@ -105,7 +105,7 @@ void TestCodeInjections::testInjectWithInvalidApiVersion()
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode,
true, u"0.1"_s));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
diff --git a/sources/shiboken6/ApiExtractor/tests/testcontainer.cpp b/sources/shiboken6/ApiExtractor/tests/testcontainer.cpp
index e266c146f..5a9b7d188 100644
--- a/sources/shiboken6/ApiExtractor/tests/testcontainer.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testcontainer.cpp
@@ -28,15 +28,15 @@ void TestContainer::testContainerType()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, true));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
//search for class A
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
auto baseContainer = classA->typeEntry()->baseContainerType();
QVERIFY(baseContainer);
- QCOMPARE(reinterpret_cast<const ContainerTypeEntry*>(baseContainer.data())->containerKind(),
+ QCOMPARE(reinterpret_cast<const ContainerTypeEntry*>(baseContainer.get())->containerKind(),
ContainerTypeEntry::ListContainer);
}
@@ -61,12 +61,12 @@ void TestContainer::testListOfValueType()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, true));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 3);
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
QCOMPARE(classA->templateBaseClassInstantiations().size(), 1);
const AbstractMetaType templateInstanceType =
classA->templateBaseClassInstantiations().constFirst();
diff --git a/sources/shiboken6/ApiExtractor/tests/testconversionoperator.cpp b/sources/shiboken6/ApiExtractor/tests/testconversionoperator.cpp
index ac6cb0290..092503622 100644
--- a/sources/shiboken6/ApiExtractor/tests/testconversionoperator.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testconversionoperator.cpp
@@ -33,14 +33,14 @@ void TestConversionOperator::testConversionOperator()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
const auto classB = AbstractMetaClass::findClass(classes, u"B");
const auto classC = AbstractMetaClass::findClass(classes, u"C");
- QVERIFY(!classA.isNull());
- QVERIFY(!classB.isNull());
- QVERIFY(!classC.isNull());
+ QVERIFY(classA);
+ QVERIFY(classB);
+ QVERIFY(classC);
QCOMPARE(classA->functions().size(), 2);
QCOMPARE(classB->functions().size(), 3);
QCOMPARE(classC->functions().size(), 3);
@@ -53,7 +53,7 @@ void TestConversionOperator::testConversionOperator()
break;
}
}
- QVERIFY(!convOp.isNull());
+ QVERIFY(convOp);
QVERIFY(classA->externalConversionOperators().contains(convOp));
}
@@ -71,10 +71,10 @@ void TestConversionOperator::testConversionOperatorOfDiscardedClass()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
QCOMPARE(classA->externalConversionOperators().size(), 0);
}
@@ -95,12 +95,12 @@ void TestConversionOperator::testRemovedConversionOperator()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
const auto classB = AbstractMetaClass::findClass(classes, u"B");
- QVERIFY(!classA.isNull());
- QVERIFY(!classB.isNull());
+ QVERIFY(classA);
+ QVERIFY(classB);
QCOMPARE(classA->functions().size(), 2);
QCOMPARE(classB->functions().size(), 3);
QCOMPARE(classA->externalConversionOperators().size(), 0);
@@ -121,12 +121,12 @@ void TestConversionOperator::testConversionOperatorReturningReference()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
const auto classB = AbstractMetaClass::findClass(classes, u"B");
- QVERIFY(!classA.isNull());
- QVERIFY(!classB.isNull());
+ QVERIFY(classA);
+ QVERIFY(classB);
QCOMPARE(classA->functions().size(), 2);
QCOMPARE(classB->functions().size(), 3);
QCOMPARE(classA->externalConversionOperators().size(), 1);
@@ -155,12 +155,12 @@ void TestConversionOperator::testConversionOperatorReturningConstReference()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
const auto classB = AbstractMetaClass::findClass(classes, u"B");
- QVERIFY(!classA.isNull());
- QVERIFY(!classB.isNull());
+ QVERIFY(classA);
+ QVERIFY(classB);
QCOMPARE(classA->functions().size(), 2);
QCOMPARE(classB->functions().size(), 3);
QCOMPARE(classA->externalConversionOperators().size(), 1);
diff --git a/sources/shiboken6/ApiExtractor/tests/testconversionruletag.cpp b/sources/shiboken6/ApiExtractor/tests/testconversionruletag.cpp
index 5b25c685d..2d754427f 100644
--- a/sources/shiboken6/ApiExtractor/tests/testconversionruletag.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testconversionruletag.cpp
@@ -35,13 +35,13 @@ void TestConversionRuleTag::testConversionRuleTagWithFile()
</value-type>\n\
</typesystem>\n"_s;
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode.toLocal8Bit().data()));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
const auto typeEntry = classA->typeEntry();
QVERIFY(typeEntry->isValue());
- auto vte = qSharedPointerCast<const ValueTypeEntry>(typeEntry);
+ auto vte = std::static_pointer_cast<const ValueTypeEntry>(typeEntry);
QVERIFY(vte->hasTargetConversionRule());
QCOMPARE(vte->targetConversionRule(), QLatin1String(conversionData));
}
@@ -85,10 +85,10 @@ void TestConversionRuleTag::testConversionRuleTagReplace()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
auto *typeDb = TypeDatabase::instance();
auto typeA = typeDb->findPrimitiveType(u"A"_s);
- QVERIFY(!typeA.isNull());
+ QVERIFY(typeA);
QVERIFY(typeA->hasCustomConversion());
auto conversion = typeA->customConversion();
@@ -115,7 +115,7 @@ void TestConversionRuleTag::testConversionRuleTagReplace()
QCOMPARE(toNative.sourceTypeName(), u"B");
QVERIFY(!toNative.isCustomType());
auto typeB = typeDb->findType(u"B"_s);
- QVERIFY(!typeB.isNull());
+ QVERIFY(typeB);
QCOMPARE(toNative.sourceType(), typeB);
QCOMPARE(toNative.sourceTypeCheck(), u"CheckIfInputObjectIsB(%IN)");
QCOMPARE(toNative.conversion().trimmed(), u"%OUT = %IN.createA();");
@@ -153,12 +153,12 @@ if (!TargetDateTimeAPI) TargetDateTime_IMPORT;\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
const auto classA = AbstractMetaClass::findClass(builder->classes(), u"Date");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
QVERIFY(classA->typeEntry()->isValue());
- auto vte = qSharedPointerCast<const ValueTypeEntry>(classA->typeEntry());
+ auto vte = std::static_pointer_cast<const ValueTypeEntry>(classA->typeEntry());
QVERIFY(vte->hasCustomConversion());
auto conversion = vte->customConversion();
@@ -216,10 +216,10 @@ void TestConversionRuleTag::testConversionRuleTagWithInsertTemplate()
"// TEMPLATE - target_to_native - END";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
auto *typeDb = TypeDatabase::instance();
auto typeA = typeDb->findPrimitiveType(u"A"_s);
- QVERIFY(!typeA.isNull());
+ QVERIFY(typeA);
QVERIFY(typeA->hasCustomConversion());
auto conversion = typeA->customConversion();
diff --git a/sources/shiboken6/ApiExtractor/tests/testctorinformation.cpp b/sources/shiboken6/ApiExtractor/tests/testctorinformation.cpp
index 8b1b23a49..e225f91a1 100644
--- a/sources/shiboken6/ApiExtractor/tests/testctorinformation.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testctorinformation.cpp
@@ -19,17 +19,17 @@ void TestCtorInformation::testCtorIsPrivate()
<value-type name='CtorLess'/>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 3);
auto klass = AbstractMetaClass::findClass(classes, u"Control");
- QVERIFY(!klass.isNull());
+ QVERIFY(klass);
QVERIFY(klass->hasNonPrivateConstructor());
klass = AbstractMetaClass::findClass(classes, u"Subject");
- QVERIFY(!klass.isNull());
+ QVERIFY(klass);
QVERIFY(!klass->hasNonPrivateConstructor());
klass = AbstractMetaClass::findClass(classes, u"CtorLess");
- QVERIFY(!klass.isNull());
+ QVERIFY(klass);
QVERIFY(klass->hasNonPrivateConstructor());
}
@@ -45,7 +45,7 @@ void TestCtorInformation::testHasNonPrivateCtor()
<object-type name='Derived'/>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
const auto base = AbstractMetaClass::findClass(classes, u"Base");
diff --git a/sources/shiboken6/ApiExtractor/tests/testdroptypeentries.cpp b/sources/shiboken6/ApiExtractor/tests/testdroptypeentries.cpp
index 2e07b8cba..0f65b1fc8 100644
--- a/sources/shiboken6/ApiExtractor/tests/testdroptypeentries.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testdroptypeentries.cpp
@@ -56,7 +56,7 @@ void TestDropTypeEntries::testDropEntries()
u"Foo.NamespaceA.InnerNamespaceA"_s};
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false,
QString(), droppedEntries));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QVERIFY(AbstractMetaClass::findClass(classes, u"ValueA"));
@@ -79,7 +79,7 @@ void TestDropTypeEntries::testDropEntries()
void TestDropTypeEntries::testDontDropEntries()
{
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QVERIFY(AbstractMetaClass::findClass(classes, u"ValueA"));
@@ -115,7 +115,7 @@ void TestDropTypeEntries::testDropEntryWithChildTags()
QStringList droppedEntries(u"Foo.ValueA"_s);
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode2, xmlCode2, false,
QString(), droppedEntries));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
QVERIFY(!AbstractMetaClass::findClass(builder->classes(), u"ValueA"));
}
@@ -123,7 +123,7 @@ void TestDropTypeEntries::testDropEntryWithChildTags()
void TestDropTypeEntries::testDontDropEntryWithChildTags()
{
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode2, xmlCode2, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
QVERIFY(AbstractMetaClass::findClass(builder->classes(), u"ValueA"));
}
diff --git a/sources/shiboken6/ApiExtractor/tests/testdtorinformation.cpp b/sources/shiboken6/ApiExtractor/tests/testdtorinformation.cpp
index 11b0f6b62..de4cfd9f8 100644
--- a/sources/shiboken6/ApiExtractor/tests/testdtorinformation.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testdtorinformation.cpp
@@ -25,14 +25,14 @@ private:
</typesystem>)";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
auto klass = AbstractMetaClass::findClass(classes, u"Control");
- QVERIFY(!klass.isNull());
+ QVERIFY(klass);
QVERIFY(!klass->hasPrivateDestructor());
klass = AbstractMetaClass::findClass(classes, u"Subject");
- QVERIFY(!klass.isNull());
+ QVERIFY(klass);
QVERIFY(klass->hasPrivateDestructor());
}
@@ -53,14 +53,14 @@ protected:
</typesystem>)";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
auto klass = AbstractMetaClass::findClass(classes, u"Control");
- QVERIFY(!klass.isNull());
+ QVERIFY(klass);
QVERIFY(!klass->hasProtectedDestructor());
klass = AbstractMetaClass::findClass(classes, u"Subject");
- QVERIFY(!klass.isNull());
+ QVERIFY(klass);
QVERIFY(klass->hasProtectedDestructor());
}
@@ -81,14 +81,14 @@ protected:
</typesystem>)";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
auto klass = AbstractMetaClass::findClass(classes, u"Control");
- QVERIFY(!klass.isNull());
+ QVERIFY(klass);
QVERIFY(!klass->hasVirtualDestructor());
klass = AbstractMetaClass::findClass(classes, u"Subject");
- QVERIFY(!klass.isNull());
+ QVERIFY(klass);
QVERIFY(klass->hasVirtualDestructor());
}
@@ -106,22 +106,22 @@ class Subject : public SubjectBase {};
</typesystem>
)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 4);
auto klass = AbstractMetaClass::findClass(classes, u"ControlBase");
- QVERIFY(!klass.isNull());
+ QVERIFY(klass);
QVERIFY(!klass->hasVirtualDestructor());
klass = AbstractMetaClass::findClass(classes, u"Control");
- QVERIFY(!klass.isNull());
+ QVERIFY(klass);
QVERIFY(!klass->hasVirtualDestructor());
klass = AbstractMetaClass::findClass(classes, u"SubjectBase");
- QVERIFY(!klass.isNull());
+ QVERIFY(klass);
QVERIFY(klass->hasVirtualDestructor());
klass = AbstractMetaClass::findClass(classes, u"Subject");
- QVERIFY(!klass.isNull());
+ QVERIFY(klass);
QVERIFY(klass->hasVirtualDestructor());
}
@@ -142,14 +142,14 @@ protected:
</typesystem>)";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
auto klass = AbstractMetaClass::findClass(classes, u"Control");
- QVERIFY(!klass.isNull());
+ QVERIFY(klass);
QVERIFY(klass->isPolymorphic());
klass = AbstractMetaClass::findClass(classes, u"Subject");
- QVERIFY(!klass.isNull());
+ QVERIFY(klass);
QVERIFY(klass->isPolymorphic());
}
diff --git a/sources/shiboken6/ApiExtractor/tests/testenum.cpp b/sources/shiboken6/ApiExtractor/tests/testenum.cpp
index 018c0d231..8a1f6c886 100644
--- a/sources/shiboken6/ApiExtractor/tests/testenum.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testenum.cpp
@@ -38,7 +38,7 @@ void TestEnum::testEnumCppSignature()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 1);
@@ -93,7 +93,7 @@ void TestEnum::testEnumWithApiVersion()
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode,
true, u"0.1"_s));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 1);
QCOMPARE(classes[0]->enums().size(), 1);
@@ -119,7 +119,7 @@ void TestEnum::testAnonymousEnum()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaEnumList globalEnums = builder->globalEnums();
QCOMPARE(globalEnums.size(), 1);
@@ -174,7 +174,7 @@ void TestEnum::testGlobalEnums()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaEnumList globalEnums = builder->globalEnums();
QCOMPARE(globalEnums.size(), 2);
@@ -222,7 +222,7 @@ void TestEnum::testEnumValueFromNeighbourEnum()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 1);
@@ -284,10 +284,10 @@ void TestEnum::testEnumValueFromExpression()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassPtr classA = AbstractMetaClass::findClass(builder->classes(), u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
auto enumA = classA->findEnum(u"EnumA"_s);
QVERIFY(enumA.has_value());
@@ -362,10 +362,10 @@ void TestEnum::testPrivateEnum()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
const auto classA = AbstractMetaClass::findClass(builder->classes(), u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
QCOMPARE(classA->enums().size(), 2);
auto privateEnum = classA->findEnum(u"PrivateEnum"_s);
@@ -401,7 +401,7 @@ void TestEnum::testTypedefEnum()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaEnumList globalEnums = builder->globalEnums();
QCOMPARE(globalEnums.size(), 1);
@@ -426,7 +426,7 @@ void TestEnum::testTypedefEnum()
struct EnumDefaultValuesFixture
{
- QSharedPointer<AbstractMetaBuilder> builder;
+ std::shared_ptr<AbstractMetaBuilder> builder;
AbstractMetaType globalEnum;
AbstractMetaType testEnum;
@@ -462,7 +462,7 @@ namespace Test2
)";
fixture->builder.reset(TestUtil::parse(cppCode, xmlCode, false));
- if (fixture->builder.isNull())
+ if (!fixture->builder)
return -1;
const auto globalEnums = fixture->builder->globalEnums();
@@ -479,15 +479,15 @@ namespace Test2
break;
}
}
- if (testNamespace.isNull())
+ if (!testNamespace)
return -3;
const auto namespaceEnums = testNamespace->enums();
if (namespaceEnums.size() != 2)
return -4;
QList<EnumTypeEntryCPtr > enumTypeEntries{
- qSharedPointerCast<const EnumTypeEntry>(namespaceEnums.at(0).typeEntry()),
- qSharedPointerCast<const EnumTypeEntry>(namespaceEnums.at(1).typeEntry())};
+ std::static_pointer_cast<const EnumTypeEntry>(namespaceEnums.at(0).typeEntry()),
+ std::static_pointer_cast<const EnumTypeEntry>(namespaceEnums.at(1).typeEntry())};
if (enumTypeEntries.constFirst()->flags())
std::swap(enumTypeEntries[0], enumTypeEntries[1]);
fixture->testEnum = AbstractMetaType(enumTypeEntries.at(0));
diff --git a/sources/shiboken6/ApiExtractor/tests/testextrainclude.cpp b/sources/shiboken6/ApiExtractor/tests/testextrainclude.cpp
index befa3a2b9..63d02bb7c 100644
--- a/sources/shiboken6/ApiExtractor/tests/testextrainclude.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testextrainclude.cpp
@@ -21,10 +21,10 @@ void TestExtraInclude::testClassExtraInclude()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
QList<Include> includes = classA->typeEntry()->extraIncludes();
QCOMPARE(includes.size(), 1);
@@ -44,13 +44,13 @@ void TestExtraInclude::testGlobalExtraIncludes()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QVERIFY(AbstractMetaClass::findClass(classes, u"A"));
auto *td = TypeDatabase::instance();
TypeSystemTypeEntryCPtr module = td->defaultTypeSystemType();
- QVERIFY(!module.isNull());
+ QVERIFY(module);
QCOMPARE(module->name(), u"Foo");
QList<Include> includes = module->extraIncludes();
diff --git a/sources/shiboken6/ApiExtractor/tests/testfunctiontag.cpp b/sources/shiboken6/ApiExtractor/tests/testfunctiontag.cpp
index 4a98047f1..18eaf5774 100644
--- a/sources/shiboken6/ApiExtractor/tests/testfunctiontag.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testfunctiontag.cpp
@@ -23,7 +23,7 @@ void TestFunctionTag::testFunctionTagForSpecificSignature()
<function signature='globalFunction(int)'/>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
TypeEntryCPtr func = TypeDatabase::instance()->findType(u"globalFunction"_s);
QVERIFY(func);
@@ -41,10 +41,10 @@ void TestFunctionTag::testFunctionTagForAllSignatures()
<function signature='globalFunction(float)'/>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
TypeEntryCPtr func = TypeDatabase::instance()->findType(u"globalFunction"_s);
- QVERIFY(!func.isNull());
+ QVERIFY(func);
QCOMPARE(builder->globalFunctions().size(), 2);
}
@@ -56,10 +56,10 @@ void TestFunctionTag::testRenameGlobalFunction()
<function signature='global_function_with_ugly_name()' rename='smooth'/>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
TypeEntryCPtr func = TypeDatabase::instance()->findType(u"global_function_with_ugly_name"_s);
- QVERIFY(!func.isNull());
+ QVERIFY(func);
QCOMPARE(builder->globalFunctions().size(), 1);
const auto metaFunc = builder->globalFunctions().constFirst();
diff --git a/sources/shiboken6/ApiExtractor/tests/testimplicitconversions.cpp b/sources/shiboken6/ApiExtractor/tests/testimplicitconversions.cpp
index 5c33512b7..56b80aaef 100644
--- a/sources/shiboken6/ApiExtractor/tests/testimplicitconversions.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testimplicitconversions.cpp
@@ -29,7 +29,7 @@ void TestImplicitConversions::testWithPrivateCtors()
<value-type name='C'/>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 3);
@@ -59,7 +59,7 @@ void TestImplicitConversions::testWithModifiedVisibility()
</typesystem>
)";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
const auto classA = AbstractMetaClass::findClass(classes, u"A");
@@ -93,7 +93,7 @@ void TestImplicitConversions::testWithAddedCtor()
<value-type name='C'/>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 3);
@@ -120,7 +120,7 @@ void TestImplicitConversions::testWithExternalConversionOperator()
<value-type name='B'/>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
const auto classA = AbstractMetaClass::findClass(classes, u"A");
@@ -135,7 +135,7 @@ void TestImplicitConversions::testWithExternalConversionOperator()
if (func->isConversionOperator())
convOp = func;
}
- QVERIFY(!convOp.isNull());
+ QVERIFY(convOp);
QCOMPARE(implicitConvs.constFirst(), convOp);
}
diff --git a/sources/shiboken6/ApiExtractor/tests/testinserttemplate.cpp b/sources/shiboken6/ApiExtractor/tests/testinserttemplate.cpp
index a063b37d0..639925729 100644
--- a/sources/shiboken6/ApiExtractor/tests/testinserttemplate.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testinserttemplate.cpp
@@ -25,11 +25,11 @@ void TestInsertTemplate::testInsertTemplateOnClassInjectCode()
</value-type>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 1);
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
QCOMPARE(classA->typeEntry()->codeSnips().size(), 1);
QString code = classA->typeEntry()->codeSnips().constFirst().code();
QVERIFY(code.contains(u"code template content"));
@@ -48,12 +48,12 @@ void TestInsertTemplate::testInsertTemplateOnModuleInjectCode()
</inject-code>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QVERIFY(classes.isEmpty());
TypeSystemTypeEntryCPtr module = TypeDatabase::instance()->defaultTypeSystemType();
- QVERIFY(!module.isNull());
+ QVERIFY(module);
QCOMPARE(module->name(), u"Foo");
QCOMPARE(module->codeSnips().size(), 1);
QString code = module->codeSnips().constFirst().code().trimmed();
diff --git a/sources/shiboken6/ApiExtractor/tests/testmodifydocumentation.cpp b/sources/shiboken6/ApiExtractor/tests/testmodifydocumentation.cpp
index 49c5b525f..ad9a071da 100644
--- a/sources/shiboken6/ApiExtractor/tests/testmodifydocumentation.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testmodifydocumentation.cpp
@@ -33,9 +33,9 @@ R"(<typesystem package="Foo">
</typesystem>
)";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
const auto classA = AbstractMetaClass::findClass(builder->classes(), u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
DocModificationList docMods = classA->typeEntry()->docModifications();
QCOMPARE(docMods.size(), 2);
QCOMPARE(docMods[0].code().trimmed(), u"<brief>Modified Brief</brief>");
@@ -94,11 +94,11 @@ void TestModifyDocumentation::testInjectAddedFunctionDocumentation()
</typesystem>
)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
const auto classA = AbstractMetaClass::findClass(builder->classes(), u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
const auto f = classA->findFunction(u"foo");
- QVERIFY(!f.isNull());
+ QVERIFY(f);
QVERIFY(f->isUserAdded());
auto docMods = f->addedFunctionDocModifications();
QCOMPARE(docMods.size(), 1);
diff --git a/sources/shiboken6/ApiExtractor/tests/testmodifyfunction.cpp b/sources/shiboken6/ApiExtractor/tests/testmodifyfunction.cpp
index 4f98c7240..c08f5a829 100644
--- a/sources/shiboken6/ApiExtractor/tests/testmodifyfunction.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testmodifyfunction.cpp
@@ -46,11 +46,11 @@ void TestModifyFunction::testRenameArgument()
const QByteArray xmlCode = QByteArray(xmlCode1) + pattern + QByteArray(xmlCode2);
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode.constData(), false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
const auto func = classA->findFunction(u"method");
- QVERIFY(!func.isNull());
+ QVERIFY(func);
QCOMPARE(func->argumentName(1), u"otherArg");
}
@@ -74,11 +74,11 @@ void TestModifyFunction::testOwnershipTransfer()
</object-type>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classB = AbstractMetaClass::findClass(classes, u"B");
const auto func = classB->findFunction(u"method");
- QVERIFY(!func.isNull());
+ QVERIFY(func);
QCOMPARE(func->argumentTargetOwnership(func->ownerClass(), 0),
TypeSystem::CppOwnership);
@@ -124,7 +124,7 @@ void TestModifyFunction::invalidateAfterUse()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode,
false, u"0.1"_s));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classB = AbstractMetaClass::findClass(classes, u"B");
auto func = classB->findFunction(u"call");
@@ -133,7 +133,7 @@ void TestModifyFunction::invalidateAfterUse()
QVERIFY(func->modifications().at(0).argument_mods().at(0).resetAfterUse());
const auto classC = AbstractMetaClass::findClass(classes, u"C");
- QVERIFY(!classC.isNull());
+ QVERIFY(classC);
func = classC->findFunction(u"call");
QCOMPARE(func->modifications().size(), 1);
QCOMPARE(func->modifications().at(0).argument_mods().size(), 1);
@@ -157,7 +157,7 @@ void TestModifyFunction::invalidateAfterUse()
QVERIFY(func->modifications().at(0).argument_mods().at(0).resetAfterUse());
const auto classE = AbstractMetaClass::findClass(classes, u"E");
- QVERIFY(!classE.isNull());
+ QVERIFY(classE);
func = classE->findFunction(u"call");
QVERIFY(func);
QCOMPARE(func->modifications().size(), 1);
@@ -197,7 +197,7 @@ void TestModifyFunction::testWithApiVersion()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode,
false, u"0.1"_s));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classB = AbstractMetaClass::findClass(classes, u"B");
auto func = classB->findFunction(u"method");
@@ -236,34 +236,34 @@ struct A {
)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode,
false, u"0.1"_s));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
// Nothing specified, true
const auto f1 = classA->findFunction(u"f1");
- QVERIFY(!f1.isNull());
+ QVERIFY(f1);
QVERIFY(!f1->allowThread());
// 'auto' specified, should be false for nontrivial function
const auto f2 = classA->findFunction(u"f2");
- QVERIFY(!f2.isNull());
+ QVERIFY(f2);
QVERIFY(f2->allowThread());
// 'no' specified, should be false
const auto f3 = classA->findFunction(u"f3");
- QVERIFY(!f3.isNull());
+ QVERIFY(f3);
QVERIFY(!f3->allowThread());
// Nothing specified, should be false for simple getter
const auto getter1 = classA->findFunction(u"getter1");
- QVERIFY(!getter1.isNull());
+ QVERIFY(getter1);
QVERIFY(!getter1->allowThread());
// Forced to true simple getter
const auto getter2 = classA->findFunction(u"getter2");
- QVERIFY(!getter2.isNull());
+ QVERIFY(getter2);
QVERIFY(getter2->allowThread()); // Forced to true simple getter
}
@@ -286,7 +286,7 @@ void TestModifyFunction::testGlobalFunctionModification()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
QCOMPARE(builder->globalFunctions().size(), 1);
auto *td = TypeDatabase::instance();
@@ -434,24 +434,24 @@ void TestModifyFunction::testScopedModifications()
QFETCH(bool, expectedAllowThread);
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode.constData(), xmlCode.constData(), false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
const auto classA = AbstractMetaClass::findClass(builder->classes(), u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
auto f = classA->findFunction(QStringLiteral("unspecified"));
- QVERIFY(!f.isNull());
+ QVERIFY(f);
QCOMPARE(f->exceptionSpecification(), ExceptionSpecification::Unknown);
QCOMPARE(f->generateExceptionHandling(), expectedGenerateUnspecified);
QCOMPARE(f->allowThread(), expectedAllowThread);
f = classA->findFunction(QStringLiteral("nonThrowing"));
- QVERIFY(!f.isNull());
+ QVERIFY(f);
QCOMPARE(f->exceptionSpecification(), ExceptionSpecification::NoExcept);
QCOMPARE(f->generateExceptionHandling(), expectedGenerateNonThrowing);
f = classA->findFunction(QStringLiteral("throwing"));
- QVERIFY(!f.isNull());
+ QVERIFY(f);
QCOMPARE(f->exceptionSpecification(), ExceptionSpecification::Throws);
QCOMPARE(f->generateExceptionHandling(), expectedGenerateThrowing);
}
diff --git a/sources/shiboken6/ApiExtractor/tests/testmultipleinheritance.cpp b/sources/shiboken6/ApiExtractor/tests/testmultipleinheritance.cpp
index 62f95b67e..e47aa7682 100644
--- a/sources/shiboken6/ApiExtractor/tests/testmultipleinheritance.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testmultipleinheritance.cpp
@@ -31,7 +31,7 @@ void TestMultipleInheritance::testVirtualClass()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 4);
diff --git a/sources/shiboken6/ApiExtractor/tests/testnamespace.cpp b/sources/shiboken6/ApiExtractor/tests/testnamespace.cpp
index fe7055343..974dd0bd8 100644
--- a/sources/shiboken6/ApiExtractor/tests/testnamespace.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testnamespace.cpp
@@ -31,14 +31,14 @@ void NamespaceTest::testNamespaceMembers()
</namespace-type>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto ns = AbstractMetaClass::findClass(classes, u"Namespace");
- QVERIFY(!ns.isNull());
+ QVERIFY(ns);
auto metaEnum = ns->findEnum(u"Option"_s);
QVERIFY(metaEnum.has_value());
const auto func = ns->findFunction(u"foo");
- QVERIFY(!func.isNull());
+ QVERIFY(func);
}
void NamespaceTest::testNamespaceInnerClassMembers()
@@ -61,16 +61,16 @@ void NamespaceTest::testNamespaceInnerClassMembers()
</namespace-type>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto ons = AbstractMetaClass::findClass(classes, u"OuterNamespace");
- QVERIFY(!ons.isNull());
+ QVERIFY(ons);
const auto ins = AbstractMetaClass::findClass(classes, u"OuterNamespace::InnerNamespace");
- QVERIFY(!ins.isNull());
+ QVERIFY(ins);
const auto sc = AbstractMetaClass::findClass(classes, u"OuterNamespace::InnerNamespace::SomeClass");
- QVERIFY(!sc.isNull());
+ QVERIFY(sc);
const auto meth = sc->findFunction(u"method");
- QVERIFY(!meth.isNull());
+ QVERIFY(meth);
}
QTEST_APPLESS_MAIN(NamespaceTest)
diff --git a/sources/shiboken6/ApiExtractor/tests/testnestedtypes.cpp b/sources/shiboken6/ApiExtractor/tests/testnestedtypes.cpp
index 028af5e1d..9af411b1a 100644
--- a/sources/shiboken6/ApiExtractor/tests/testnestedtypes.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testnestedtypes.cpp
@@ -43,14 +43,14 @@ void TestNestedTypes::testNestedTypesModifications()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto ons = AbstractMetaClass::findClass(classes, u"OuterNamespace");
- QVERIFY(!ons.isNull());
+ QVERIFY(ons);
const auto ins = AbstractMetaClass::findClass(classes, u"OuterNamespace::InnerNamespace");
- QVERIFY(!ins.isNull());
+ QVERIFY(ins);
QCOMPARE(ins->functions().size(), 1);
QCOMPARE(ins->typeEntry()->codeSnips().size(), 1);
CodeSnip snip = ins->typeEntry()->codeSnips().constFirst();
@@ -70,7 +70,7 @@ void TestNestedTypes::testNestedTypesModifications()
const auto sc =
AbstractMetaClass::findClass(classes, u"OuterNamespace::InnerNamespace::SomeClass");
- QVERIFY(!sc.isNull());
+ QVERIFY(sc);
QCOMPARE(sc->functions().size(), 2); // default constructor and removed method
const auto removedFunc = sc->functions().constLast();
QVERIFY(removedFunc->isModifiedRemoved());
@@ -93,23 +93,23 @@ void TestNestedTypes::testDuplicationOfNestedTypes()
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 2);
const auto nspace = AbstractMetaClass::findClass(classes, u"Namespace");
- QVERIFY(!nspace.isNull());
+ QVERIFY(nspace);
const auto cls1 = AbstractMetaClass::findClass(classes, u"SomeClass");
- QVERIFY(!cls1.isNull());
+ QVERIFY(cls1);
const auto cls2 = AbstractMetaClass::findClass(classes, u"Namespace::SomeClass");
- QVERIFY(!cls2.isNull());
+ QVERIFY(cls2);
QCOMPARE(cls1, cls2);
QCOMPARE(cls1->name(), u"SomeClass");
QCOMPARE(cls1->qualifiedCppName(), u"Namespace::SomeClass");
auto t1 = TypeDatabase::instance()->findType(u"Namespace::SomeClass"_s);
- QVERIFY(!t1.isNull());
+ QVERIFY(t1);
auto t2 = TypeDatabase::instance()->findType(u"SomeClass"_s);
- QVERIFY(t2.isNull());
+ QVERIFY(!t2);
}
QTEST_APPLESS_MAIN(TestNestedTypes)
diff --git a/sources/shiboken6/ApiExtractor/tests/testnumericaltypedef.cpp b/sources/shiboken6/ApiExtractor/tests/testnumericaltypedef.cpp
index 8dc9b641b..9eef7ec47 100644
--- a/sources/shiboken6/ApiExtractor/tests/testnumericaltypedef.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testnumericaltypedef.cpp
@@ -24,7 +24,7 @@ void TestNumericalTypedef::testNumericalTypedef()
<function signature='funcReal(real)'/>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
QCOMPARE(builder->globalFunctions().size(), 2);
auto funcDouble = builder->globalFunctions().constFirst();
@@ -63,7 +63,7 @@ void TestNumericalTypedef::testUnsignedNumericalTypedef()
<function signature='funcUShort(custom_ushort)'/>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
QCOMPARE(builder->globalFunctions().size(), 2);
auto funcUnsignedShort = builder->globalFunctions().constFirst();
diff --git a/sources/shiboken6/ApiExtractor/tests/testprimitivetypetag.cpp b/sources/shiboken6/ApiExtractor/tests/testprimitivetypetag.cpp
index 76ce7a1e1..b941094f8 100644
--- a/sources/shiboken6/ApiExtractor/tests/testprimitivetypetag.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testprimitivetypetag.cpp
@@ -23,15 +23,15 @@ void TestPrimitiveTypeTag::testPrimitiveTypeDefaultConstructor()
<object-type name='B'/>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 1);
const auto classB = AbstractMetaClass::findClass(classes, u"B");
- QVERIFY(!classB.isNull());
+ QVERIFY(classB);
auto typeEntry = TypeDatabase::instance()->findPrimitiveType(u"A"_s);
- QVERIFY(!typeEntry.isNull());
+ QVERIFY(typeEntry);
QVERIFY(typeEntry->hasDefaultConstructor());
QCOMPARE(typeEntry->defaultConstructor(), u"A()");
}
diff --git a/sources/shiboken6/ApiExtractor/tests/testrefcounttag.cpp b/sources/shiboken6/ApiExtractor/tests/testrefcounttag.cpp
index 76eccf27c..22f8b7a8e 100644
--- a/sources/shiboken6/ApiExtractor/tests/testrefcounttag.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testrefcounttag.cpp
@@ -32,11 +32,11 @@ void TestRefCountTag::testReferenceCountTag()
</object-type>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classB = AbstractMetaClass::findClass(classes, u"B");
const auto func = classB->findFunction(u"keepObject");
- QVERIFY(!func.isNull());
+ QVERIFY(func);
const auto refCount =
func->modifications().constFirst().argument_mods().constFirst().referenceCounts().constFirst();
QCOMPARE(refCount.action, ReferenceCount::Add);
@@ -66,11 +66,11 @@ void TestRefCountTag::testWithApiVersion()
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode,
false, u"0.1"_s));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classB = AbstractMetaClass::findClass(classes, u"B");
const auto func = classB->findFunction(u"keepObject");
- QVERIFY(!func.isNull());
+ QVERIFY(func);
const auto refCount =
func->modifications().constFirst().argument_mods().constFirst().referenceCounts().constFirst();
QCOMPARE(refCount.action, ReferenceCount::Add);
diff --git a/sources/shiboken6/ApiExtractor/tests/testreferencetopointer.cpp b/sources/shiboken6/ApiExtractor/tests/testreferencetopointer.cpp
index 89a5f78c6..e3b18758b 100644
--- a/sources/shiboken6/ApiExtractor/tests/testreferencetopointer.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testreferencetopointer.cpp
@@ -23,12 +23,12 @@ void TestReferenceToPointer::testReferenceToPointerArgument()
<object-type name='B'/>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classB = AbstractMetaClass::findClass(classes, u"B");
- QVERIFY(!classB.isNull());
+ QVERIFY(classB);
const auto func = classB->findFunction(u"dummy");
- QVERIFY(!func.isNull());
+ QVERIFY(func);
QCOMPARE(func->arguments().constFirst().type().minimalSignature(), u"A*&");
}
diff --git a/sources/shiboken6/ApiExtractor/tests/testremovefield.cpp b/sources/shiboken6/ApiExtractor/tests/testremovefield.cpp
index 7f8244160..a12675855 100644
--- a/sources/shiboken6/ApiExtractor/tests/testremovefield.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testremovefield.cpp
@@ -23,10 +23,10 @@ void TestRemoveField::testRemoveField()
</value-type>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
QCOMPARE(classA->fields().size(), 1);
const AbstractMetaField &fieldA = classA->fields().constFirst();
QCOMPARE(fieldA.name(), u"fieldA");
diff --git a/sources/shiboken6/ApiExtractor/tests/testremoveimplconv.cpp b/sources/shiboken6/ApiExtractor/tests/testremoveimplconv.cpp
index 5d22739c7..e6c5eb0c1 100644
--- a/sources/shiboken6/ApiExtractor/tests/testremoveimplconv.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testremoveimplconv.cpp
@@ -30,15 +30,15 @@ void TestRemoveImplConv::testRemoveImplConv()
</value-type>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 3);
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
const auto classB = AbstractMetaClass::findClass(classes, u"B");
- QVERIFY(!classB.isNull());
+ QVERIFY(classB);
const auto classC = AbstractMetaClass::findClass(classes, u"C");
- QVERIFY(!classC.isNull());
+ QVERIFY(classC);
const auto implConv = classC->implicitConversions();
QCOMPARE(implConv.size(), 1);
QCOMPARE(implConv.constFirst()->arguments().constFirst().type().typeEntry(),
diff --git a/sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp b/sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp
index 29f5ec2b5..c2a91c8a9 100644
--- a/sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testremoveoperatormethod.cpp
@@ -68,10 +68,10 @@ struct A {
</object-type>\n\
</typesystem>\n";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
QCOMPARE(classA->functions().size(), 14);
QStringList removedSignatures;
removedSignatures.append(u"operator>>(char&)"_s);
diff --git a/sources/shiboken6/ApiExtractor/tests/testresolvetype.cpp b/sources/shiboken6/ApiExtractor/tests/testresolvetype.cpp
index b87bfb6a1..8251226b2 100644
--- a/sources/shiboken6/ApiExtractor/tests/testresolvetype.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testresolvetype.cpp
@@ -45,12 +45,12 @@ void TestResolveType::testResolveReturnTypeFromParentScope()
</namespace-type>
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classD = AbstractMetaClass::findClass(classes, u"A::D");
- QVERIFY(!classD.isNull());
+ QVERIFY(classD);
const auto meth = classD->findFunction(u"method");
- QVERIFY(!meth.isNull());
+ QVERIFY(meth);
QVERIFY(meth);
}
@@ -60,7 +60,7 @@ void TestResolveType::testResolveReturnTypeFromParentScope()
struct DefaultValuesFixture
{
- QSharedPointer<AbstractMetaBuilder> builder;
+ std::shared_ptr<AbstractMetaBuilder> builder;
AbstractMetaType intType;
AbstractMetaType stringType;
@@ -106,7 +106,7 @@ public:
)";
fixture->builder.reset(TestUtil::parse(cppCode, xmlCode, false));
- if (fixture->builder.isNull())
+ if (!fixture->builder)
return -1;
for (const auto &klass : fixture->builder->classes()) {
@@ -135,7 +135,7 @@ public:
return -3;
auto listFunc = fixture->klass->findFunction(u"listFunc"_s);
- if (listFunc.isNull() || listFunc->arguments().size() != 1)
+ if (!listFunc || listFunc->arguments().size() != 1)
return -3;
fixture->listType = listFunc->arguments().constFirst().type();
@@ -251,16 +251,16 @@ public:
)";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto testClass = AbstractMetaClass::findClass(classes, u"Test");
- QVERIFY(!testClass.isNull());
+ QVERIFY(testClass);
auto *tdb = TypeDatabase::instance();
auto int32TEntry = tdb->findType(u"int32_t"_s);
- QVERIFY2(!int32TEntry.isNull(), "int32_t not found");
+ QVERIFY2(int32TEntry, "int32_t not found");
QVERIFY(int32TEntry->isPrimitive());
- auto int32T = qSharedPointerCast<const PrimitiveTypeEntry>(int32TEntry);
+ auto int32T = std::static_pointer_cast<const PrimitiveTypeEntry>(int32TEntry);
auto basicType = basicReferencedTypeEntry(int32T);
QVERIFY2(basicType != int32T,
"Typedef for int32_t not found. Check the system include paths.");
diff --git a/sources/shiboken6/ApiExtractor/tests/testreverseoperators.cpp b/sources/shiboken6/ApiExtractor/tests/testreverseoperators.cpp
index 9bebf1c10..fcbdbc4e6 100644
--- a/sources/shiboken6/ApiExtractor/tests/testreverseoperators.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testreverseoperators.cpp
@@ -25,10 +25,10 @@ void TestReverseOperators::testReverseSum()
</typesystem>";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
QCOMPARE(classA->functions().size(), 4);
AbstractMetaFunctionCPtr reverseOp;
@@ -42,10 +42,10 @@ void TestReverseOperators::testReverseSum()
}
}
- QVERIFY(!normalOp.isNull());
+ QVERIFY(normalOp);
QVERIFY(!normalOp->isReverseOperator());
QCOMPARE(normalOp->arguments().size(), 1);
- QVERIFY(!reverseOp.isNull());
+ QVERIFY(reverseOp);
QVERIFY(reverseOp->isReverseOperator());
QCOMPARE(reverseOp->arguments().size(), 1);
}
@@ -67,14 +67,14 @@ void TestReverseOperators::testReverseSumWithAmbiguity()
</typesystem>";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
QCOMPARE(classA->functions().size(), 4);
const auto classB = AbstractMetaClass::findClass(classes, u"B");
- QVERIFY(!classB.isNull());
+ QVERIFY(classB);
QCOMPARE(classB->functions().size(), 4);
AbstractMetaFunctionCPtr reverseOp;
@@ -87,11 +87,11 @@ void TestReverseOperators::testReverseSumWithAmbiguity()
normalOp = func;
}
}
- QVERIFY(!normalOp.isNull());
+ QVERIFY(normalOp);
QVERIFY(!normalOp->isReverseOperator());
QCOMPARE(normalOp->arguments().size(), 1);
QCOMPARE(normalOp->minimalSignature(), u"operator+(B,A)");
- QVERIFY(!reverseOp.isNull());
+ QVERIFY(reverseOp);
QVERIFY(reverseOp->isReverseOperator());
QCOMPARE(reverseOp->arguments().size(), 1);
QCOMPARE(reverseOp->minimalSignature(), u"operator+(A,B)");
@@ -111,11 +111,11 @@ void TestReverseOperators::testSpaceshipOperator()
</typesystem>)";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false,
{}, {}, LanguageLevel::Cpp20));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 1);
const auto testClass = AbstractMetaClass::findClass(classes, u"Test");
- QVERIFY(!testClass.isNull());
+ QVERIFY(testClass);
const auto &functions = testClass->functions();
// 6 operators should be synthesized
const auto count = std::count_if(functions.cbegin(), functions.cend(),
diff --git a/sources/shiboken6/ApiExtractor/tests/testtemplates.cpp b/sources/shiboken6/ApiExtractor/tests/testtemplates.cpp
index 3be0a9a35..5462bb5b3 100644
--- a/sources/shiboken6/ApiExtractor/tests/testtemplates.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testtemplates.cpp
@@ -55,13 +55,13 @@ namespace Internet {
</typesystem>)XML").arg(file.fileName());
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, qPrintable(xmlCode1), false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classB = AbstractMetaClass::findClass(classes, u"Bookmarks");
- QVERIFY(!classB.isNull());
+ QVERIFY(classB);
const auto func = classB->findFunction(u"list");
- QVERIFY(!func.isNull());
+ QVERIFY(func);
AbstractMetaType funcType = func->type();
QVERIFY(!funcType.isVoid());
QCOMPARE(funcType.cppSignature(), u"QList<Internet::Url >");
@@ -93,15 +93,15 @@ namespace Namespace {
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classB = AbstractMetaClass::findClass(classes, u"B");
- QVERIFY(!classB.isNull());
+ QVERIFY(classB);
QVERIFY(!classB->baseClass());
QVERIFY(classB->baseClassName().isEmpty());
const auto func = classB->findFunction(u"foo");
- QVERIFY(!func.isNull());
+ QVERIFY(func);
AbstractMetaType argType = func->arguments().constFirst().type();
QCOMPARE(argType.instantiations().size(), 1);
QCOMPARE(argType.typeEntry()->qualifiedCppName(), u"QList");
@@ -130,7 +130,7 @@ void func(List<int> arg) {}
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
const auto globalFuncs = builder->globalFunctions();
QCOMPARE(globalFuncs.size(), 1);
@@ -155,7 +155,7 @@ void func(List<int>* arg) {}
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaFunctionCList globalFuncs = builder->globalFunctions();
QCOMPARE(globalFuncs.size(), 1);
@@ -180,7 +180,7 @@ void func(List<int>& arg) {}
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
const auto globalFuncs = builder->globalFunctions();
QCOMPARE(globalFuncs.size(), 1);
@@ -209,19 +209,19 @@ struct List {
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
const AbstractMetaClassList templates = builder->templates();
QCOMPARE(templates.size(), 1);
AbstractMetaClassCPtr list = templates.constFirst();
// Verify that the parameter of "void append(List l)" gets fixed to "List<T >"
const auto append = list->findFunction(QStringLiteral("append"));
- QVERIFY(!append.isNull());
+ QVERIFY(append);
QCOMPARE(append->arguments().size(), 1);
QCOMPARE(append->arguments().at(0).type().cppSignature(), u"List<T >");
// Verify that the parameter of "void erase(Iterator)" is not modified
const auto erase = list->findFunction(QStringLiteral("erase"));
- QVERIFY(!erase.isNull());
+ 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(), u"List::Iterator");
@@ -250,7 +250,7 @@ struct FooBars : public ListContainer<FooBar> {};
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
AbstractMetaClassList templates = builder->templates();
QCOMPARE(classes.size(), 2);
@@ -287,11 +287,11 @@ template<SomeEnum type> struct Future {};
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classB = AbstractMetaClass::findClass(classes, u"B");
- QVERIFY(!classB.isNull());
+ QVERIFY(classB);
QVERIFY(!classB->baseClass());
QVERIFY(classB->baseClassName().isEmpty());
// 3 functions: simple constructor, copy constructor and "method()".
@@ -326,11 +326,11 @@ template<SomeEnum type> struct Future {};
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classB = AbstractMetaClass::findClass(classes, u"Namespace::B");
- QVERIFY(!classB.isNull());
+ QVERIFY(classB);
QVERIFY(!classB->baseClass());
QVERIFY(classB->baseClassName().isEmpty());
// 3 functions: simple constructor, copy constructor and "method()".
@@ -362,14 +362,14 @@ typedef BaseTemplateClass<TypeOne> TypeOneClass;
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 3);
const auto base = AbstractMetaClass::findClass(classes, u"BaseTemplateClass");
- QVERIFY(!base.isNull());
+ QVERIFY(base);
const auto one = AbstractMetaClass::findClass(classes, u"TypeOneClass");
- QVERIFY(!one.isNull());
+ QVERIFY(one);
QCOMPARE(one->templateBaseClass(), base);
QCOMPARE(one->functions().size(), base->functions().size());
QVERIFY(one->isTypeDef());
@@ -411,24 +411,24 @@ typedef Vector<int> IntVector;
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, true));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
QCOMPARE(classes.size(), 1);
const auto vector = AbstractMetaClass::findClass(classes, u"IntVector");
- QVERIFY(!vector.isNull());
+ QVERIFY(vector);
auto baseContainer = vector->typeEntry()->baseContainerType();
- QVERIFY(!baseContainer.isNull());
- QCOMPARE(reinterpret_cast<const ContainerTypeEntry*>(baseContainer.data())->containerKind(),
+ QVERIFY(baseContainer);
+ QCOMPARE(reinterpret_cast<const ContainerTypeEntry*>(baseContainer.get())->containerKind(),
ContainerTypeEntry::ListContainer);
QCOMPARE(vector->functions().size(), 4);
const auto method = vector->findFunction(u"method");
- QVERIFY(!method.isNull());
+ QVERIFY(method);
QCOMPARE(method->signature(), u"method(const Vector<int > & vector)");
const auto otherMethod = vector->findFunction(u"otherMethod");
- QVERIFY(!otherMethod.isNull());
+ QVERIFY(otherMethod);
QCOMPARE(otherMethod->signature(), u"otherMethod()");
QVERIFY(!otherMethod->type().isVoid());
QCOMPARE(otherMethod->type().cppSignature(), u"Vector<int >");
@@ -455,7 +455,7 @@ Array<int, 2> foo();
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, true));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
auto functions = builder->globalFunctions();
QCOMPARE(functions.size(), 1);
auto foo = functions.constFirst();
@@ -538,30 +538,30 @@ void TestTemplates::testTemplateTypeDefs()
const QByteArray cppBa = cpp.toLocal8Bit();
const QByteArray xmlBa = xml.toLocal8Bit();
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppBa.constData(), xmlBa.constData(), true));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto optional = AbstractMetaClass::findClass(classes, u"Optional");
- QVERIFY(!optional.isNull());
+ QVERIFY(optional);
// Find the typedef'ed class
const auto optionalInt = AbstractMetaClass::findClass(classes, u"IntOptional");
- QVERIFY(!optionalInt.isNull());
+ QVERIFY(optionalInt);
QCOMPARE(optionalInt->templateBaseClass(), optional);
// Find the class typedef'ed in the typesystem XML
const auto xmlOptionalInt = AbstractMetaClass::findClass(classes, u"XmlIntOptional");
- QVERIFY(!xmlOptionalInt.isNull());
+ QVERIFY(xmlOptionalInt);
QCOMPARE(xmlOptionalInt->templateBaseClass(), optional);
// Check whether the value() method now has an 'int' return
const auto valueMethod = optionalInt->findFunction(u"value");
- QVERIFY(!valueMethod.isNull());
+ QVERIFY(valueMethod);
QCOMPARE(valueMethod->type().cppSignature(), u"int");
// ditto for typesystem XML
const auto xmlValueMethod = xmlOptionalInt->findFunction(u"value");
- QVERIFY(!xmlValueMethod.isNull());
+ QVERIFY(xmlValueMethod);
QCOMPARE(xmlValueMethod->type().cppSignature(), u"int");
// Check whether the m_value field is of type 'int'
@@ -607,11 +607,11 @@ public:
</typesystem>)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, true));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto testClass = AbstractMetaClass::findClass(classes, u"Test");
- QVERIFY(!testClass.isNull());
+ QVERIFY(testClass);
auto fields = testClass->fields();
QCOMPARE(fields.size(), 1);
@@ -620,7 +620,7 @@ public:
QCOMPARE(fieldType.instantiations().size(), 1);
const auto derived = AbstractMetaClass::findClass(classes, u"Derived");
- QVERIFY(!derived.isNull());
+ QVERIFY(derived);
auto base = derived->templateBaseClass();
QCOMPARE(base->name(), u"Container1");
}
diff --git a/sources/shiboken6/ApiExtractor/tests/testtyperevision.cpp b/sources/shiboken6/ApiExtractor/tests/testtyperevision.cpp
index 400979c4c..a7c83907b 100644
--- a/sources/shiboken6/ApiExtractor/tests/testtyperevision.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testtyperevision.cpp
@@ -30,7 +30,7 @@ void TestTypeRevision::testRevisionAttr()
"</object-type>"
"</typesystem>";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto rev0 = AbstractMetaClass::findClass(classes, u"Rev_0");
QCOMPARE(rev0->typeEntry()->revision(), 0);
@@ -82,7 +82,7 @@ class Bar20 {};
)XML";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, true, version));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
QCOMPARE(builder->classes().size(), expectedClassCount);
}
diff --git a/sources/shiboken6/ApiExtractor/tests/testvaluetypedefaultctortag.cpp b/sources/shiboken6/ApiExtractor/tests/testvaluetypedefaultctortag.cpp
index 2e762c1f9..19143e895 100644
--- a/sources/shiboken6/ApiExtractor/tests/testvaluetypedefaultctortag.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testvaluetypedefaultctortag.cpp
@@ -22,17 +22,17 @@ void TestValueTypeDefaultCtorTag::testValueTypeDefaultCtorTagArgument()
<value-type name='B' />\n\
</typesystem>";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode, false));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
QVERIFY(classA->typeEntry()->hasDefaultConstructor());
QCOMPARE(classA->typeEntry()->defaultConstructor(), u"A(0, 0)");
const auto classB = AbstractMetaClass::findClass(classes, u"B");
- QVERIFY(!classB.isNull());
+ QVERIFY(classB);
QVERIFY(!classB->typeEntry()->hasDefaultConstructor());
}
diff --git a/sources/shiboken6/ApiExtractor/tests/testvoidarg.cpp b/sources/shiboken6/ApiExtractor/tests/testvoidarg.cpp
index daf0d2aa5..b472cbfba 100644
--- a/sources/shiboken6/ApiExtractor/tests/testvoidarg.cpp
+++ b/sources/shiboken6/ApiExtractor/tests/testvoidarg.cpp
@@ -17,12 +17,12 @@ void TestVoidArg::testVoidParsedFunction()
<value-type name='A'/>\n\
</typesystem>";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
const auto addedFunc = classA->findFunction(u"a");
- QVERIFY(!addedFunc.isNull());
+ QVERIFY(addedFunc);
QCOMPARE(addedFunc->arguments().size(), 0);
}
@@ -36,12 +36,12 @@ void TestVoidArg::testVoidAddedFunction()
</value-type>\n\
</typesystem>";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
const auto addedFunc = classA->findFunction(u"a");
- QVERIFY(!addedFunc.isNull());
+ QVERIFY(addedFunc);
QCOMPARE(addedFunc->arguments().size(), 0);
}
@@ -54,12 +54,12 @@ void TestVoidArg::testVoidPointerParsedFunction()
<value-type name='A' />\n\
</typesystem>";
QScopedPointer<AbstractMetaBuilder> builder(TestUtil::parse(cppCode, xmlCode));
- QVERIFY(!builder.isNull());
+ QVERIFY(builder);
AbstractMetaClassList classes = builder->classes();
const auto classA = AbstractMetaClass::findClass(classes, u"A");
- QVERIFY(!classA.isNull());
+ QVERIFY(classA);
const auto addedFunc = classA->findFunction(u"a");
- QVERIFY(!addedFunc.isNull());
+ QVERIFY(addedFunc);
QCOMPARE(addedFunc->arguments().size(), 1);
}
diff --git a/sources/shiboken6/ApiExtractor/typedatabase.cpp b/sources/shiboken6/ApiExtractor/typedatabase.cpp
index 868cdd47d..adb092f19 100644
--- a/sources/shiboken6/ApiExtractor/typedatabase.cpp
+++ b/sources/shiboken6/ApiExtractor/typedatabase.cpp
@@ -44,7 +44,7 @@
using namespace Qt::StringLiterals;
-using TypeDatabaseParserContextPtr = QSharedPointer<TypeDatabaseParserContext>;
+using TypeDatabaseParserContextPtr = std::shared_ptr<TypeDatabaseParserContext>;
// package -> api-version
@@ -133,7 +133,7 @@ struct TypeDatabasePrivate
template <class Predicate>
TypeEntryCList findTypesHelper(const QString &name, Predicate pred) const;
template <class Type, class Predicate>
- QList<QSharedPointer<const Type> > findTypesByTypeHelper(Predicate pred) const;
+ QList<std::shared_ptr<const Type> > findTypesByTypeHelper(Predicate pred) const;
TypeEntryPtr resolveTypeDefEntry(const TypedefEntryPtr &typedefEntry, QString *errorMessage);
template <class String>
bool isSuppressedWarningHelper(const String &s) const;
@@ -340,7 +340,7 @@ QStringList TypeDatabase::typesystemKeywords() const
IncludeList TypeDatabase::extraIncludes(const QString& className) const
{
auto typeEntry = findComplexType(className);
- return typeEntry.isNull() ? IncludeList() : typeEntry->extraIncludes();
+ return typeEntry ? typeEntry->extraIncludes() : IncludeList();
}
const QStringList &TypeDatabase::systemIncludes() const
@@ -377,14 +377,14 @@ ContainerTypeEntryPtr TypeDatabase::findContainerType(const QString &name) const
auto type_entry = findType(template_name);
if (type_entry && type_entry->isContainer())
- return qSharedPointerCast<ContainerTypeEntry>(type_entry);
+ return std::static_pointer_cast<ContainerTypeEntry>(type_entry);
return {};
}
static bool inline useType(const TypeEntryCPtr &t)
{
return !t->isPrimitive()
- || qSharedPointerCast<const PrimitiveTypeEntry>(t)->preferredTargetLangType();
+ || std::static_pointer_cast<const PrimitiveTypeEntry>(t)->preferredTargetLangType();
}
FunctionTypeEntryPtr TypeDatabase::findFunctionType(const QString &name) const
@@ -392,7 +392,7 @@ FunctionTypeEntryPtr TypeDatabase::findFunctionType(const QString &name) const
const auto entries = d->findTypeRange(name);
for (const TypeEntryPtr &entry : entries) {
if (entry->type() == TypeEntry::FunctionType && useType(entry))
- return qSharedPointerCast<FunctionTypeEntry>(entry);
+ return std::static_pointer_cast<FunctionTypeEntry>(entry);
}
return {};
}
@@ -455,12 +455,12 @@ TypeEntryCList TypeDatabasePrivate::findTypesHelper(const QString &name, Predica
}
template<class Type, class Predicate>
-QList<QSharedPointer<const Type> > TypeDatabasePrivate::findTypesByTypeHelper(Predicate pred) const
+QList<std::shared_ptr<const Type> > TypeDatabasePrivate::findTypesByTypeHelper(Predicate pred) const
{
- QList<QSharedPointer<const Type> > result;
+ QList<std::shared_ptr<const Type> > result;
for (const auto &entry : m_entries) {
if (pred(entry))
- result.append(qSharedPointerCast<const Type>(entry));
+ result.append(std::static_pointer_cast<const Type>(entry));
}
return result;
}
@@ -605,8 +605,8 @@ TypeEntryPtr TypeDatabasePrivate::resolveTypeDefEntry(const TypedefEntryPtr &typ
case TypeEntry::ContainerType:
case TypeEntry::ObjectType:
case TypeEntry::SmartPointerType:
- source = qSharedPointerDynamicCast<ComplexTypeEntry>(e);
- Q_ASSERT(!source.isNull());
+ source = std::dynamic_pointer_cast<ComplexTypeEntry>(e);
+ Q_ASSERT(source);
break;
default:
break;
@@ -642,8 +642,8 @@ bool TypeDatabase::addType(const TypeEntryPtr &e, QString *errorMessage)
bool TypeDatabasePrivate::addType(TypeEntryPtr e, QString *errorMessage)
{
if (e->type() == TypeEntry::TypedefType) {
- e = resolveTypeDefEntry(qSharedPointerCast<TypedefEntry>(e), errorMessage);
- if (Q_UNLIKELY(e.isNull()))
+ e = resolveTypeDefEntry(std::static_pointer_cast<TypedefEntry>(e), errorMessage);
+ if (Q_UNLIKELY(!e))
return false;
}
m_entries.insert(e->qualifiedCppName(), e);
@@ -655,7 +655,7 @@ ConstantValueTypeEntryPtr
TypeDatabase::addConstantValueTypeEntry(const QString &value,
const TypeEntryCPtr &parent)
{
- ConstantValueTypeEntryPtr result(new ConstantValueTypeEntry(value, parent));
+ auto result = std::make_shared<ConstantValueTypeEntry>(value, parent);
result->setCodeGeneration(TypeEntry::GenerateNothing);
addType(result);
return result;
@@ -688,7 +688,7 @@ bool TypeDatabase::isReturnTypeRejected(const QString& className, const QString&
FlagsTypeEntryPtr TypeDatabase::findFlagsType(const QString &name) const
{
TypeEntryPtr fte = findType(name);
- if (fte.isNull()) {
+ if (!fte) {
fte = d->m_flagsEntries.value(name);
if (!fte) {
//last hope, search for flag without scope inside of flags hash
@@ -701,7 +701,7 @@ FlagsTypeEntryPtr TypeDatabase::findFlagsType(const QString &name) const
}
}
}
- return qSharedPointerCast<FlagsTypeEntry>(fte);
+ return std::static_pointer_cast<FlagsTypeEntry>(fte);
}
void TypeDatabase::addFlagsType(FlagsTypeEntryPtr fte)
@@ -721,7 +721,7 @@ void TypeDatabase::addTemplate(const TemplateEntryPtr &t)
void TypeDatabase::addTemplate(const QString &name, const QString &code)
{
- TemplateEntryPtr te(new TemplateEntry(name));
+ auto te = std::make_shared<TemplateEntry>(name);
te->addCode(code);
addTemplate(te);
}
@@ -967,7 +967,7 @@ bool TypeDatabase::parseFile(QIODevice *device, bool generate)
bool TypeDatabasePrivate::parseFile(QIODevice *device, TypeDatabase *db, bool generate)
{
- const TypeDatabaseParserContextPtr context(new TypeDatabaseParserContext);
+ const auto context = std::make_shared<TypeDatabaseParserContext>();
context->db = db;
if (!parseFile(context, device, generate))
@@ -1068,7 +1068,7 @@ PrimitiveTypeEntryPtr TypeDatabase::findPrimitiveType(const QString& name) const
const auto entries = d->findTypeRange(name);
for (const auto &entry : entries) {
if (entry->isPrimitive()) {
- auto pe = qSharedPointerCast<PrimitiveTypeEntry>(entry);
+ auto pe = std::static_pointer_cast<PrimitiveTypeEntry>(entry);
if (pe->preferredTargetLangType())
return pe;
}
@@ -1082,7 +1082,7 @@ ComplexTypeEntryPtr TypeDatabase::findComplexType(const QString& name) const
const auto entries = d->findTypeRange(name);
for (const auto &entry : entries) {
if (entry->isComplex() && useType(entry))
- return qSharedPointerCast<ComplexTypeEntry>(entry);
+ return std::static_pointer_cast<ComplexTypeEntry>(entry);
}
return nullptr;
}
@@ -1091,8 +1091,8 @@ ObjectTypeEntryPtr TypeDatabase::findObjectType(const QString& name) const
{
const auto entries = d->findTypeRange(name);
for (const auto &entry : entries) {
- if (!entry.isNull() && entry->isObject() && useType(entry))
- return qSharedPointerCast<ObjectTypeEntry>(entry);
+ if (entry && entry->isObject() && useType(entry))
+ return std::static_pointer_cast<ObjectTypeEntry>(entry);
}
return nullptr;
}
@@ -1103,7 +1103,7 @@ NamespaceTypeEntryList TypeDatabase::findNamespaceTypes(const QString& name) con
const auto entries = d->findTypeRange(name);
for (const auto &entry : entries) {
if (entry->isNamespace())
- result.append(qSharedPointerCast<NamespaceTypeEntry>(entry));
+ result.append(std::static_pointer_cast<NamespaceTypeEntry>(entry));
}
return result;
}
@@ -1356,7 +1356,7 @@ void TypeDatabase::formatBuiltinTypes(QDebug debug) const
QList<PrimitiveFormatListEntry> primitiveEntries;
for (auto &e : std::as_const(d->m_entries)) {
if (e->isPrimitive()) {
- auto pe = qSharedPointerCast<const PrimitiveTypeEntry>(e);
+ auto pe = std::static_pointer_cast<const PrimitiveTypeEntry>(e);
auto basic = basicReferencedTypeEntry(pe);
if (basic != pe) {
const auto idx = indexOf(primitiveEntries, basic);
@@ -1391,7 +1391,7 @@ PrimitiveTypeEntryPtr
const QString &rootPackage,
const CustomTypeEntryPtr &targetLang)
{
- PrimitiveTypeEntryPtr result(new PrimitiveTypeEntry(name, {}, root));
+ auto result = std::make_shared<PrimitiveTypeEntry>(name, QVersionNumber{}, root);
result->setTargetLangApiType(targetLang);
result->setTargetLangPackage(rootPackage);
addBuiltInType(result);
@@ -1419,15 +1419,15 @@ void TypeDatabasePrivate::addBuiltInPrimitiveTypes()
// C++ primitive types
auto pyLongEntry = findType(u"PyLong"_s);
- Q_ASSERT(!pyLongEntry.isNull() && pyLongEntry->isCustom());
- auto pyLongCustomEntry = qSharedPointerCast<CustomTypeEntry>(pyLongEntry);
+ Q_ASSERT(pyLongEntry && pyLongEntry->isCustom());
+ auto pyLongCustomEntry = std::static_pointer_cast<CustomTypeEntry>(pyLongEntry);
auto pyBoolEntry = findType(u"PyBool"_s);
- Q_ASSERT(!pyBoolEntry.isNull() && pyBoolEntry->isCustom());
+ Q_ASSERT(pyBoolEntry && pyBoolEntry->isCustom());
auto sbkCharEntry = findType(u"SbkChar"_s);
- Q_ASSERT(!sbkCharEntry.isNull() && sbkCharEntry->isCustom());
- auto sbkCharCustomEntry = qSharedPointerCast<CustomTypeEntry>(sbkCharEntry);
+ Q_ASSERT(sbkCharEntry && sbkCharEntry->isCustom());
+ auto sbkCharCustomEntry = std::static_pointer_cast<CustomTypeEntry>(sbkCharEntry);
- auto pyBoolCustomEntry = qSharedPointerCast<CustomTypeEntry>(pyBoolEntry);
+ auto pyBoolCustomEntry = std::static_pointer_cast<CustomTypeEntry>(pyBoolEntry);
for (const auto &t : AbstractMetaType::cppIntegralTypes()) {
if (!m_entries.contains(t)) {
CustomTypeEntryPtr targetLangApi = pyLongCustomEntry;
@@ -1440,16 +1440,16 @@ void TypeDatabasePrivate::addBuiltInPrimitiveTypes()
}
auto pyFloatEntry = findType(u"PyFloat"_s);
- Q_ASSERT(!pyFloatEntry.isNull() && pyFloatEntry->isCustom());
- auto pyFloatCustomEntry = qSharedPointerCast<CustomTypeEntry>(pyFloatEntry);
+ Q_ASSERT(pyFloatEntry && pyFloatEntry->isCustom());
+ auto pyFloatCustomEntry = std::static_pointer_cast<CustomTypeEntry>(pyFloatEntry);
for (const auto &t : AbstractMetaType::cppFloatTypes()) {
if (!m_entries.contains(t))
addBuiltInPrimitiveType(t, root, rootPackage, pyFloatCustomEntry);
}
auto pyUnicodeEntry = findType(u"PyUnicode"_s);
- Q_ASSERT(!pyUnicodeEntry.isNull() && pyUnicodeEntry->isCustom());
- auto pyUnicodeCustomEntry = qSharedPointerCast<CustomTypeEntry>(pyUnicodeEntry);
+ Q_ASSERT(pyUnicodeEntry && pyUnicodeEntry->isCustom());
+ auto pyUnicodeCustomEntry = std::static_pointer_cast<CustomTypeEntry>(pyUnicodeEntry);
const QString stdString = u"std::string"_s;
if (!m_entries.contains(stdString)) {
diff --git a/sources/shiboken6/ApiExtractor/typedatabase.h b/sources/shiboken6/ApiExtractor/typedatabase.h
index 11ed26002..45cd1d2db 100644
--- a/sources/shiboken6/ApiExtractor/typedatabase.h
+++ b/sources/shiboken6/ApiExtractor/typedatabase.h
@@ -11,7 +11,8 @@
#include <QtCore/QRegularExpression>
#include <QtCore/QStringList>
#include <QtCore/QVersionNumber>
-#include <QtCore/QSharedPointer>
+
+#include <memory>
QT_FORWARD_DECLARE_CLASS(QIODevice)
@@ -163,12 +164,12 @@ public:
// Top level file parsing
bool parseFile(const QString &filename, bool generate = true);
- bool parseFile(const QSharedPointer<TypeDatabaseParserContext> &context,
+ bool parseFile(const std::shared_ptr<TypeDatabaseParserContext> &context,
const QString &filename, const QString &currentPath, bool generate);
// Top level QIODevice parsing for tests.
bool parseFile(QIODevice *device, bool generate = true);
- bool parseFile(const QSharedPointer<TypeDatabaseParserContext> &context,
+ bool parseFile(const std::shared_ptr<TypeDatabaseParserContext> &context,
QIODevice *device, bool generate = true);
static bool setApiVersion(const QString &package, const QString &version);
diff --git a/sources/shiboken6/ApiExtractor/typesystem.cpp b/sources/shiboken6/ApiExtractor/typesystem.cpp
index 382b6d6ce..68b678c41 100644
--- a/sources/shiboken6/ApiExtractor/typesystem.cpp
+++ b/sources/shiboken6/ApiExtractor/typesystem.cpp
@@ -182,7 +182,7 @@ TypeSystemTypeEntryCPtr typeSystemTypeEntry(TypeEntryCPtr e)
{
for (; e; e = e->parent()) {
if (e->type() == TypeEntry::TypeSystemType)
- return qSharedPointerCast<const TypeSystemTypeEntry>(e);
+ return std::static_pointer_cast<const TypeSystemTypeEntry>(e);
}
return {};
}
@@ -324,7 +324,7 @@ QString TypeEntryPrivate::shortName() const
bool foundInlineNamespace = false;
for (auto p = m_parent; p != nullptr && p->type() != TypeEntry::TypeSystemType; p = p->parent()) {
if (p->type() == TypeEntry::NamespaceType
- && qSharedPointerCast<const NamespaceTypeEntry>(p)->isInlineNamespace()) {
+ && std::static_pointer_cast<const NamespaceTypeEntry>(p)->isInlineNamespace()) {
foundInlineNamespace = true;
} else {
parents.append(p);
@@ -893,7 +893,7 @@ PrimitiveTypeEntryCPtr basicReferencedTypeEntry(const PrimitiveTypeEntryCPtr &e)
PrimitiveTypeEntryCPtr basicReferencedTypeEntry(const TypeEntryCPtr &e)
{
Q_ASSERT(e->isPrimitive());
- return basicReferencedTypeEntry(qSharedPointerCast<const PrimitiveTypeEntry>(e));
+ return basicReferencedTypeEntry(std::static_pointer_cast<const PrimitiveTypeEntry>(e));
}
PrimitiveTypeEntryCPtr basicReferencedNonBuiltinTypeEntry(const PrimitiveTypeEntryCPtr &e)
@@ -927,7 +927,7 @@ void PrimitiveTypeEntry::setPreferredTargetLangType(bool b)
bool PrimitiveTypeEntry::hasCustomConversion() const
{
S_D(const PrimitiveTypeEntry);
- return !d->m_customConversion.isNull();
+ return bool(d->m_customConversion);
}
void PrimitiveTypeEntry::setCustomConversion(const CustomConversionPtr &customConversion)
@@ -1850,7 +1850,7 @@ QString ContainerTypeEntry::opaqueContainerName(const QString &instantiation) co
bool ContainerTypeEntry::hasCustomConversion() const
{
S_D(const ContainerTypeEntry);
- return !d->m_customConversion.isNull();
+ return bool(d->m_customConversion);
}
void ContainerTypeEntry::setCustomConversion(const CustomConversionPtr &customConversion)
@@ -2131,7 +2131,7 @@ void NamespaceTypeEntry::setInlineNamespace(bool i)
bool NamespaceTypeEntry::isVisibleScope(const TypeEntryCPtr &e)
{
- return isVisibleScope(e.data());
+ return isVisibleScope(e.get());
}
bool NamespaceTypeEntry::isVisibleScope(const TypeEntry *e)
@@ -2172,7 +2172,7 @@ ValueTypeEntry::ValueTypeEntry(const QString &entryName, const QVersionNumber &v
bool ValueTypeEntry::hasCustomConversion() const
{
S_D(const ValueTypeEntry);
- return !d->m_customConversion.isNull();
+ return bool(d->m_customConversion);
}
void ValueTypeEntry::setCustomConversion(const CustomConversionPtr &customConversion)
@@ -2355,9 +2355,9 @@ void TypeEntry::formatDebug(QDebug &debug) const
void PrimitiveTypeEntry::formatDebug(QDebug &debug) const
{
TypeEntry::formatDebug(debug);
- if (auto e = referencedTypeEntry(); !e.isNull()) {
+ if (auto e = referencedTypeEntry()) {
debug << ", references";
- for (; e != nullptr; e = e->referencedTypeEntry())
+ for (; e ; e = e->referencedTypeEntry())
debug << ":\"" << e->qualifiedCppName() <<'"';
}
}
@@ -2488,7 +2488,7 @@ QDebug operator<<(QDebug d, const TypeEntry *te)
QDebug operator<<(QDebug d, const TypeEntryCPtr &te)
{
- d << te.data();
+ d << te.get();
return d;
}
@@ -2509,7 +2509,7 @@ QDebug operator<<(QDebug d, const TemplateEntry *te)
QDebug operator<<(QDebug d, const TemplateEntryCPtr &te)
{
- d << te.data();
+ d << te.get();
return d;
}
#endif // QT_NO_DEBUG_STREAM
diff --git a/sources/shiboken6/ApiExtractor/typesystem_typedefs.h b/sources/shiboken6/ApiExtractor/typesystem_typedefs.h
index ca652252d..bd835a8c1 100644
--- a/sources/shiboken6/ApiExtractor/typesystem_typedefs.h
+++ b/sources/shiboken6/ApiExtractor/typesystem_typedefs.h
@@ -5,7 +5,8 @@
#define TYPESYSTEM_TYPEDEFS_H
#include <QtCore/QList>
-#include <QtCore/QSharedPointer>
+
+#include <memory>
class ArrayTypeEntry;
class ComplexTypeEntry;
@@ -26,43 +27,43 @@ class TypedefEntry;
class TypeSystemTypeEntry;
class ValueTypeEntry;
-using ArrayTypeEntryPtr = QSharedPointer<ArrayTypeEntry>;
-using ComplexTypeEntryPtr = QSharedPointer<ComplexTypeEntry>;
-using ConstantValueTypeEntryPtr = QSharedPointer<ConstantValueTypeEntry>;
-using ContainerTypeEntryPtr = QSharedPointer<ContainerTypeEntry>;
-using CustomTypeEntryPtr = QSharedPointer<CustomTypeEntry>;
-using EnumTypeEntryPtr = QSharedPointer<EnumTypeEntry>;
-using EnumValueTypeEntryPtr = QSharedPointer<EnumValueTypeEntry>;
-using FlagsTypeEntryPtr = QSharedPointer<FlagsTypeEntry>;
-using FunctionTypeEntryPtr = QSharedPointer<FunctionTypeEntry>;
-using NamespaceTypeEntryPtr = QSharedPointer<NamespaceTypeEntry>;
-using ObjectTypeEntryPtr = QSharedPointer<ObjectTypeEntry>;
-using PrimitiveTypeEntryPtr = QSharedPointer<PrimitiveTypeEntry>;
-using SmartPointerTypeEntryPtr = QSharedPointer<SmartPointerTypeEntry>;
-using TemplateEntryPtr = QSharedPointer<TemplateEntry>;
-using TypeEntryPtr = QSharedPointer<TypeEntry>;
-using TypedefEntryPtr = QSharedPointer<TypedefEntry>;
-using TypeSystemTypeEntryPtr = QSharedPointer<TypeSystemTypeEntry>;
-using ValueTypeEntryPtr = QSharedPointer<ValueTypeEntry>;
+using ArrayTypeEntryPtr = std::shared_ptr<ArrayTypeEntry>;
+using ComplexTypeEntryPtr = std::shared_ptr<ComplexTypeEntry>;
+using ConstantValueTypeEntryPtr = std::shared_ptr<ConstantValueTypeEntry>;
+using ContainerTypeEntryPtr = std::shared_ptr<ContainerTypeEntry>;
+using CustomTypeEntryPtr = std::shared_ptr<CustomTypeEntry>;
+using EnumTypeEntryPtr = std::shared_ptr<EnumTypeEntry>;
+using EnumValueTypeEntryPtr = std::shared_ptr<EnumValueTypeEntry>;
+using FlagsTypeEntryPtr = std::shared_ptr<FlagsTypeEntry>;
+using FunctionTypeEntryPtr = std::shared_ptr<FunctionTypeEntry>;
+using NamespaceTypeEntryPtr = std::shared_ptr<NamespaceTypeEntry>;
+using ObjectTypeEntryPtr = std::shared_ptr<ObjectTypeEntry>;
+using PrimitiveTypeEntryPtr = std::shared_ptr<PrimitiveTypeEntry>;
+using SmartPointerTypeEntryPtr = std::shared_ptr<SmartPointerTypeEntry>;
+using TemplateEntryPtr = std::shared_ptr<TemplateEntry>;
+using TypeEntryPtr = std::shared_ptr<TypeEntry>;
+using TypedefEntryPtr = std::shared_ptr<TypedefEntry>;
+using TypeSystemTypeEntryPtr = std::shared_ptr<TypeSystemTypeEntry>;
+using ValueTypeEntryPtr = std::shared_ptr<ValueTypeEntry>;
-using ArrayTypeEntryCPtr = QSharedPointer<const ArrayTypeEntry>;
-using ComplexTypeEntryCPtr = QSharedPointer<const ComplexTypeEntry>;
-using ConstantValueTypeEntryCPtr = QSharedPointer<const ConstantValueTypeEntry>;
-using ContainerTypeEntryCPtr = QSharedPointer<const ContainerTypeEntry>;
-using CustomTypeEntryCPtr = QSharedPointer<const CustomTypeEntry>;
-using EnumTypeEntryCPtr = QSharedPointer<const EnumTypeEntry>;
-using EnumValueTypeEntryCPtr = QSharedPointer<const EnumValueTypeEntry>;
-using FlagsTypeEntryCPtr = QSharedPointer<const FlagsTypeEntry>;
-using FunctionTypeEntryCPtr = QSharedPointer<const FunctionTypeEntry>;
-using NamespaceTypeEntryCPtr = QSharedPointer<const NamespaceTypeEntry>;
-using ObjectTypeEntryCPtr = QSharedPointer<const ObjectTypeEntry>;
-using PrimitiveTypeEntryCPtr = QSharedPointer<const PrimitiveTypeEntry>;
-using SmartPointerTypeEntryCPtr = QSharedPointer<const SmartPointerTypeEntry>;
-using TemplateEntryCPtr = QSharedPointer<const TemplateEntry>;
-using TypeEntryCPtr = QSharedPointer<const TypeEntry>;
-using TypedefEntryCPtr = QSharedPointer<const TypedefEntry>;
-using TypeSystemTypeEntryCPtr = QSharedPointer<const TypeSystemTypeEntry>;
-using ValueTypeEntryCPtr = QSharedPointer<const ValueTypeEntry>;
+using ArrayTypeEntryCPtr = std::shared_ptr<const ArrayTypeEntry>;
+using ComplexTypeEntryCPtr = std::shared_ptr<const ComplexTypeEntry>;
+using ConstantValueTypeEntryCPtr = std::shared_ptr<const ConstantValueTypeEntry>;
+using ContainerTypeEntryCPtr = std::shared_ptr<const ContainerTypeEntry>;
+using CustomTypeEntryCPtr = std::shared_ptr<const CustomTypeEntry>;
+using EnumTypeEntryCPtr = std::shared_ptr<const EnumTypeEntry>;
+using EnumValueTypeEntryCPtr = std::shared_ptr<const EnumValueTypeEntry>;
+using FlagsTypeEntryCPtr = std::shared_ptr<const FlagsTypeEntry>;
+using FunctionTypeEntryCPtr = std::shared_ptr<const FunctionTypeEntry>;
+using NamespaceTypeEntryCPtr = std::shared_ptr<const NamespaceTypeEntry>;
+using ObjectTypeEntryCPtr = std::shared_ptr<const ObjectTypeEntry>;
+using PrimitiveTypeEntryCPtr = std::shared_ptr<const PrimitiveTypeEntry>;
+using SmartPointerTypeEntryCPtr = std::shared_ptr<const SmartPointerTypeEntry>;
+using TemplateEntryCPtr = std::shared_ptr<const TemplateEntry>;
+using TypeEntryCPtr = std::shared_ptr<const TypeEntry>;
+using TypedefEntryCPtr = std::shared_ptr<const TypedefEntry>;
+using TypeSystemTypeEntryCPtr = std::shared_ptr<const TypeSystemTypeEntry>;
+using ValueTypeEntryCPtr = std::shared_ptr<const ValueTypeEntry>;
using ContainerTypeEntryCList = QList<ContainerTypeEntryCPtr>;
using NamespaceTypeEntryList = QList<NamespaceTypeEntryPtr>;
diff --git a/sources/shiboken6/ApiExtractor/typesystemparser.cpp b/sources/shiboken6/ApiExtractor/typesystemparser.cpp
index 2cdfe94bd..161454c34 100644
--- a/sources/shiboken6/ApiExtractor/typesystemparser.cpp
+++ b/sources/shiboken6/ApiExtractor/typesystemparser.cpp
@@ -646,7 +646,7 @@ enum class ParserState
Template
};
-TypeSystemParser::TypeSystemParser(const QSharedPointer<TypeDatabaseParserContext> &context,
+TypeSystemParser::TypeSystemParser(const std::shared_ptr<TypeDatabaseParserContext> &context,
bool generate) :
m_context(context),
m_generate(generate ? TypeEntry::GenerateCode : TypeEntry::GenerateForSubclass)
@@ -879,7 +879,7 @@ bool TypeSystemParser::endElement(StackElement element)
toNative.setSourceType(m_context->db->findType(toNative.sourceTypeName()));
}
}
- purgeEmptyCodeSnips(&qSharedPointerCast<TypeSystemTypeEntry>(top->entry)->codeSnips());
+ purgeEmptyCodeSnips(&std::static_pointer_cast<TypeSystemTypeEntry>(top->entry)->codeSnips());
break;
case StackElement::FunctionTypeEntry:
TypeDatabase::instance()->addGlobalUserFunctionModifications(top->functionMods);
@@ -891,7 +891,7 @@ bool TypeSystemParser::endElement(StackElement element)
case StackElement::NamespaceTypeEntry: {
Q_ASSERT(top->entry);
Q_ASSERT(top->entry->isComplex());
- auto centry = qSharedPointerCast<ComplexTypeEntry>(top->entry);
+ auto centry = std::static_pointer_cast<ComplexTypeEntry>(top->entry);
purgeEmptyCodeSnips(&centry->codeSnips());
centry->setAddedFunctions(top->addedFunctions);
centry->setFunctionModifications(top->functionMods);
@@ -901,13 +901,13 @@ bool TypeSystemParser::endElement(StackElement element)
break;
case StackElement::TypedefTypeEntry: {
- auto centry = qSharedPointerCast<TypedefEntry>(top->entry)->target();
+ auto centry = std::static_pointer_cast<TypedefEntry>(top->entry)->target();
centry->setAddedFunctions(centry->addedFunctions() + top->addedFunctions);
centry->setFunctionModifications(centry->functionModifications() + top->functionMods);
centry->setFieldModifications(centry->fieldModifications() + top->fieldMods);
centry->setDocModification(centry->docModifications() + top->docModifications);
if (top->entry->isComplex()) {
- auto cte = qSharedPointerCast<const ComplexTypeEntry>(top->entry);
+ auto cte = std::static_pointer_cast<const ComplexTypeEntry>(top->entry);
centry->setCodeSnips(centry->codeSnips() + cte->codeSnips());
}
}
@@ -930,7 +930,7 @@ bool TypeSystemParser::endElement(StackElement element)
case ParserState::PrimitiveTypeNativeToTargetConversion:
case ParserState::PrimitiveTypeTargetToNativeConversion: {
auto customConversion = CustomConversion::getCustomConversion(top->entry);
- if (customConversion.isNull()) {
+ if (!customConversion) {
m_error = msgMissingCustomConversion(top->entry);
return false;
}
@@ -1067,12 +1067,12 @@ CodeSnipAbstract *TypeSystemParser::injectCodeTarget(qsizetype offset) const
}
case ParserState::TypeEntryCodeInjection:
Q_ASSERT(top->entry->isComplex());
- return &qSharedPointerCast<ComplexTypeEntry>(top->entry)->codeSnips().last();
+ return &std::static_pointer_cast<ComplexTypeEntry>(top->entry)->codeSnips().last();
case ParserState::TypeSystemCodeInjection:
Q_ASSERT(top->entry->isTypeSystem());
- return &qSharedPointerCast<TypeSystemTypeEntry>(top->entry)->codeSnips().last();
+ return &std::static_pointer_cast<TypeSystemTypeEntry>(top->entry)->codeSnips().last();
case ParserState::Template:
- return m_templateEntry.data();
+ return m_templateEntry.get();
default:
break;
}
@@ -1246,7 +1246,7 @@ bool TypeSystemParser::checkRootElement()
{
for (auto i = m_contextStack.size() - 1; i >= 0; --i) {
auto e = m_contextStack.at(i)->entry;
- if (!e.isNull() && e->isTypeSystem())
+ if (e && e->isTypeSystem())
return true;
}
m_error = msgNoRootTypeSystemEntry();
@@ -1284,7 +1284,7 @@ bool TypeSystemParser::applyCommonAttributes(const ConditionalStreamReader &read
} else if (name == u"view-on") {
const QString name = attributes->takeAt(i).value().toString();
TypeEntryPtr views = findViewedType(name);
- if (views.isNull()) {
+ if (!views) {
m_error = msgCannotFindView(name, type->name());
return false;
}
@@ -1301,7 +1301,7 @@ CustomTypeEntryPtr TypeSystemParser::parseCustomTypeEntry(const ConditionalStrea
{
if (!checkRootElement())
return nullptr;
- CustomTypeEntryPtr result(new CustomTypeEntry(name, since, m_contextStack.top()->entry));
+ auto result = std::make_shared<CustomTypeEntry>(name, since, m_contextStack.top()->entry);
for (auto i = attributes->size() - 1; i >= 0; --i) {
const auto name = attributes->at(i).qualifiedName();
if (name == checkFunctionAttribute())
@@ -1319,9 +1319,9 @@ FlagsTypeEntryPtr
{
if (!checkRootElement())
return nullptr;
- FlagsTypeEntryPtr ftype(new FlagsTypeEntry(u"QFlags<"_s + enumEntry->name() + u'>',
- since,
- typeSystemTypeEntry(currentParentTypeEntry())));
+ auto ftype = std::make_shared<FlagsTypeEntry>(u"QFlags<"_s + enumEntry->name() + u'>',
+ since,
+ typeSystemTypeEntry(currentParentTypeEntry()));
ftype->setOriginator(enumEntry);
ftype->setTargetLangPackage(enumEntry->targetLangPackage());
// Try toenumEntry get the guess the qualified flag name
@@ -1422,8 +1422,9 @@ SmartPointerTypeEntryPtr
return nullptr;
}
- SmartPointerTypeEntryPtr type(new SmartPointerTypeEntry(name, getter, smartPointerType,
- refCountMethodName, since, currentParentTypeEntry()));
+ auto type = std::make_shared<SmartPointerTypeEntry>(name, getter, smartPointerType,
+ refCountMethodName, since,
+ currentParentTypeEntry());
if (!applyCommonAttributes(reader, type, attributes))
return nullptr;
applyComplexTypeAttributes(reader, type, attributes);
@@ -1441,7 +1442,7 @@ PrimitiveTypeEntryPtr
{
if (!checkRootElement())
return nullptr;
- PrimitiveTypeEntryPtr type (new PrimitiveTypeEntry(name, since, currentParentTypeEntry()));
+ auto type = std::make_shared<PrimitiveTypeEntry>(name, since, currentParentTypeEntry());
QString targetLangApiName;
if (!applyCommonAttributes(reader, type, attributes))
return nullptr;
@@ -1465,11 +1466,11 @@ PrimitiveTypeEntryPtr
if (!targetLangApiName.isEmpty()) {
auto e = m_context->db->findType(targetLangApiName);
- if (e.isNull() || !e->isCustom()) {
+ if (!e || !e->isCustom()) {
m_error = msgInvalidTargetLanguageApiName(targetLangApiName);
return nullptr;
}
- type->setTargetLangApiType(qSharedPointerCast<CustomTypeEntry>(e));
+ type->setTargetLangApiType(std::static_pointer_cast<CustomTypeEntry>(e));
}
type->setTargetLangPackage(m_defaultPackage);
return type;
@@ -1509,8 +1510,8 @@ ContainerTypeEntryPtr
return nullptr;
}
attributes->removeAt(typeIndex);
- ContainerTypeEntryPtr type(new ContainerTypeEntry(name, containerTypeOpt.value(),
- since, currentParentTypeEntry()));
+ auto type = std::make_shared<ContainerTypeEntry>(name, containerTypeOpt.value(),
+ since, currentParentTypeEntry());
if (!applyCommonAttributes(reader, type, attributes))
return nullptr;
applyComplexTypeAttributes(reader, type, attributes);
@@ -1537,7 +1538,7 @@ EnumTypeEntryPtr
{
if (!checkRootElement())
return nullptr;
- EnumTypeEntryPtr entry(new EnumTypeEntry(name, since, currentParentTypeEntry()));
+ auto entry = std::make_shared<EnumTypeEntry>(name, since, currentParentTypeEntry());
applyCommonAttributes(reader, entry, attributes);
entry->setTargetLangPackage(m_defaultPackage);
@@ -1589,7 +1590,7 @@ NamespaceTypeEntryPtr
{
if (!checkRootElement())
return nullptr;
- NamespaceTypeEntryPtr result(new NamespaceTypeEntry(name, since, currentParentTypeEntry()));
+ auto result = std::make_shared<NamespaceTypeEntry>(name, since, currentParentTypeEntry());
auto visibility = TypeSystem::Visibility::Unspecified;
applyCommonAttributes(reader, result, attributes);
for (auto i = attributes->size() - 1; i >= 0; --i) {
@@ -1651,7 +1652,7 @@ ValueTypeEntryPtr
{
if (!checkRootElement())
return nullptr;
- ValueTypeEntryPtr typeEntry(new ValueTypeEntry(name, since, currentParentTypeEntry()));
+ auto typeEntry = std::make_shared<ValueTypeEntry>(name, since, currentParentTypeEntry());
if (!applyCommonAttributes(reader, typeEntry, attributes))
return nullptr;
applyComplexTypeAttributes(reader, typeEntry, attributes);
@@ -1695,8 +1696,9 @@ FunctionTypeEntryPtr
TypeEntryPtr existingType = m_context->db->findType(name);
- if (existingType.isNull()) {
- FunctionTypeEntryPtr result(new FunctionTypeEntry(name, signature, since, currentParentTypeEntry()));
+ if (!existingType) {
+ auto result = std::make_shared<FunctionTypeEntry>(name, signature, since,
+ currentParentTypeEntry());
result->setSnakeCase(snakeCase);
applyCommonAttributes(reader, result, attributes);
return result;
@@ -1708,7 +1710,7 @@ FunctionTypeEntryPtr
return nullptr;
}
- auto result = qSharedPointerCast<FunctionTypeEntry>(existingType);
+ auto result = std::static_pointer_cast<FunctionTypeEntry>(existingType);
result->addSignature(signature);
return result;
}
@@ -1732,7 +1734,8 @@ TypedefEntryPtr
return nullptr;
}
const QString sourceType = attributes->takeAt(sourceIndex).value().toString();
- TypedefEntryPtr result(new TypedefEntry(name, sourceType, since, currentParentTypeEntry()));
+ auto result = std::make_shared<TypedefEntry>(name, sourceType, since,
+ currentParentTypeEntry());
if (!applyCommonAttributes(reader, result, attributes))
return nullptr;
applyComplexTypeAttributes(reader, result, attributes);
@@ -2045,15 +2048,15 @@ TypeSystemTypeEntryPtr TypeSystemParser::parseRootElement(const ConditionalStrea
}
if (m_defaultPackage.isEmpty()) { // Extending default, see addBuiltInContainerTypes()
- auto moduleEntry = qSharedPointerConstCast<TypeSystemTypeEntry>(m_context->db->defaultTypeSystemType());
- Q_ASSERT(!moduleEntry.isNull());
+ auto moduleEntry = std::const_pointer_cast<TypeSystemTypeEntry>(m_context->db->defaultTypeSystemType());
+ Q_ASSERT(moduleEntry);
m_defaultPackage = moduleEntry->name();
return moduleEntry;
}
auto moduleEntry =
- qSharedPointerConstCast<TypeSystemTypeEntry>(m_context->db->findTypeSystemType(m_defaultPackage));
- const bool add = moduleEntry.isNull();
+ std::const_pointer_cast<TypeSystemTypeEntry>(m_context->db->findTypeSystemType(m_defaultPackage));
+ const bool add = !moduleEntry;
if (add) {
moduleEntry.reset(new TypeSystemTypeEntry(m_defaultPackage, since,
currentParentTypeEntry()));
@@ -2097,7 +2100,7 @@ bool TypeSystemParser::loadTypesystem(const ConditionalStreamReader &,
bool TypeSystemParser::parseRejectEnumValue(const ConditionalStreamReader &,
QXmlStreamAttributes *attributes)
{
- if (m_currentEnum.isNull()) {
+ if (!m_currentEnum) {
m_error = u"<reject-enum-value> node must be used inside a <enum-type> node"_s;
return false;
}
@@ -2171,7 +2174,7 @@ bool TypeSystemParser::parseCustomConversion(const ConditionalStreamReader &,
ValueTypeEntryPtr valueTypeEntry;
if (top->entry->isValue()) {
- valueTypeEntry = qSharedPointerCast<ValueTypeEntry>(top->entry);
+ valueTypeEntry = std::static_pointer_cast<ValueTypeEntry>(top->entry);
if (valueTypeEntry->hasTargetConversionRule() || valueTypeEntry->hasCustomConversion()) {
m_error = u"Types can have only one conversion rule"_s;
return false;
@@ -2203,13 +2206,13 @@ bool TypeSystemParser::parseCustomConversion(const ConditionalStreamReader &,
return true;
}
- CustomConversionPtr customConversion(new CustomConversion(top->entry));
+ auto customConversion = std::make_shared<CustomConversion>(top->entry);
if (top->entry->isPrimitive())
- qSharedPointerCast<PrimitiveTypeEntry>(top->entry)->setCustomConversion(customConversion);
+ std::static_pointer_cast<PrimitiveTypeEntry>(top->entry)->setCustomConversion(customConversion);
else if (top->entry->isContainer())
- qSharedPointerCast<ContainerTypeEntry>(top->entry)->setCustomConversion(customConversion);
+ std::static_pointer_cast<ContainerTypeEntry>(top->entry)->setCustomConversion(customConversion);
else if (top->entry->isValue())
- qSharedPointerCast<ValueTypeEntry>(top->entry)->setCustomConversion(customConversion);
+ std::static_pointer_cast<ValueTypeEntry>(top->entry)->setCustomConversion(customConversion);
customConversionsForReview.append(customConversion);
return true;
}
@@ -2262,7 +2265,7 @@ bool TypeSystemParser::parseAddConversion(const ConditionalStreamReader &,
return false;
}
auto customConversion = CustomConversion::getCustomConversion(top->entry);
- if (customConversion.isNull()) {
+ if (!customConversion) {
m_error = msgMissingCustomConversion(top->entry);
return false;
}
@@ -2531,7 +2534,7 @@ bool TypeSystemParser::parseAddFunction(const ConditionalStreamReader &,
}
AddedFunctionPtr func = AddedFunction::createAddedFunction(signature, returnType, &errorString);
- if (func.isNull()) {
+ if (!func) {
m_error = errorString;
return false;
}
@@ -2604,7 +2607,7 @@ bool TypeSystemParser::parseAddPyMethodDef(const ConditionalStreamReader &,
m_error = u"add-pymethoddef requires at least a name and a function attribute"_s;
return false;
}
- qSharedPointerCast<ComplexTypeEntry>(m_contextStack.top()->entry)->addPyMethodDef(def);
+ std::static_pointer_cast<ComplexTypeEntry>(m_contextStack.top()->entry)->addPyMethodDef(def);
return true;
}
@@ -2638,7 +2641,7 @@ bool TypeSystemParser::parseProperty(const ConditionalStreamReader &, StackEleme
m_error = u"<property> element is missing required attibutes (name/type/get)."_s;
return false;
}
- qSharedPointerCast<ComplexTypeEntry>(m_contextStack.top()->entry)->addProperty(property);
+ std::static_pointer_cast<ComplexTypeEntry>(m_contextStack.top()->entry)->addProperty(property);
return true;
}
@@ -2719,7 +2722,7 @@ bool TypeSystemParser::parseModifyFunction(const ConditionalStreamReader &reader
// Child of global <function>
const auto &top = m_contextStack.top();
if (originalSignature.isEmpty() && top->entry->isFunction()) {
- auto f = qSharedPointerCast<const FunctionTypeEntry>(top->entry);
+ auto f = std::static_pointer_cast<const FunctionTypeEntry>(top->entry);
originalSignature = f->signatures().value(0);
}
@@ -2960,10 +2963,10 @@ bool TypeSystemParser::parseInjectCode(const ConditionalStreamReader &,
}
break;
case StackElement::Root:
- qSharedPointerCast<TypeSystemTypeEntry>(m_contextStack.top()->entry)->addCodeSnip(snip);
+ std::static_pointer_cast<TypeSystemTypeEntry>(m_contextStack.top()->entry)->addCodeSnip(snip);
break;
default:
- qSharedPointerCast<ComplexTypeEntry>(m_contextStack.top()->entry)->addCodeSnip(snip);
+ std::static_pointer_cast<ComplexTypeEntry>(m_contextStack.top()->entry)->addCodeSnip(snip);
break;
}
return true;
@@ -3071,7 +3074,7 @@ bool TypeSystemParser::checkDuplicatedTypeEntry(const ConditionalStreamReader &r
if (t == StackElement::PrimitiveTypeEntry || t == StackElement::FunctionTypeEntry)
return true;
const auto duplicated = m_context->db->findType(name);
- if (duplicated.isNull() || duplicated->isNamespace())
+ if (!duplicated || duplicated->isNamespace())
return true;
if (duplicated->isBuiltIn()) {
qCWarning(lcShiboken, "%s",
@@ -3148,7 +3151,7 @@ bool TypeSystemParser::startElement(const ConditionalStreamReader &reader, Stack
}
if (isTypeEntry(element) || element == StackElement::Root)
- m_contextStack.push(StackElementContextPtr(new StackElementContext()));
+ m_contextStack.push(std::make_shared<StackElementContext>());
if (m_contextStack.isEmpty()) {
m_error = msgNoRootTypeSystemEntry();
@@ -3203,7 +3206,7 @@ bool TypeSystemParser::startElement(const ConditionalStreamReader &reader, Stack
if (element != StackElement::PrimitiveTypeEntry
&& element != StackElement::FunctionTypeEntry) {
TypeEntryPtr tmp = m_context->db->findType(name);
- if (!tmp.isNull() && !tmp->isNamespace())
+ if (tmp && !tmp->isNamespace())
qCWarning(lcShiboken).noquote().nospace()
<< "Duplicate type entry: '" << name << '\'';
}
@@ -3269,7 +3272,7 @@ bool TypeSystemParser::startElement(const ConditionalStreamReader &reader, Stack
case StackElement::InterfaceTypeEntry: {
if (!checkRootElement())
return false;
- ComplexTypeEntryPtr ce(new ObjectTypeEntry(name, versionRange.since, currentParentTypeEntry()));
+ auto ce = std::make_shared<ObjectTypeEntry>(name, versionRange.since, currentParentTypeEntry());
top->entry = ce;
applyCommonAttributes(reader, top->entry, &attributes);
applyComplexTypeAttributes(reader, ce, &attributes);
@@ -3361,7 +3364,7 @@ bool TypeSystemParser::startElement(const ConditionalStreamReader &reader, Stack
|| convertBoolean(attributes.takeAt(replaceIndex).value(),
replaceAttribute(), true);
auto customConversion = CustomConversion::getCustomConversion(top->entry);
- if (customConversion.isNull()) {
+ if (!customConversion) {
m_error = msgMissingCustomConversion(top->entry);
return false;
}
@@ -3480,7 +3483,7 @@ bool TypeSystemParser::startElement(const ConditionalStreamReader &reader, Stack
break;
case StackElement::InsertTemplate:
m_templateInstance.reset(parseInsertTemplate(reader, topElement, &attributes));
- if (m_templateInstance.isNull())
+ if (!m_templateInstance)
return false;
break;
case StackElement::Replace:
diff --git a/sources/shiboken6/ApiExtractor/typesystemparser_p.h b/sources/shiboken6/ApiExtractor/typesystemparser_p.h
index 7d47c31e4..654e03921 100644
--- a/sources/shiboken6/ApiExtractor/typesystemparser_p.h
+++ b/sources/shiboken6/ApiExtractor/typesystemparser_p.h
@@ -12,7 +12,8 @@
#include <QtCore/QStack>
#include <QtCore/QHash>
#include <QtCore/QScopedPointer>
-#include <QtCore/QSharedPointer>
+
+#include <memory>
QT_FORWARD_DECLARE_CLASS(QVersionNumber)
QT_FORWARD_DECLARE_CLASS(QXmlStreamAttributes)
@@ -130,10 +131,10 @@ class TypeSystemParser
public:
Q_DISABLE_COPY(TypeSystemParser)
- using StackElementContextPtr = QSharedPointer<StackElementContext>;
+ using StackElementContextPtr = std::shared_ptr<StackElementContext>;
using ContextStack = QStack<StackElementContextPtr>;
- explicit TypeSystemParser(const QSharedPointer<TypeDatabaseParserContext> &context,
+ explicit TypeSystemParser(const std::shared_ptr<TypeDatabaseParserContext> &context,
bool generate);
~TypeSystemParser();
@@ -251,7 +252,7 @@ private:
ParserState parserState(qsizetype offset = 0) const;
CodeSnipAbstract *injectCodeTarget(qsizetype offset = 0) const;
- QSharedPointer<TypeDatabaseParserContext> m_context;
+ std::shared_ptr<TypeDatabaseParserContext> m_context;
QStack<StackElement> m_stack;
int m_currentDroppedEntryDepth = 0;
int m_ignoreDepth = 0;
diff --git a/sources/shiboken6/ApiExtractor/xmlutils.cpp b/sources/shiboken6/ApiExtractor/xmlutils.cpp
index b0c9c2084..ccacd4ce7 100644
--- a/sources/shiboken6/ApiExtractor/xmlutils.cpp
+++ b/sources/shiboken6/ApiExtractor/xmlutils.cpp
@@ -21,13 +21,13 @@ QString XQuery::evaluate(QString xPathExpression, QString *errorMessage)
return doEvaluate(xPathExpression, errorMessage);
}
-QSharedPointer<XQuery> XQuery::create(const QString &focus, QString *errorMessage)
+std::shared_ptr<XQuery> XQuery::create(const QString &focus, QString *errorMessage)
{
#if defined(HAVE_LIBXSLT)
return libXml_createXQuery(focus, errorMessage);
#else
*errorMessage = QLatin1StringView(__FUNCTION__) + u" is not implemented."_s;
- return QSharedPointer<XQuery>();
+ return std::shared_ptr<XQuery>();
#endif
}
diff --git a/sources/shiboken6/ApiExtractor/xmlutils.h b/sources/shiboken6/ApiExtractor/xmlutils.h
index 2d6adbe9e..aa2fedb2b 100644
--- a/sources/shiboken6/ApiExtractor/xmlutils.h
+++ b/sources/shiboken6/ApiExtractor/xmlutils.h
@@ -3,9 +3,10 @@
#ifndef XMLUTILS_H
#define XMLUTILS_H
-#include <QtCore/QSharedPointer>
#include <QtCore/QString>
+#include <memory>
+
class XQuery
{
public:
@@ -15,7 +16,7 @@ public:
QString evaluate(QString xPathExpression, QString *errorMessage);
- static QSharedPointer<XQuery> create(const QString &focus, QString *errorMessage);
+ static std::shared_ptr<XQuery> create(const QString &focus, QString *errorMessage);
protected:
XQuery();
diff --git a/sources/shiboken6/ApiExtractor/xmlutils_libxslt.cpp b/sources/shiboken6/ApiExtractor/xmlutils_libxslt.cpp
index 211966b18..c5f361c91 100644
--- a/sources/shiboken6/ApiExtractor/xmlutils_libxslt.cpp
+++ b/sources/shiboken6/ApiExtractor/xmlutils_libxslt.cpp
@@ -137,7 +137,7 @@ QString LibXmlXQuery::doEvaluate(const QString &xPathExpression, QString *errorM
return result;
}
-QSharedPointer<XQuery> libXml_createXQuery(const QString &focus, QString *errorMessage)
+std::shared_ptr<XQuery> libXml_createXQuery(const QString &focus, QString *errorMessage)
{
XmlDocUniquePtr doc(xmlParseFile(QFile::encodeName(focus).constData()));
if (!doc) {
@@ -149,7 +149,7 @@ QSharedPointer<XQuery> libXml_createXQuery(const QString &focus, QString *errorM
*errorMessage = u"libxml2: xmlXPathNewContext() failed"_s;
return {};
}
- return QSharedPointer<XQuery>(new LibXmlXQuery(doc, xpathContext));
+ return std::shared_ptr<XQuery>(new LibXmlXQuery(doc, xpathContext));
}
// XSLT transformation
diff --git a/sources/shiboken6/ApiExtractor/xmlutils_libxslt.h b/sources/shiboken6/ApiExtractor/xmlutils_libxslt.h
index 3430dce71..0dd8eafcb 100644
--- a/sources/shiboken6/ApiExtractor/xmlutils_libxslt.h
+++ b/sources/shiboken6/ApiExtractor/xmlutils_libxslt.h
@@ -4,11 +4,12 @@
#define XMLUTILS_LIBXSLT_H
#include <QtCore/QString>
-#include <QtCore/QSharedPointer>
+
+#include <memory>
class XQuery;
-QSharedPointer<XQuery> libXml_createXQuery(const QString &focus, QString *errorMessage);
+std::shared_ptr<XQuery> libXml_createXQuery(const QString &focus, QString *errorMessage);
QString libXslt_transform(const QString &xml, QString xsl, QString *errorMessage);
diff --git a/sources/shiboken6/ApiExtractor/xmlutils_qt.h b/sources/shiboken6/ApiExtractor/xmlutils_qt.h
index f0c51915f..274827044 100644
--- a/sources/shiboken6/ApiExtractor/xmlutils_qt.h
+++ b/sources/shiboken6/ApiExtractor/xmlutils_qt.h
@@ -4,11 +4,12 @@
#define XMLUTILS_QT_H
#include <QtCore/QString>
-#include <QtCore/QSharedPointer>
+
+#include <memory>
class XQuery;
-QSharedPointer<XQuery> qt_createXQuery(const QString &focus, QString *errorMessage);
+std::shared_ptr<XQuery> qt_createXQuery(const QString &focus, QString *errorMessage);
QString qt_xsl_transform(const QString &xml, QString xsl, QString *errorMessage);
diff --git a/sources/shiboken6/generator/generator.cpp b/sources/shiboken6/generator/generator.cpp
index 81d69fa09..ddf38d209 100644
--- a/sources/shiboken6/generator/generator.cpp
+++ b/sources/shiboken6/generator/generator.cpp
@@ -281,7 +281,7 @@ QString Generator::getFullTypeName(TypeEntryCPtr type)
{
QString result = type->qualifiedCppName();
if (type->isArray())
- type = qSharedPointerCast<const ArrayTypeEntry>(type)->nestedTypeEntry();
+ type = std::static_pointer_cast<const ArrayTypeEntry>(type)->nestedTypeEntry();
if (!isCppPrimitive(type))
result.prepend(u"::"_s);
return result;
@@ -366,7 +366,7 @@ std::optional<DefaultValue>
return minimalConstructor(api, type.typeEntry());
if (type.typeEntry()->isComplex()) {
- auto cType = qSharedPointerCast<const ComplexTypeEntry>(type.typeEntry());
+ auto cType = std::static_pointer_cast<const ComplexTypeEntry>(type.typeEntry());
if (cType->hasDefaultConstructor())
return DefaultValue(DefaultValue::Custom, cType->defaultConstructor());
auto klass = AbstractMetaClass::findClass(api.classes(), cType);
@@ -405,8 +405,8 @@ std::optional<DefaultValue>
}
if (type->isEnum()) {
- const auto enumEntry = qSharedPointerCast<const EnumTypeEntry>(type);
- if (const auto nullValue = enumEntry->nullValue(); !nullValue.isNull())
+ const auto enumEntry = std::static_pointer_cast<const EnumTypeEntry>(type);
+ if (const auto nullValue = enumEntry->nullValue())
return DefaultValue(DefaultValue::Enum, nullValue->name());
return DefaultValue(DefaultValue::Custom,
u"static_cast< ::"_s + type->qualifiedCppName()
@@ -419,7 +419,7 @@ std::optional<DefaultValue>
}
if (type->isPrimitive()) {
- QString ctor = qSharedPointerCast<const PrimitiveTypeEntry>(type)->defaultConstructor();
+ QString ctor = std::static_pointer_cast<const PrimitiveTypeEntry>(type)->defaultConstructor();
// If a non-C++ (i.e. defined by the user) primitive type does not have
// a default constructor defined by the user, the empty constructor is
// heuristically returned. If this is wrong the build of the generated
@@ -462,7 +462,7 @@ std::optional<DefaultValue>
if (!metaClass)
return {};
- auto cType = qSharedPointerCast<const ComplexTypeEntry>(metaClass->typeEntry());
+ auto cType = std::static_pointer_cast<const ComplexTypeEntry>(metaClass->typeEntry());
if (cType->hasDefaultConstructor())
return DefaultValue(DefaultValue::Custom, cType->defaultConstructor());
diff --git a/sources/shiboken6/generator/generator.h b/sources/shiboken6/generator/generator.h
index 03c44fc9b..9d87ada6b 100644
--- a/sources/shiboken6/generator/generator.h
+++ b/sources/shiboken6/generator/generator.h
@@ -6,11 +6,12 @@
#include <abstractmetalang_typedefs.h>
#include <typedatabase_typedefs.h>
-#include <QtCore/QSharedPointer>
#include <QtCore/QList>
+#include <memory>
#include <optional>
+
class ApiExtractorResult;
class GeneratorContext;
class DefaultValue;
@@ -219,7 +220,7 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(Generator::Options)
Q_DECLARE_OPERATORS_FOR_FLAGS(Generator::FileNameFlags)
-using GeneratorPtr = QSharedPointer<Generator>;
+using GeneratorPtr = std::shared_ptr<Generator>;
using Generators = QList<GeneratorPtr>;
#endif // GENERATOR_H
diff --git a/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp b/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp
index 6dba04b25..dcc6b4fa8 100644
--- a/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp
+++ b/sources/shiboken6/generator/qtdoc/qtdocgenerator.cpp
@@ -304,7 +304,7 @@ void QtDocGenerator::generateClass(TextStream &s, const GeneratorContext &classC
m_packages[metaClass->package()] << fileNameForContext(classContext);
m_docParser->setPackageName(metaClass->package());
- m_docParser->fillDocumentation(qSharedPointerConstCast<AbstractMetaClass>(metaClass));
+ m_docParser->fillDocumentation(std::const_pointer_cast<AbstractMetaClass>(metaClass));
QString className = metaClass->name();
s << ".. _" << className << ":" << "\n\n";
@@ -422,13 +422,13 @@ void QtDocGenerator::writeProperties(TextStream &s,
if (!prop.documentation.isEmpty())
writeFormattedText(s, prop.documentation.detailed(), Documentation::Native, cppClass);
s << "**Access functions:**\n";
- if (!prop.getter.isNull())
+ if (prop.getter)
s << " * " << functionTocEntry(prop.getter, cppClass) << '\n';
- if (!prop.setter.isNull())
+ if (prop.setter)
s << " * " << functionTocEntry(prop.setter, cppClass) << '\n';
- if (!prop.reset.isNull())
+ if (prop.reset)
s << " * " << functionTocEntry(prop.reset, cppClass) << '\n';
- if (!prop.notify.isNull())
+ if (prop.notify)
s << " * Signal " << functionTocEntry(prop.notify, cppClass) << '\n';
s << '\n';
}
@@ -1251,10 +1251,10 @@ QString QtDocGenerator::expandFunction(const QString &function) const
}
}
- return metaClass.isNull()
- ? function
- : metaClass->typeEntry()->qualifiedTargetLangName()
- + function.right(function.size() - firstDot);
+ return metaClass
+ ? metaClass->typeEntry()->qualifiedTargetLangName()
+ + function.right(function.size() - firstDot)
+ : function;
}
QString QtDocGenerator::expandClass(const QString &context,
@@ -1286,7 +1286,7 @@ QString QtDocGenerator::resolveContextForMethod(const QString &context,
}
}
- if (!metaClass.isNull()) {
+ if (metaClass) {
AbstractMetaFunctionCList funcList;
const auto &methods = metaClass->queryFunctionsByName(methodName);
for (const auto &func : methods) {
@@ -1301,7 +1301,7 @@ QString QtDocGenerator::resolveContextForMethod(const QString &context,
break;
}
- if (!implementingClass.isNull())
+ if (implementingClass)
return implementingClass->typeEntry()->qualifiedTargetLangName();
}
diff --git a/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp b/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp
index 222320d38..0995d4d27 100644
--- a/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp
+++ b/sources/shiboken6/generator/qtdoc/qtxmltosphinx.cpp
@@ -416,16 +416,16 @@ void QtXmlToSphinx::formatCurrentTable()
void QtXmlToSphinx::pushOutputBuffer()
{
- m_buffers.append(StringSharedPtr(new QString{}));
- m_output.setString(m_buffers.top().data());
+ m_buffers.append(std::make_shared<QString>());
+ m_output.setString(m_buffers.top().get());
}
QString QtXmlToSphinx::popOutputBuffer()
{
Q_ASSERT(!m_buffers.isEmpty());
- QString result(*m_buffers.top().data());
+ QString result(*m_buffers.top().get());
m_buffers.pop();
- m_output.setString(m_buffers.isEmpty() ? nullptr : m_buffers.top().data());
+ m_output.setString(m_buffers.isEmpty() ? nullptr : m_buffers.top().get());
return result;
}
diff --git a/sources/shiboken6/generator/qtdoc/qtxmltosphinx.h b/sources/shiboken6/generator/qtdoc/qtxmltosphinx.h
index e3efde412..c70de27b4 100644
--- a/sources/shiboken6/generator/qtdoc/qtxmltosphinx.h
+++ b/sources/shiboken6/generator/qtdoc/qtxmltosphinx.h
@@ -8,9 +8,10 @@
#include <QtCore/QList>
#include <QtCore/QScopedPointer>
-#include <QtCore/QSharedPointer>
#include <QtCore/QStack>
+#include <memory>
+
QT_BEGIN_NAMESPACE
class QDebug;
class QXmlStreamReader;
@@ -106,7 +107,7 @@ public:
static void stripPythonQualifiers(QString *s);
private:
- using StringSharedPtr = QSharedPointer<QString>;
+ using StringSharedPtr = std::shared_ptr<QString>;
QString transform(const QString& doc);
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
index fd07684a5..72b7bc760 100644
--- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
@@ -163,7 +163,7 @@ const ProtocolEntries &sequenceProtocols()
static QString opaqueContainerCreationFunc(const AbstractMetaType &type)
{
const auto containerTypeEntry =
- qSharedPointerCast<const ContainerTypeEntry>(type.typeEntry());
+ std::static_pointer_cast<const ContainerTypeEntry>(type.typeEntry());
const auto instantiationTypeEntry =
type.instantiations().constFirst().typeEntry();
QString result = u"create"_s;
@@ -262,12 +262,12 @@ CppGenerator::BoolCastFunctionOptional
{
const auto te = metaClass->typeEntry();
if (te->isSmartPointer()) {
- auto ste = qSharedPointerCast<const SmartPointerTypeEntry>(te);
+ auto ste = std::static_pointer_cast<const SmartPointerTypeEntry>(te);
auto valueCheckMethod = ste->valueCheckMethod();
if (!valueCheckMethod.isEmpty()) {
const auto func = metaClass->findFunction(valueCheckMethod);
- if (func.isNull())
+ if (!func)
throw Exception(msgMethodNotFound(metaClass, valueCheckMethod));
return BoolCastFunction{func, false};
}
@@ -275,7 +275,7 @@ CppGenerator::BoolCastFunctionOptional
auto nullCheckMethod = ste->nullCheckMethod();
if (!nullCheckMethod.isEmpty()) {
const auto func = metaClass->findFunction(nullCheckMethod);
- if (func.isNull())
+ if (!func)
throw Exception(msgMethodNotFound(metaClass, nullCheckMethod));
return BoolCastFunction{func, true};
}
@@ -285,7 +285,7 @@ CppGenerator::BoolCastFunctionOptional
if (useOperatorBoolAsNbNonZero()
? mode != TypeSystem::BoolCast::Disabled : mode == TypeSystem::BoolCast::Enabled) {
const auto func = metaClass->findOperatorBool();
- if (!func.isNull())
+ if (func)
return BoolCastFunction{func, false};
}
@@ -293,7 +293,7 @@ CppGenerator::BoolCastFunctionOptional
if (useIsNullAsNbNonZero()
? mode != TypeSystem::BoolCast::Disabled : mode == TypeSystem::BoolCast::Enabled) {
const auto func = metaClass->findQtIsNullMethod();
- if (!func.isNull())
+ if (func)
return BoolCastFunction{func, true};
}
return std::nullopt;
@@ -479,7 +479,7 @@ static bool generateRichComparison(const GeneratorContext &c)
{
const auto metaClass = c.metaClass();
if (c.forSmartPointer()) {
- auto te = qSharedPointerCast<const SmartPointerTypeEntry>(metaClass->typeEntry());
+ auto te = std::static_pointer_cast<const SmartPointerTypeEntry>(metaClass->typeEntry());
return te->smartPointerType() == TypeSystem::SmartPointerType::Shared;
}
@@ -653,7 +653,7 @@ void CppGenerator::generateClass(TextStream &s, const GeneratorContext &classCon
AbstractMetaClassCPtr context = metaClass->enclosingClass();
while (context) {
if (context->isNamespace() && !context->enclosingClass()
- && qSharedPointerCast<const NamespaceTypeEntry>(context->typeEntry())->generateUsing()) {
+ && std::static_pointer_cast<const NamespaceTypeEntry>(context->typeEntry())->generateUsing()) {
s << "\nusing namespace " << context->qualifiedCppName() << ";\n";
break;
}
@@ -673,7 +673,7 @@ void CppGenerator::generateClass(TextStream &s, const GeneratorContext &classCon
// python conversion rules
if (typeEntry->isValue()) {
- auto vte = qSharedPointerCast<const ValueTypeEntry>(typeEntry);
+ auto vte = std::static_pointer_cast<const ValueTypeEntry>(typeEntry);
if (vte->hasTargetConversionRule()) {
s << "// Python Conversion\n";
s << vte->targetConversionRule() << '\n';
@@ -938,7 +938,7 @@ void CppGenerator::generateSmartPointerClass(TextStream &s, const GeneratorConte
{
s.setLanguage(TextStream::Language::Cpp);
AbstractMetaClassCPtr metaClass = classContext.metaClass();
- const auto typeEntry = qSharedPointerCast<const SmartPointerTypeEntry>(metaClass->typeEntry());
+ const auto typeEntry = std::static_pointer_cast<const SmartPointerTypeEntry>(metaClass->typeEntry());
const bool hasPointeeClass = classContext.pointeeClass() != nullptr;
const auto smartPointerType = typeEntry->smartPointerType();
const bool isValueHandle = smartPointerType ==TypeSystem::SmartPointerType::ValueHandle;
@@ -1132,7 +1132,7 @@ QString CppGenerator::getVirtualFunctionReturnTypeName(const AbstractMetaFunctio
// SbkType would return null when the type is a container.
auto typeEntry = func->type().typeEntry();
if (typeEntry->isContainer()) {
- const auto cte = qSharedPointerCast<const ContainerTypeEntry>(typeEntry);
+ const auto cte = std::static_pointer_cast<const ContainerTypeEntry>(typeEntry);
switch (cte->containerKind()) {
case ContainerTypeEntry::ListContainer:
break;
@@ -1374,7 +1374,7 @@ void CppGenerator::writeVirtualMethodNative(TextStream &s,
const bool isAbstract = func->isAbstract();
if (isAbstract && func->isModifiedRemoved()) {
- qCWarning(lcShiboken, "%s", qPrintable(msgPureVirtualFunctionRemoved(func.data())));
+ qCWarning(lcShiboken, "%s", qPrintable(msgPureVirtualFunctionRemoved(func.get())));
s << returnStatement << '\n' << outdent << "}\n\n";
return;
}
@@ -1813,7 +1813,7 @@ void CppGenerator::writeEnumConverterFunctions(TextStream &s, const AbstractMeta
s << '\n';
// QFlags part.
- if (auto flags = enumType->flags(); !flags.isNull()) {
+ if (auto flags = enumType->flags()) {
const QString flagsCppTypeName = useSurrogateName
? cppTypeName : getFullTypeName(flags).trimmed();
writeFlagsConverterFunctions(s, flags, typeName, flagsCppTypeName, pyTypeCheck);
@@ -1936,7 +1936,7 @@ return result;)";
c << '*' << outPtr << " = *"
<< cpythonWrapperCPtr(typeEntry, pyInVariable) << ';';
} else {
- auto ste = qSharedPointerCast<const SmartPointerTypeEntry>(typeEntry);
+ auto ste = std::static_pointer_cast<const SmartPointerTypeEntry>(typeEntry);
const QString resetMethod = ste->resetMethod();
c << "auto *ptr = " << outPtr << ";\n";
c << "if (" << pyInVariable << " == Py_None)\n" << indent;
@@ -2027,7 +2027,7 @@ return result;)";
}
if (typeEntry->isValue()) {
- auto vte = qSharedPointerCast<const ValueTypeEntry>(typeEntry);
+ auto vte = std::static_pointer_cast<const ValueTypeEntry>(typeEntry);
writeCustomConverterFunctions(s, vte->customConversion());
}
}
@@ -2035,7 +2035,7 @@ return result;)";
void CppGenerator::writeCustomConverterFunctions(TextStream &s,
const CustomConversionPtr &customConversion) const
{
- if (customConversion.isNull())
+ if (!customConversion)
return;
const TargetToNativeConversions &toCppConversions = customConversion->targetToNativeConversions();
if (toCppConversions.isEmpty())
@@ -2160,7 +2160,7 @@ void CppGenerator::writeConverterRegister(TextStream &s, const AbstractMetaClass
}
if (typeEntry->isValue()) {
- auto vte = qSharedPointerCast<const ValueTypeEntry>(typeEntry);
+ auto vte = std::static_pointer_cast<const ValueTypeEntry>(typeEntry);
writeCustomConverterRegister(s, vte->customConversion(), u"converter"_s);
}
}
@@ -2169,7 +2169,7 @@ void CppGenerator::writeCustomConverterRegister(TextStream &s,
const CustomConversionPtr &customConversion,
const QString &converterVar)
{
- if (customConversion.isNull())
+ if (!customConversion)
return;
const TargetToNativeConversions &toCppConversions =
customConversion->targetToNativeConversions();
@@ -2210,7 +2210,7 @@ void CppGenerator::writeSmartPointerConverterFunctions(TextStream &s,
return;
auto smartPointerTypeEntry =
- qSharedPointerCast<const SmartPointerTypeEntry>(smartPointerType.typeEntry());
+ std::static_pointer_cast<const SmartPointerTypeEntry>(smartPointerType.typeEntry());
// TODO: Missing conversion to smart pointer pointer type:
@@ -2578,7 +2578,7 @@ void CppGenerator::writeArgumentsInitializer(TextStream &s, const OverloadData &
// Disable argument count checks for QObject constructors to allow for
// passing properties as KW args.
const auto owner = rfunc->ownerClass();
- bool isQObjectConstructor = !owner.isNull() && isQObject(owner)
+ bool isQObjectConstructor = owner && isQObject(owner)
&& rfunc->functionType() == AbstractMetaFunction::ConstructorFunction;
if (usesNamedArguments && !isQObjectConstructor) {
@@ -2861,7 +2861,7 @@ static void checkTypeViability(const AbstractMetaFunctionCPtr &func)
}
void CppGenerator::writeTypeCheck(TextStream &s,
- const QSharedPointer<OverloadDataNode> &overloadData,
+ const std::shared_ptr<OverloadDataNode> &overloadData,
const QString &argumentName)
{
QSet<TypeEntryCPtr> numericTypes;
@@ -3142,7 +3142,7 @@ void CppGenerator::writeOverloadedFunctionDecisor(TextStream &s, const OverloadD
s << "// " << i << ": ";
if (func->isStatic())
s << "static ";
- if (const auto decl = func->declaringClass(); !decl.isNull())
+ if (const auto decl = func->declaringClass())
s << decl->name() << "::";
s << func->signatureComment() << '\n';
}
@@ -3226,7 +3226,7 @@ void CppGenerator::writeOverloadedFunctionDecisorEngine(TextStream &s,
auto func = referenceFunction;
for (const auto &child : children) {
const auto defValFunc = child->getFunctionWithDefaultValue();
- if (!defValFunc.isNull()) {
+ if (defValFunc) {
func = defValFunc;
break;
}
@@ -3316,7 +3316,7 @@ void CppGenerator::writeOverloadedFunctionDecisorEngine(TextStream &s,
s << indent << typeChecks.join(u"\n&& "_s) << outdent;
}
s << ") {\n" << indent;
- writeOverloadedFunctionDecisorEngine(s, overloadData, child.data());
+ writeOverloadedFunctionDecisorEngine(s, overloadData, child.get());
s << outdent << '}';
}
s << '\n';
@@ -3349,7 +3349,7 @@ static void writeDeprecationWarning(TextStream &s,
CppGenerator::ErrorReturn errorReturn)
{
s << "Shiboken::Warnings::warnDeprecated(\"";
- if (const auto cls = context.metaClass(); !cls.isNull())
+ if (const auto cls = context.metaClass())
s << cls->name() << "\", ";
// Check error in case "warning-as-error" is set.
s << '"' << func->signature().replace(u"::"_s, u"."_s) << "\");\n"
@@ -3530,7 +3530,7 @@ QString CppGenerator::containerNativeToTargetTypeName(const ContainerTypeEntryCP
void CppGenerator::writeCppToPythonFunction(TextStream &s, const AbstractMetaType &containerType) const
{
Q_ASSERT(containerType.typeEntry()->isContainer());
- auto cte = qSharedPointerCast<const ContainerTypeEntry>(containerType.typeEntry());
+ auto cte = std::static_pointer_cast<const ContainerTypeEntry>(containerType.typeEntry());
if (!cte->hasCustomConversion()) {
QString m;
QTextStream(&m) << "Can't write the C++ to Python conversion function for container type '"
@@ -3670,7 +3670,7 @@ void CppGenerator::writePythonToCppConversionFunctions(TextStream &s,
void CppGenerator::writePythonToCppConversionFunctions(TextStream &s, const AbstractMetaType &containerType) const
{
Q_ASSERT(containerType.typeEntry()->isContainer());
- const auto cte = qSharedPointerCast<const ContainerTypeEntry>(containerType.typeEntry());
+ const auto cte = std::static_pointer_cast<const ContainerTypeEntry>(containerType.typeEntry());
const auto customConversion = cte->customConversion();
for (const auto &conv : customConversion->targetToNativeConversions())
writePythonToCppConversionFunction(s, containerType, conv);
@@ -3761,7 +3761,7 @@ static bool forceQObjectNamedArguments(const AbstractMetaFunctionCPtr &func)
if (func->functionType() != AbstractMetaFunction::ConstructorFunction)
return false;
const auto owner = func->ownerClass();
- Q_ASSERT(!owner.isNull());
+ Q_ASSERT(owner);
if (!isQObject(owner))
return false;
const QString &name = owner->name();
@@ -3875,7 +3875,7 @@ CppGenerator::argumentClassFromIndex(const ApiExtractorResult &api,
if (type.isVoid() || !te->isComplex())
throw Exception(msgInvalidArgumentModification(func, argIndex));
const auto result = AbstractMetaClass::findClass(api.classes(), te);
- if (result.isNull())
+ if (!result)
throw Exception(msgClassNotFound(te));
return result;
}
@@ -4284,7 +4284,7 @@ void CppGenerator::writeMethodCall(TextStream &s, const AbstractMetaFunctionCPtr
if (ownership == TypeSystem::TargetLangOwnership) {
s << "getOwnership(" << pyArgName << ");";
} else if (auto ac = argumentClassFromIndex(api(), func, argIndex);
- !ac.isNull() && ac->hasVirtualDestructor()) {
+ ac && ac->hasVirtualDestructor()) {
s << "releaseOwnership(" << pyArgName << ");";
} else {
s << "invalidate(" << pyArgName << ");";
@@ -4507,7 +4507,7 @@ void CppGenerator::writeEnumConverterInitialization(TextStream &s, const Abstrac
s << outdent << "}\n";
- if (auto flags = enumType->flags(); !flags.isNull())
+ if (auto flags = enumType->flags())
writeFlagsConverterInitialization(s, flags);
}
@@ -4519,7 +4519,7 @@ QString CppGenerator::writeContainerConverterInitialization(TextStream &s, const
s << converter << " = Shiboken::Conversions::createConverter(";
Q_ASSERT(type.typeEntry()->isContainer());
- const auto typeEntry = qSharedPointerCast<const ContainerTypeEntry>(type.typeEntry());
+ const auto typeEntry = std::static_pointer_cast<const ContainerTypeEntry>(type.typeEntry());
const QString targetTypeName = containerNativeToTargetTypeName(typeEntry);
if (targetTypeName == cPyObjectT()) {
@@ -4565,7 +4565,7 @@ void CppGenerator::writeSmartPointerConverterInitialization(TextStream &s, const
if (classes.isEmpty())
return;
- auto smartPointerTypeEntry = qSharedPointerCast<const SmartPointerTypeEntry>(type.typeEntry());
+ auto smartPointerTypeEntry = std::static_pointer_cast<const SmartPointerTypeEntry>(type.typeEntry());
s << "// Register SmartPointer converter for type '" << cppSignature << "'." << '\n'
<< "///////////////////////////////////////////////////////////////////////////////////////\n\n";
@@ -4775,7 +4775,7 @@ void CppGenerator::writeClassDefinition(TextStream &s,
// class or some ancestor has multiple inheritance
const auto miClass = getMultipleInheritingClass(metaClass);
- if (!miClass.isNull()) {
+ if (miClass) {
if (metaClass == miClass)
writeMultipleInheritanceInitializerFunction(s, metaClass);
writeSpecialCastFunction(s, metaClass);
@@ -4789,7 +4789,7 @@ void CppGenerator::writeClassDefinition(TextStream &s,
tp_hash = u'&' + cpythonBaseName(metaClass) + u"_HashFunc"_s;
const auto callOp = metaClass->findFunction(u"operator()");
- if (!callOp.isNull() && !callOp->isModifiedRemoved())
+ if (callOp && !callOp->isModifiedRemoved())
tp_call = u'&' + cpythonFunctionName(callOp);
const QString typePtr = u"_"_s + className
@@ -4844,7 +4844,7 @@ void CppGenerator::writeMappingMethods(TextStream &s,
{
for (const auto & m : mappingProtocols()) {
const auto func = metaClass->findFunction(m.name);
- if (func.isNull())
+ if (!func)
continue;
QString funcName = cpythonFunctionName(func);
CodeSnipList snips = func->injectedCodeSnips(TypeSystem::CodeSnipPositionAny, TypeSystem::TargetLangCode);
@@ -4868,7 +4868,7 @@ void CppGenerator::writeSequenceMethods(TextStream &s,
for (const auto &seq : sequenceProtocols()) {
const auto func = metaClass->findFunction(seq.name);
- if (func.isNull())
+ if (!func)
continue;
injectedCode = true;
QString funcName = cpythonFunctionName(func);
@@ -4910,7 +4910,7 @@ void CppGenerator::writeTypeAsSequenceDefinition(TextStream &s,
QMap<QString, QString> funcs;
for (const auto &seq : sequenceProtocols()) {
const auto func = metaClass->findFunction(seq.name);
- if (!func.isNull()) {
+ if (func) {
funcs.insert(seq.name, u'&' + cpythonFunctionName(func));
hasFunctions = true;
}
@@ -4947,7 +4947,7 @@ void CppGenerator::writeTypeAsMappingDefinition(TextStream &s,
QMap<QString, QString> funcs;
for (const auto &m : mappingProtocols()) {
const auto func = metaClass->findFunction(m.name);
- if (!func.isNull()) {
+ if (func) {
const QString entry = u"reinterpret_cast<void *>(&"_s
+ cpythonFunctionName(func) + u')';
funcs.insert(m.name, entry);
@@ -5413,7 +5413,7 @@ static ComparisonOperatorList smartPointeeComparisons(const GeneratorContext &co
}
const auto pointeeClass = context.pointeeClass();
- if (pointeeClass.isNull())
+ if (!pointeeClass)
return {};
ComparisonOperatorList result;
@@ -5445,7 +5445,7 @@ void CppGenerator::writeSmartPointerRichCompareFunction(TextStream &s,
const auto te = context.preciseType().typeEntry();
Q_ASSERT(te->isSmartPointer());
- const auto ste = qSharedPointerCast<const SmartPointerTypeEntry>(te);
+ const auto ste = std::static_pointer_cast<const SmartPointerTypeEntry>(te);
s << "const auto *" << selfPointeeVar << " = " << CPP_SELF_VAR
<< '.' << ste->getter() << "();\n";
@@ -5525,8 +5525,8 @@ QByteArrayList CppGenerator::methodDefinitionParameters(const OverloadData &over
// METH_STATIC causes a crash when used for global functions (also from
// invisible namespaces).
const auto ownerClass = overloadData.referenceFunction()->ownerClass();
- if (!ownerClass.isNull()
- && !invisibleTopNamespaces().contains(qSharedPointerConstCast<AbstractMetaClass>(ownerClass))) {
+ if (ownerClass
+ && !invisibleTopNamespaces().contains(std::const_pointer_cast<AbstractMetaClass>(ownerClass))) {
if (overloadData.hasStaticFunction())
result.append(QByteArrayLiteral("METH_STATIC"));
if (overloadData.hasClassMethod())
@@ -5673,11 +5673,11 @@ void CppGenerator::writeEnumInitialization(TextStream &s, const AbstractMetaEnum
ErrorReturn errorReturn) const
{
const auto enclosingClass = cppEnum.targetLangEnclosingClass();
- const bool hasUpperEnclosingClass = !enclosingClass.isNull()
- && !enclosingClass->targetLangEnclosingClass().isNull();
+ const bool hasUpperEnclosingClass = enclosingClass
+ && enclosingClass->targetLangEnclosingClass();
EnumTypeEntryCPtr enumTypeEntry = cppEnum.typeEntry();
QString enclosingObjectVariable;
- if (!enclosingClass.isNull())
+ if (enclosingClass)
enclosingObjectVariable = cpythonTypeName(enclosingClass);
else if (hasUpperEnclosingClass)
enclosingObjectVariable = u"enclosingClass"_s;
@@ -5692,7 +5692,7 @@ void CppGenerator::writeEnumInitialization(TextStream &s, const AbstractMetaEnum
if (!cppEnum.isAnonymous()) {
int packageLevel = packageName().count(u'.') + 1;
FlagsTypeEntryPtr flags = enumTypeEntry->flags();
- if (!flags.isNull()) {
+ if (flags) {
// The following could probably be made nicer:
// We need 'flags->flagsName()' with the full module/class path.
QString fullPath = getClassTargetFullName(cppEnum);
@@ -5830,7 +5830,7 @@ void CppGenerator::writeFlagsToLong(TextStream &s, const AbstractMetaEnum &cppEn
void CppGenerator::writeFlagsNonZero(TextStream &s, const AbstractMetaEnum &cppEnum)
{
FlagsTypeEntryPtr flagsEntry = cppEnum.typeEntry()->flags();
- if (flagsEntry.isNull())
+ if (!flagsEntry)
return;
s << "static int " << cpythonEnumName(cppEnum) << "__nonzero(PyObject *self)\n";
s << "{\n" << indent << "int val;\n";
@@ -5885,7 +5885,7 @@ void CppGenerator::writeFlagsBinaryOperator(TextStream &s, const AbstractMetaEnu
const QString &pyOpName, const QString &cppOpName)
{
FlagsTypeEntryPtr flagsEntry = cppEnum.typeEntry()->flags();
- Q_ASSERT(!flagsEntry.isNull());
+ Q_ASSERT(flagsEntry);
s << "PyObject *" << cpythonEnumName(cppEnum) << "___" << pyOpName
<< "__(PyObject *self, PyObject *" << PYTHON_ARG << ")\n{\n" << indent;
@@ -6124,7 +6124,7 @@ void CppGenerator::writeClassRegister(TextStream &s,
// Fill multiple inheritance data, if needed.
const auto miClass = getMultipleInheritingClass(metaClass);
- if (!miClass.isNull()) {
+ if (miClass) {
s << "MultipleInheritanceInitFunction func = ";
if (miClass == metaClass) {
s << multipleInheritanceInitializerFunctionName(miClass) << ";\n";
@@ -6235,7 +6235,7 @@ QtRegisterMetaType qtMetaTypeRegistration(const AbstractMetaClassCPtr &c)
// Is there a "base" specification in some base class, meaning only the
// base class is to be registered?
- if (auto base = recurseClassHierarchy(c, hasQtMetaTypeRegistrationSpec); !base.isNull()) {
+ if (auto base = recurseClassHierarchy(c, hasQtMetaTypeRegistrationSpec)) {
const auto baseSpec = base->typeEntry()->qtMetaTypeRegistration();
if (baseSpec == TypeSystem::QtMetaTypeRegistration::BaseEnabled)
return QtRegisterMetaType::None;
@@ -6409,7 +6409,7 @@ static QString smartPointerGetter(const GeneratorContext &context)
{
const auto te = context.metaClass()->typeEntry();
Q_ASSERT(te->isSmartPointer());
- return qSharedPointerCast<const SmartPointerTypeEntry>(te)->getter();
+ return std::static_pointer_cast<const SmartPointerTypeEntry>(te)->getter();
}
void CppGenerator::writeSmartPointerSetattroFunction(TextStream &s,
@@ -6624,7 +6624,7 @@ bool CppGenerator::finishGeneration()
for (auto it = functionGroups.cbegin(), end = functionGroups.cend(); it != end; ++it) {
const AbstractMetaFunctionCList &overloads = it.value();
for (const auto &func : overloads) {
- if (auto te = func->typeEntry(); !te.isNull())
+ if (auto te = func->typeEntry())
includes.insert(te->include());
}
@@ -6659,9 +6659,9 @@ bool CppGenerator::finishGeneration()
for (const auto &smp : api().instantiatedSmartPointers()) {
GeneratorContext context = contextForSmartPointer(smp.specialized, smp.type);
const auto enclosingClass = context.metaClass()->enclosingClass();
- auto enclosingTypeEntry = enclosingClass.isNull()
- ? targetLangEnclosingEntry(smp.type.typeEntry())
- : enclosingClass->typeEntry();
+ auto enclosingTypeEntry = enclosingClass
+ ? enclosingClass->typeEntry()
+ : targetLangEnclosingEntry(smp.type.typeEntry());
writeInitFunc(s_classInitDecl, s_classPythonDefines,
getInitFunctionName(context),
@@ -6685,7 +6685,7 @@ bool CppGenerator::finishGeneration()
const QList<CustomConversionPtr> &typeConversions = getPrimitiveCustomConversions();
for (const auto &c : typeConversions) {
- if (auto te = c->ownerType(); !te.isNull())
+ if (auto te = c->ownerType())
includes.insert(te->include());
}
@@ -6733,7 +6733,7 @@ bool CppGenerator::finishGeneration()
TypeDatabase *typeDb = TypeDatabase::instance();
TypeSystemTypeEntryCPtr moduleEntry = typeDb->defaultTypeSystemType();
- Q_ASSERT(!moduleEntry.isNull());
+ Q_ASSERT(moduleEntry);
s << '\n';
// Extra includes
@@ -7050,16 +7050,16 @@ static bool useParentHeuristics(const ApiExtractorResult &api,
if (!ComplexTypeEntry::isParentManagementEnabled()) // FIXME PYSIDE 7: Remove this
return true;
const auto owner = func->ownerClass();
- if (owner.isNull())
+ if (!owner)
return false;
auto ownerEntry = parentManagementEntry(owner);
- if (ownerEntry.isNull())
+ if (!ownerEntry)
return false;
auto argTypeEntry = argType.typeEntry();
if (!argTypeEntry->isComplex())
return false;
const auto argClass = AbstractMetaClass::findClass(api.classes(), argTypeEntry);
- return !argClass.isNull() && parentManagementEntry(argClass) == ownerEntry;
+ return argClass && parentManagementEntry(argClass) == ownerEntry;
}
bool CppGenerator::writeParentChildManagement(TextStream &s, const AbstractMetaFunctionCPtr &func,
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.h b/sources/shiboken6/generator/shiboken/cppgenerator.h
index 04a92271e..0277c3a8f 100644
--- a/sources/shiboken6/generator/shiboken/cppgenerator.h
+++ b/sources/shiboken6/generator/shiboken/cppgenerator.h
@@ -11,7 +11,8 @@
#include <QtCore/QFlags>
#include <QtCore/QHash>
-#include <QtCore/QSharedPointer>
+
+#include <memory>
class OverloadDataNode;
class OverloadDataRootNode;
@@ -176,7 +177,7 @@ private:
bool isNumber = false, bool rejectNull = false);
static void writeTypeCheck(TextStream &s, const QString &customType,
const QString &argumentName);
- static void writeTypeCheck(TextStream& s, const QSharedPointer<OverloadDataNode> &overloadData,
+ static void writeTypeCheck(TextStream& s, const std::shared_ptr<OverloadDataNode> &overloadData,
const QString &argumentName);
static void writeTypeDiscoveryFunction(TextStream &s,
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator_container.cpp b/sources/shiboken6/generator/shiboken/cppgenerator_container.cpp
index 38cb5b3c1..5955e8a66 100644
--- a/sources/shiboken6/generator/shiboken/cppgenerator_container.cpp
+++ b/sources/shiboken6/generator/shiboken/cppgenerator_container.cpp
@@ -87,7 +87,7 @@ CppGenerator::OpaqueContainerData
{
OpaqueContainerData result;
const auto &valueType = containerType.instantiations().constFirst();
- const auto containerTypeEntry = qSharedPointerCast<const ContainerTypeEntry>(containerType.typeEntry());
+ const auto containerTypeEntry = std::static_pointer_cast<const ContainerTypeEntry>(containerType.typeEntry());
result.name = containerTypeEntry->opaqueContainerName(valueType.typeEntry()->name());
const auto cppSignature = containerType.cppSignature();
diff --git a/sources/shiboken6/generator/shiboken/headergenerator.cpp b/sources/shiboken6/generator/shiboken/headergenerator.cpp
index 625ab0be7..d1a36c700 100644
--- a/sources/shiboken6/generator/shiboken/headergenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/headergenerator.cpp
@@ -277,10 +277,10 @@ void HeaderGenerator::writeMemberFunctionWrapper(TextStream &s,
const auto &type = arg.type();
TypeEntryCPtr enumTypeEntry;
if (type.isFlags())
- enumTypeEntry = qSharedPointerCast<const FlagsTypeEntry>(type.typeEntry())->originator();
+ enumTypeEntry = std::static_pointer_cast<const FlagsTypeEntry>(type.typeEntry())->originator();
else if (type.isEnum())
enumTypeEntry = type.typeEntry();
- if (!enumTypeEntry.isNull()) {
+ if (enumTypeEntry) {
s << type.cppSignature() << '(' << arg.name() << ')';
} else if (type.passByValue() && type.isUniquePointer()) {
s << stdMove(arg.name());
@@ -381,7 +381,7 @@ void HeaderGenerator::writeTypeIndexValueLine(TextStream &s, const ApiExtractorR
// For a typedef "using Foo=QList<int>", write a type index
// SBK_QLIST_INT besides SBK_FOO which is then matched by function
// argument. Check against duplicate typedefs for the same types.
- const auto cType = qSharedPointerCast<const ComplexTypeEntry>(typeEntry);
+ const auto cType = std::static_pointer_cast<const ComplexTypeEntry>(typeEntry);
if (cType->baseContainerType()) {
auto metaClass = AbstractMetaClass::findClass(api.classes(), cType);
Q_ASSERT(metaClass != nullptr);
@@ -397,7 +397,7 @@ void HeaderGenerator::writeTypeIndexValueLine(TextStream &s, const ApiExtractorR
}
}
if (typeEntry->isEnum()) {
- auto ete = qSharedPointerCast<const EnumTypeEntry>(typeEntry);
+ auto ete = std::static_pointer_cast<const EnumTypeEntry>(typeEntry);
if (ete->flags())
writeTypeIndexValueLine(s, api, ete->flags());
}
@@ -453,7 +453,7 @@ static bool canForwardDeclare(const AbstractMetaClassCPtr &c)
|| !c->innerClasses().isEmpty() || c->isTypeDef()) {
return false;
}
- if (auto encl = c->enclosingClass(); !encl.isNull())
+ if (auto encl = c->enclosingClass())
return encl->isNamespace();
return true;
}
@@ -521,14 +521,14 @@ static void writeForwardDeclarations(TextStream &s,
NameSpaces nameSpaces;
for (const auto &c : classList) {
- if (auto encl = c->enclosingClass(); !encl.isNull()) {
+ if (auto encl = c->enclosingClass()) {
Q_ASSERT(encl->isNamespace());
auto idx = indexOf(nameSpaces, encl);
if (idx != -1) {
nameSpaces[idx].classes.append(c);
} else {
nameSpaces.append(NameSpace{encl, {c}});
- for (auto enclNsp = encl->enclosingClass(); !enclNsp.isNull();
+ for (auto enclNsp = encl->enclosingClass(); enclNsp;
enclNsp = enclNsp->enclosingClass()) {
idx = indexOf(nameSpaces, enclNsp);
if (idx == -1)
@@ -835,7 +835,7 @@ void HeaderGenerator::writeSbkTypeFunction(TextStream &s, const AbstractMetaEnum
s << "{ return " << cpythonTypeNameExt(cppEnum.typeEntry()) << "; }\n";
const auto flag = cppEnum.typeEntry()->flags();
- if (!flag.isNull()) {
+ if (flag) {
s << "template<> inline PyTypeObject *SbkType< ::" << flag->name() << " >() "
<< "{ return " << cpythonTypeNameExt(flag) << "; }\n";
}
diff --git a/sources/shiboken6/generator/shiboken/overloaddata.cpp b/sources/shiboken6/generator/shiboken/overloaddata.cpp
index 72bcc6562..948c9c944 100644
--- a/sources/shiboken6/generator/shiboken/overloaddata.cpp
+++ b/sources/shiboken6/generator/shiboken/overloaddata.cpp
@@ -475,13 +475,13 @@ OverloadDataNode *OverloadDataRootNode::addOverloadDataNode(const AbstractMetaFu
}
}
- if (overloadData.isNull()) {
+ if (!overloadData) {
const int argpos = argPos() + 1;
overloadData.reset(new OverloadDataNode(func, this, arg, argpos));
m_children.append(overloadData);
}
- return overloadData.data();
+ return overloadData.get();
}
bool OverloadData::hasNonVoidReturnType() const
@@ -604,7 +604,7 @@ const AbstractMetaArgument *OverloadDataNode::overloadArgument(const AbstractMet
bool OverloadDataRootNode::nextArgumentHasDefaultValue() const
{
for (const auto &overloadData : m_children) {
- if (!overloadData->getFunctionWithDefaultValue().isNull())
+ if (overloadData->getFunctionWithDefaultValue())
return true;
}
return false;
@@ -612,13 +612,13 @@ bool OverloadDataRootNode::nextArgumentHasDefaultValue() const
static const OverloadDataRootNode *_findNextArgWithDefault(const OverloadDataRootNode *overloadData)
{
- if (!overloadData->getFunctionWithDefaultValue().isNull())
+ if (overloadData->getFunctionWithDefaultValue())
return overloadData;
const OverloadDataRootNode *result = nullptr;
const OverloadDataList &data = overloadData->children();
for (const auto &odata : data) {
- const auto *tmp = _findNextArgWithDefault(odata.data());
+ const auto *tmp = _findNextArgWithDefault(odata.get());
if (!result || (tmp && result->argPos() > tmp->argPos()))
result = tmp;
}
diff --git a/sources/shiboken6/generator/shiboken/overloaddata.h b/sources/shiboken6/generator/shiboken/overloaddata.h
index 3fc9eef50..128f7ccb3 100644
--- a/sources/shiboken6/generator/shiboken/overloaddata.h
+++ b/sources/shiboken6/generator/shiboken/overloaddata.h
@@ -9,13 +9,14 @@
#include <QtCore/QBitArray>
#include <QtCore/QList>
-#include <QtCore/QSharedPointer>
+
+#include <memory>
QT_FORWARD_DECLARE_CLASS(QDebug)
QT_FORWARD_DECLARE_CLASS(QTextStream)
class OverloadDataNode;
-using OverloadDataNodePtr = QSharedPointer<OverloadDataNode>;
+using OverloadDataNodePtr = std::shared_ptr<OverloadDataNode>;
using OverloadDataList = QList<OverloadDataNodePtr>;
/// The root node of OverloadData. It contains all functions
diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
index 7c40b4ed1..55851e650 100644
--- a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
@@ -258,9 +258,9 @@ AbstractMetaFunctionCList ShibokenGenerator::implicitConversions(const TypeEntry
{
if (!generateImplicitConversions() || !t->isValue())
return {};
- auto vte = qSharedPointerCast<const ValueTypeEntry>(t);
+ auto vte = std::static_pointer_cast<const ValueTypeEntry>(t);
auto customConversion = vte->customConversion();
- if (!customConversion.isNull() && customConversion->replaceOriginalTargetToNativeConversions())
+ if (customConversion && customConversion->replaceOriginalTargetToNativeConversions())
return {};
auto result = api().implicitConversions(t);
@@ -285,7 +285,7 @@ QString ShibokenGenerator::fullPythonClassName(const AbstractMetaClassCPtr &meta
{
QString fullClassName = metaClass->name();
auto enclosing = metaClass->enclosingClass();
- while (!enclosing.isNull()) {
+ while (enclosing) {
if (NamespaceTypeEntry::isVisibleScope(enclosing->typeEntry()))
fullClassName.prepend(enclosing->name() + u'.');
enclosing = enclosing->enclosingClass();
@@ -474,7 +474,7 @@ QString ShibokenGenerator::cpythonFlagsName(const FlagsTypeEntryCPtr &flagsEntry
QString ShibokenGenerator::cpythonFlagsName(const AbstractMetaEnum *metaEnum)
{
const auto flags = metaEnum->typeEntry()->flags();
- return flags.isNull() ? QString{} : cpythonFlagsName(flags);
+ return flags ? cpythonFlagsName(flags) : QString{};
}
QString ShibokenGenerator::cpythonSpecialCastFunctionName(const AbstractMetaClassCPtr &metaClass)
@@ -593,11 +593,11 @@ QString ShibokenGenerator::cpythonBaseName(const TypeEntryCPtr &type)
baseName = ptype->hasTargetLangApiType()
? ptype->targetLangApiName() : pythonPrimitiveTypeName(ptype->name());
} else if (type->isEnum()) {
- baseName = cpythonEnumName(qSharedPointerCast<const EnumTypeEntry>(type));
+ baseName = cpythonEnumName(std::static_pointer_cast<const EnumTypeEntry>(type));
} else if (type->isFlags()) {
- baseName = cpythonFlagsName(qSharedPointerCast<const FlagsTypeEntry>(type));
+ baseName = cpythonFlagsName(std::static_pointer_cast<const FlagsTypeEntry>(type));
} else if (type->isContainer()) {
- const auto ctype = qSharedPointerCast<const ContainerTypeEntry>(type);
+ const auto ctype = std::static_pointer_cast<const ContainerTypeEntry>(type);
baseName = containerCpythonBaseName(ctype);
} else {
baseName = cPyObjectT();
@@ -664,8 +664,8 @@ QString ShibokenGenerator::converterObject(const TypeEntryCPtr &type)
}
/* the typedef'd primitive types case */
- auto pte = qSharedPointerDynamicCast<const PrimitiveTypeEntry>(type);
- if (pte.isNull()) {
+ auto pte = std::dynamic_pointer_cast<const PrimitiveTypeEntry>(type);
+ if (!pte) {
qDebug() << "Warning: the Qt5 primitive type is unknown" << type->qualifiedCppName();
return QString();
}
@@ -734,7 +734,7 @@ QString ShibokenGenerator::pythonOperatorFunctionName(const AbstractMetaFunction
{
QString op = Generator::pythonOperatorFunctionName(func->originalName());
if (op.isEmpty()) {
- qCWarning(lcShiboken).noquote().nospace() << msgUnknownOperator(func.data());
+ qCWarning(lcShiboken).noquote().nospace() << msgUnknownOperator(func.get());
return unknownOperator();
}
if (func->arguments().isEmpty()) {
@@ -764,7 +764,7 @@ static std::optional<TypeSystem::CPythonType>
const auto cte = t->targetLangApiType();
if (cte->type() != TypeEntry::PythonType)
return {};
- return qSharedPointerCast<const PythonTypeEntry>(cte)->cPythonType();
+ return std::static_pointer_cast<const PythonTypeEntry>(cte)->cPythonType();
}
bool ShibokenGenerator::isNumber(const TypeEntryCPtr &type)
@@ -820,7 +820,7 @@ QString ShibokenGenerator::cpythonCheckFunction(AbstractMetaType metaType)
{
const auto typeEntry = metaType.typeEntry();
if (typeEntry->isCustom()) {
- const auto cte = qSharedPointerCast<const CustomTypeEntry>(typeEntry);
+ const auto cte = std::static_pointer_cast<const CustomTypeEntry>(typeEntry);
if (cte->hasCheckFunction())
return cte->checkFunction();
throw Exception(msgUnknownCheckFunction(typeEntry));
@@ -837,7 +837,7 @@ QString ShibokenGenerator::cpythonCheckFunction(AbstractMetaType metaType)
if (typeEntry->isContainer()) {
QString typeCheck = u"Shiboken::Conversions::"_s;
ContainerTypeEntry::ContainerKind type =
- qSharedPointerCast<const ContainerTypeEntry>(typeEntry)->containerKind();
+ std::static_pointer_cast<const ContainerTypeEntry>(typeEntry)->containerKind();
if (type == ContainerTypeEntry::ListContainer
|| type == ContainerTypeEntry::SetContainer) {
const QString containerType = type == ContainerTypeEntry::SetContainer
@@ -888,7 +888,7 @@ QString ShibokenGenerator::cpythonCheckFunction(AbstractMetaType metaType)
QString ShibokenGenerator::cpythonCheckFunction(TypeEntryCPtr type)
{
if (type->isCustom()) {
- const auto cte = qSharedPointerCast<const CustomTypeEntry>(type);
+ const auto cte = std::static_pointer_cast<const CustomTypeEntry>(type);
if (cte->hasCheckFunction())
return cte->checkFunction();
throw Exception(msgUnknownCheckFunction(type));
@@ -917,7 +917,7 @@ QString ShibokenGenerator::cpythonIsConvertibleFunction(const TypeEntryCPtr &typ
QString result = u"Shiboken::Conversions::"_s;
bool isValue = false;
if (type->isValue()) {
- const auto cte = qSharedPointerCast<const ComplexTypeEntry>(type);
+ const auto cte = std::static_pointer_cast<const ComplexTypeEntry>(type);
isValue = !cte->isValueTypeWithCopyConstructorOnly();
}
result += isValue ? u"isPythonToCppValueConvertible"_s
@@ -933,7 +933,7 @@ QString ShibokenGenerator::cpythonIsConvertibleFunction(AbstractMetaType metaTyp
{
const auto typeEntry = metaType.typeEntry();
if (typeEntry->isCustom()) {
- const auto cte = qSharedPointerCast<const CustomTypeEntry>(typeEntry);
+ const auto cte = std::static_pointer_cast<const CustomTypeEntry>(typeEntry);
if (cte->hasCheckFunction())
return cte->checkFunction();
throw Exception(msgUnknownCheckFunction(typeEntry));
@@ -1408,7 +1408,7 @@ void ShibokenGenerator::writeCodeSnips(TextStream &s,
const QRegularExpressionMatch match = pyArgsRegexCheck.match(code);
if (match.hasMatch()) {
qCWarning(lcShiboken).noquote().nospace()
- << msgWrongIndex("%PYARG", match.captured(1), func.data());
+ << msgWrongIndex("%PYARG", match.captured(1), func.get());
return;
}
code.replace(u"%PYARG_1"_s, PYTHON_ARG);
@@ -1439,7 +1439,7 @@ void ShibokenGenerator::writeCodeSnips(TextStream &s,
while (rit.hasNext()) {
QRegularExpressionMatch match = rit.next();
qCWarning(lcShiboken).noquote().nospace()
- << msgWrongIndex("%ARG#_TYPE", match.captured(1), func.data());
+ << msgWrongIndex("%ARG#_TYPE", match.captured(1), func.get());
}
// Replace template variable for return variable name.
@@ -1900,7 +1900,7 @@ IncludeGroupList ShibokenGenerator::classIncludes(const AbstractMetaClassCPtr &m
for (auto &f : implicitConvs) {
if (f->isConversionOperator()) {
const auto source = f->ownerClass();
- Q_ASSERT(!source.isNull());
+ Q_ASSERT(source);
result.back().append(source->typeEntry()->include());
}
}
@@ -1988,7 +1988,7 @@ static void removeConstOverloads(AbstractMetaFunctionCList *overloads)
const auto &f = overloads->at(i);
if (f->isConstant()) {
for (qsizetype c = 0, size = overloads->size(); c < size; ++c) {
- if (f->isConstOverloadOf(overloads->at(c).data())) {
+ if (f->isConstOverloadOf(overloads->at(c).get())) {
overloads->removeAt(i);
break;
}
@@ -2240,7 +2240,7 @@ QString
ShibokenGenerator::getTypeAlternateTemplateIndexVariableName(const AbstractMetaClassCPtr &metaClass)
{
const auto templateBaseClass = metaClass->templateBaseClass();
- Q_ASSERT(!templateBaseClass.isNull());
+ Q_ASSERT(templateBaseClass);
QString result = u"SBK_"_s
+ _fixedCppTypeName(templateBaseClass->typeEntry()->qualifiedCppName()).toUpper();
for (const auto &instantiation : metaClass->templateBaseClassInstantiations())
@@ -2334,7 +2334,7 @@ void ShibokenGenerator::replaceTemplateVariables(QString &code,
const AbstractMetaFunctionCPtr &func) const
{
const auto cpp_class = func->ownerClass();
- if (!cpp_class.isNull())
+ if (cpp_class)
code.replace(u"%TYPE"_s, cpp_class->name());
const AbstractMetaArgumentList &argument = func->arguments();
diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py
index 947537a0f..22ac1f144 100644
--- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py
+++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/enum_sig.py
@@ -106,7 +106,7 @@ class ExactEnumerator(object):
return ret
if "<" in class_name:
# This is happening in QtQuick for some reason:
- ## class QSharedPointer<QQuickItemGrabResult >:
+ ## class std::shared_ptr<QQuickItemGrabResult >:
# We simply skip over this class.
return ret
bases_list = []
diff --git a/sources/shiboken6/tests/dumpcodemodel/main.cpp b/sources/shiboken6/tests/dumpcodemodel/main.cpp
index 1befca260..f69d67e46 100644
--- a/sources/shiboken6/tests/dumpcodemodel/main.cpp
+++ b/sources/shiboken6/tests/dumpcodemodel/main.cpp
@@ -38,7 +38,7 @@ static void formatDebugOutput(const FileModelItem &dom, bool verbose)
QDebug debug(&output);
if (verbose)
debug.setVerbosity(3);
- debug << dom.data();
+ debug << dom.get();
}
std::cout << qPrintable(output) << '\n';
}
@@ -245,7 +245,7 @@ int main(int argc, char **argv)
optJoinNamespaces = parser.isSet(joinNamespacesOption);
const FileModelItem dom = AbstractMetaBuilderPrivate::buildDom(arguments, true, level, 0);
- if (dom.isNull()) {
+ if (!dom) {
QString message = u"Unable to parse "_s + positionalArguments.join(u' ');
std::cerr << qPrintable(message) << '\n';
return -2;
diff --git a/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.cpp b/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.cpp
index e30033ae7..298a7a819 100644
--- a/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.cpp
+++ b/sources/shiboken6/tests/qtxmltosphinxtest/qtxmltosphinxtest.cpp
@@ -344,7 +344,7 @@ void QtXmlToSphinxTest::testTable()
QCOMPARE(actual, expected);
}
-using TablePtr = QSharedPointer<QtXmlToSphinx::Table>;
+using TablePtr = std::shared_ptr<QtXmlToSphinx::Table>;
Q_DECLARE_METATYPE(TablePtr);