diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2020-12-18 11:25:33 +0100 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2020-12-18 13:14:56 +0000 |
commit | 8cef1ce5f2cb3c6f53533d5f42dd6e6db7d88fad (patch) | |
tree | a91b842a74cb44cb4c0b7afda62d98fe5ded3899 /sources | |
parent | ac3dbe2bfaf6cdf5e9e866b9446c5de3865d1224 (diff) |
shiboken6: Fix support of multiple smart pointer types
The function searching for the instantiations of smart pointers
was not checking for the smart pointer type entry,
so, QSharedPointer<int> was hiding std::shared_ptr<int>.
Check for the type entry as well.
Rearrange the code a bit.
Task-numnber: PYSIDE-454
Change-Id: Ib7a0385ce2c0f8de84b644168b0164f13f3332ad
Reviewed-by: Christian Tismer <tismer@stackless.com>
(cherry picked from commit 069f7309d72b2a1f80638641ac3d6269b6aefc1d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'sources')
-rw-r--r-- | sources/shiboken6/generator/generator.cpp | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/sources/shiboken6/generator/generator.cpp b/sources/shiboken6/generator/generator.cpp index c1d42db60..7f8167f58 100644 --- a/sources/shiboken6/generator/generator.cpp +++ b/sources/shiboken6/generator/generator.cpp @@ -282,24 +282,25 @@ void Generator::addInstantiatedContainersAndSmartPointers(const AbstractMetaType return; } - QString typeName = getSimplifiedContainerTypeName(type); if (isContainer) { + const QString typeName = getSimplifiedContainerTypeName(type); if (!m_d->instantiatedContainersNames.contains(typeName)) { m_d->instantiatedContainersNames.append(typeName); m_d->instantiatedContainers.append(type); } - } else { - // Is smart pointer. Check if the (const?) pointee is already known - auto pt = pointeeTypeEntry(type); - const bool present = - std::any_of(m_d->instantiatedSmartPointers.cbegin(), m_d->instantiatedSmartPointers.cend(), - [pt] (const AbstractMetaType &t) { - return pointeeTypeEntry(t) == pt; - }); - if (!present) - m_d->instantiatedSmartPointers.append(canonicalSmartPtrInstantiation(type)); + return; } + // Is smart pointer. Check if the (const?) pointee is already known for the given + // smart pointer type entry. + auto pt = pointeeTypeEntry(type); + const bool present = + std::any_of(m_d->instantiatedSmartPointers.cbegin(), m_d->instantiatedSmartPointers.cend(), + [typeEntry, pt] (const AbstractMetaType &t) { + return t.typeEntry() == typeEntry && pointeeTypeEntry(t) == pt; + }); + if (!present) + m_d->instantiatedSmartPointers.append(canonicalSmartPtrInstantiation(type)); } void Generator::collectInstantiatedContainersAndSmartPointers(const AbstractMetaFunctionCPtr &func) |