aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-07-04 13:25:31 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2020-01-06 16:05:36 +0100
commit3bc59fc8a2a2e36916bd2c4557b8fb48329085f3 (patch)
treeaeebf1f35c4b5e99a808e5c2c4903bf1fa03a10c /sources/shiboken2/generator
parente4aa9e13ac6e4d38c473fc32ea4ace3777df7a57 (diff)
shiboken/typedatabase: Match multiple type entries by name
For smart pointer instantiations, type entries from multiple modules need to be searched, which is currently not implemented. Extend the type database to return all type entries by name. Split out the code finding a type entry from AbstractMetaBuilderPrivate::translateType() and change it return a list. Ignore duplicate primitive types for now since that cannot be easily avoided. Task-number: PYSIDE-1024 Change-Id: I4a30b9151b472acff5fba221019a2e321807d4a0 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken2/generator')
-rw-r--r--sources/shiboken2/generator/shiboken2/shibokengenerator.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
index 35bd363b5..647ceb67f 100644
--- a/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/shibokengenerator.cpp
@@ -2550,13 +2550,19 @@ void ShibokenGenerator::collectContainerTypesFromConverterMacros(const QString &
QString convMacro = toPythonMacro ? QLatin1String("%CONVERTTOPYTHON[") : QLatin1String("%CONVERTTOCPP[");
int offset = toPythonMacro ? sizeof("%CONVERTTOPYTHON") : sizeof("%CONVERTTOCPP");
int start = 0;
+ QString errorMessage;
while ((start = code.indexOf(convMacro, start)) != -1) {
int end = code.indexOf(QLatin1Char(']'), start);
start += offset;
if (code.at(start) != QLatin1Char('%')) {
QString typeString = code.mid(start, end - start);
- AbstractMetaType *type = buildAbstractMetaTypeFromString(typeString);
- addInstantiatedContainersAndSmartPointers(type, type->originalTypeDescription());
+ if (AbstractMetaType *type =
+ buildAbstractMetaTypeFromString(typeString, &errorMessage)) {
+ addInstantiatedContainersAndSmartPointers(type, type->originalTypeDescription());
+ } else {
+ qFatal("%s: Cannot translate type \"%s\": %s", __FUNCTION__,
+ qPrintable(typeString), qPrintable(errorMessage));
+ }
}
start = end;
}