aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2020-10-19 17:25:02 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-10-20 07:27:43 +0200
commit556c13f39244b4eb75638cd8f4434167eadf0c98 (patch)
tree2bf67519681112055664b3e6407c814995772314 /sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
parent3c96d427722b5492ac675dfebe8557768b2f82ad (diff)
shiboken2: Ensure there are no AbstractMetaType with Invalid usage
Introduce new values for the pattern enum representing template parameters, which were previously invalid and add a missing call to decideUsagePattern(). Change-Id: I7edeb80a67ab1edfe895e96311d54c9128fad5a3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp')
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
index 8ef2866c2..15710de4c 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
@@ -1981,14 +1981,13 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateType(const AddedFunction:
{
Q_ASSERT(!typeInfo.name.isEmpty());
TypeDatabase* typeDb = TypeDatabase::instance();
- TypeEntry* type;
QString typeName = typeInfo.name;
if (typeName == QLatin1String("void"))
return AbstractMetaType::createVoid();
- type = typeDb->findType(typeName);
+ TypeEntry *type = typeDb->findType(typeName);
if (!type)
type = typeDb->findFlagsType(typeName);
@@ -2049,6 +2048,8 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateType(const AddedFunction:
metaType->addInstantiation(metaArgType);
}
metaType->setTypeUsagePattern(AbstractMetaType::ContainerPattern);
+ } else {
+ metaType->decideUsagePattern();
}
return metaType;
@@ -2369,6 +2370,7 @@ AbstractMetaType *AbstractMetaBuilderPrivate::translateTypeStatic(const TypeInfo
}
}
+ Q_ASSERT(metaType->typeUsagePattern() != AbstractMetaType::InvalidPattern);
return metaType.take();
}