aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/typedatabase.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-07-26 10:41:53 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-07-26 14:04:26 +0000
commita6d12454983f8b1f2f8e7087de4b11ccd9126178 (patch)
treef0b878e3503504d637654577fb2e82f0a1ec5930 /sources/shiboken2/ApiExtractor/typedatabase.h
parent831b22fcd6eb9b45c9e7834799a91698ec00a6a4 (diff)
shiboken: Fix non-deterministic order of some SBK type indexes
Change underlying type of the type database from a QHash<qualified_name, list of entries> to a QMultiMap<qualified_name, entry>. Previously, there was an allEntries() accessor and a function named entries() building a QHash<qualified_name, entry>. Simplify this so that there is only an entries() accessor returning the QMultiMap. Refactor the various Typedatabase::find() functions to operate on an iterator range of the QMultiMap. This unearthed some bugs: 1) In the generators, the call to findType(packageName()) would return the namespace entry for "sample" instead of the intended module type entry named "sample" due to the ordering. Add a new function to search for module type entries and assert that it finds it. 2) There was a duplicate, empty primitive type entry for QModelIndexList. Task-number: PYSIDE-757 Change-Id: I1814e4ca67d306e1488398507707cfd07b3f2c78 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/typedatabase.h')
-rw-r--r--sources/shiboken2/ApiExtractor/typedatabase.h15
1 files changed, 8 insertions, 7 deletions
diff --git a/sources/shiboken2/ApiExtractor/typedatabase.h b/sources/shiboken2/ApiExtractor/typedatabase.h
index 3664d76b7..b37efedc8 100644
--- a/sources/shiboken2/ApiExtractor/typedatabase.h
+++ b/sources/shiboken2/ApiExtractor/typedatabase.h
@@ -58,6 +58,8 @@ int getMaxTypeIndex();
class ContainerTypeEntry;
class PrimitiveTypeEntry;
+class TypeSystemTypeEntry;
+
class TypeDatabase
{
TypeDatabase();
@@ -88,12 +90,11 @@ public:
NamespaceTypeEntry* findNamespaceType(const QString& name) const;
ContainerTypeEntry* findContainerType(const QString& name) const;
FunctionTypeEntry* findFunctionType(const QString& name) const;
+ const TypeSystemTypeEntry *findTypeSystemType(const QString &name) const;
TypeEntry* findType(const QString& name) const;
- TypeEntryHash allEntries() const { return m_entries; }
-
- SingleTypeEntryHash entries() const;
+ const TypeEntryMultiMap &entries() const { return m_entries; }
PrimitiveTypeEntryList primitiveTypes() const;
@@ -160,12 +161,12 @@ public:
void formatDebug(QDebug &d) const;
#endif
private:
- TypeEntryList findTypes(const QString &name) const;
+ TypeEntryMultiMapConstIteratorRange findTypes(const QString &name) const;
bool m_suppressWarnings;
- TypeEntryHash m_entries;
- SingleTypeEntryHash m_flagsEntries;
- TemplateEntryHash m_templates;
+ TypeEntryMultiMap m_entries;
+ TypeEntryMap m_flagsEntries;
+ TemplateEntryMap m_templates;
QVector<QRegularExpression> m_suppressedWarnings;
AddedFunctionList m_globalUserFunctions;