diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-07-21 15:05:08 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-07-21 15:58:36 +0200 |
commit | 795e5b7c7521d275750590be728ed1078150f537 (patch) | |
tree | 1c21e383424909bf146f266432bac381eda1cb8e /sources/shiboken6 | |
parent | f7db16f3e9e7a567a3f8993507b701b20addb627 (diff) |
shiboken6: Skip base functions for which no bindings should be generated
Factor out a function for checking the bindings generation
and use that in getInheritedOverloads() as well.
Amends b1b2cc2ebed2fcf6e31c1fbbdd3638216e34717b, which caused
some modified-removed functions to be generated in derived
classes.
Pick-to: 6.1
Change-Id: Iddb2f868c360da5397279cc3058cb554f5e51b42
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken6')
4 files changed, 22 insertions, 8 deletions
diff --git a/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp b/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp index ffc31ca22..2199d7fe2 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp +++ b/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp @@ -419,6 +419,22 @@ bool AbstractMetaFunction::usesRValueReferences() const return false; } +bool AbstractMetaFunction::generateBinding() const +{ + switch (d->m_functionType) { + case ConversionOperator: + case AssignmentOperatorFunction: + case MoveAssignmentOperatorFunction: + return false; + default: + break; + } + if (isPrivate() && d->m_functionType != EmptyFunction) + return false; + return d->m_name != u"qt_metacall" && !usesRValueReferences() + && !isModifiedRemoved(); +} + QStringList AbstractMetaFunction::introspectionCompatibleSignatures(const QStringList &resolvedArguments) const { AbstractMetaArgumentList arguments = this->arguments(); diff --git a/sources/shiboken6/ApiExtractor/abstractmetafunction.h b/sources/shiboken6/ApiExtractor/abstractmetafunction.h index 7917e7559..20e2e6d90 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetafunction.h +++ b/sources/shiboken6/ApiExtractor/abstractmetafunction.h @@ -280,6 +280,8 @@ public: void setFunctionType(FunctionType type); bool usesRValueReferences() const; + bool generateBinding() const; + QStringList introspectionCompatibleSignatures(const QStringList &resolvedArguments = QStringList()) const; QString signature() const; diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.cpp b/sources/shiboken6/generator/shiboken/cppgenerator.cpp index ac866dd28..51c6d051d 100644 --- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp +++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp @@ -538,13 +538,8 @@ void CppGenerator::generateClass(TextStream &s, const GeneratorContext &classCon QSet<QString> seenSignatures; bool staticEncountered = false; for (const auto &func : it.value()) { - if (!func->isAssignmentOperator() - && !func->usesRValueReferences() - && !func->isConversionOperator() - && !func->isModifiedRemoved() - && (!func->isPrivate() || func->functionType() == AbstractMetaFunction::EmptyFunction) - && func->ownerClass() == func->implementingClass() - && (func->name() != QLatin1String("qt_metacall"))) { + if (func->ownerClass() == func->implementingClass() + && func->generateBinding()) { // PYSIDE-331: Inheritance works correctly when there are disjoint functions. // But when a function is both in a class and inherited in a subclass, // then we need to search through all subclasses and collect the new signatures. diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp index 743681ffa..d52f4fb50 100644 --- a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp +++ b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp @@ -2309,7 +2309,8 @@ AbstractMetaFunctionCList for (; basis; basis = basis->baseClass()) { const auto inFunctions = basis->findFunctions(func->name()); for (const auto &inFunc : inFunctions) { - if (!seen->contains(inFunc->minimalSignature())) { + if (inFunc->generateBinding() + && !seen->contains(inFunc->minimalSignature())) { seen->insert(inFunc->minimalSignature()); AbstractMetaFunction *newFunc = inFunc->copy(); newFunc->setImplementingClass(func->implementingClass()); |