aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-07-21 15:05:08 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-07-21 17:30:53 +0000
commitea9b082947933a7d381e177292a36dc6c5b0574c (patch)
tree0efd8662cf2b3731938658016e018d300275805a
parent3fe4c74f3e57b89c7891f27ccc4568ac30bab699 (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. Change-Id: Iddb2f868c360da5397279cc3058cb554f5e51b42 Reviewed-by: Christian Tismer <tismer@stackless.com> (cherry picked from commit 795e5b7c7521d275750590be728ed1078150f537) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetafunction.cpp16
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetafunction.h2
-rw-r--r--sources/shiboken6/generator/shiboken/cppgenerator.cpp9
-rw-r--r--sources/shiboken6/generator/shiboken/shibokengenerator.cpp3
4 files changed, 22 insertions, 8 deletions
diff --git a/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp b/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp
index 87a5d3edc..f5b9b168f 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp
@@ -400,6 +400,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 b677cf0ea..46bb708fa 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetafunction.h
+++ b/sources/shiboken6/ApiExtractor/abstractmetafunction.h
@@ -273,6 +273,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 dbe8ee9b2..a89c7f88b 100644
--- a/sources/shiboken6/generator/shiboken/cppgenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/cppgenerator.cpp
@@ -532,13 +532,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 89379a310..920c668c1 100644
--- a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
@@ -2292,7 +2292,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());