aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-09-03 10:50:56 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-09-06 11:28:41 +0200
commit5e4a1287c1742f96c5ba3ce0aca75791ce806157 (patch)
tree750e6283f3af3792d6aab6a586691029d8d9998c /sources/shiboken6/ApiExtractor
parentcc7da649aff335ad86c669e3ccb0185738e9d9ae (diff)
shiboken6: Handle hidden methods/"using" correctly
In C++, declaring a non-override method in a class hides all methods of the same name from the base class unless they are made visible by a "using Base::name" specification. Shiboken did not observe this rule; base class methods were added nevertheless, causing problems with code snippets. In addition, there were several places where the recursion for the inherited base class methods was done. Move the collection of inherited base class methods into ShibokenGenerator::getFunctionGroups() and implement proper handling of using declarations. This function then returns the authoritative list of functions to be generated. Remove a few cases from the test. [ChangeLog][shiboken6] The handling of hidden base class member functions and using declarations has been fixed. Fixes: PYSIDE-1653 Change-Id: I62c9ec47617f94098c4a27a557a23bbfeaad805c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken6/ApiExtractor')
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetalang.cpp8
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetalang.h1
2 files changed, 9 insertions, 0 deletions
diff --git a/sources/shiboken6/ApiExtractor/abstractmetalang.cpp b/sources/shiboken6/ApiExtractor/abstractmetalang.cpp
index c2d9bfcf6..91da71cb9 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetalang.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetalang.cpp
@@ -1087,6 +1087,14 @@ bool AbstractMetaClass::isUsingMember(const AbstractMetaClass *c,
return d->isUsingMember(c, memberName, minimumAccess);
}
+bool AbstractMetaClass::hasUsingMemberFor(const QString &memberName) const
+{
+ return std::any_of(d->m_usingMembers.cbegin(), d->m_usingMembers.cend(),
+ [&memberName](const UsingMember &um) {
+ return um.memberName == memberName;
+ });
+}
+
/* Goes through the list of functions and returns a list of all
functions matching all of the criteria in \a query.
*/
diff --git a/sources/shiboken6/ApiExtractor/abstractmetalang.h b/sources/shiboken6/ApiExtractor/abstractmetalang.h
index 39d5a4a8e..f08ed2039 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetalang.h
+++ b/sources/shiboken6/ApiExtractor/abstractmetalang.h
@@ -146,6 +146,7 @@ public:
void addUsingMember(const UsingMember &um);
bool isUsingMember(const AbstractMetaClass *c, const QString &memberName,
Access minimumAccess) const;
+ bool hasUsingMemberFor(const QString &memberName) const;
AbstractMetaFunctionCList queryFunctionsByName(const QString &name) const;
static bool queryFunction(const AbstractMetaFunction *f, FunctionQueryOptions query);