aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2019-04-01 15:55:44 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2019-04-03 18:07:51 +0000
commit6ae9396660800f67bc95d19e5e5fd326ea268190 (patch)
tree67f0d23d115a6f829a6b59450fc33cf6a2139454
parent1d7af0b25ac241a95e33bd46561033d0b33b9013 (diff)
shiboken: Search for classes by type entry instead of name
Searching by name is more efficient and has problems when extending namespaces. Search by type entry instead where possible. Change-Id: I131329a6648bb7f0a02cba08a5fbbc0531e0c51f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
-rw-r--r--sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp6
-rw-r--r--sources/shiboken2/generator/generator.cpp2
-rw-r--r--sources/shiboken2/generator/shiboken2/cppgenerator.cpp4
3 files changed, 6 insertions, 6 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
index e62a2a78a..e7a6b4e83 100644
--- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp
@@ -192,7 +192,7 @@ void AbstractMetaBuilderPrivate::checkFunctionModifications()
QString name = signature.trimmed();
name.truncate(name.indexOf(QLatin1Char('(')));
- AbstractMetaClass *clazz = AbstractMetaClass::findClass(m_metaClasses, centry->qualifiedCppName());
+ AbstractMetaClass *clazz = AbstractMetaClass::findClass(m_metaClasses, centry);
if (!clazz)
continue;
@@ -229,7 +229,7 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::argumentToClass(const ArgumentMod
AbstractMetaType *type = translateType(argument->type());
if (type && type->typeEntry() && type->typeEntry()->isComplex()) {
const TypeEntry *entry = type->typeEntry();
- returned = AbstractMetaClass::findClass(m_metaClasses, entry->name());
+ returned = AbstractMetaClass::findClass(m_metaClasses, entry);
}
delete type;
return returned;
@@ -579,7 +579,7 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom)
&& !entry->isCustom()
&& !entry->isVariant()
&& (entry->generateCode() & TypeEntry::GenerateTargetLang)
- && !AbstractMetaClass::findClass(m_metaClasses, entry->qualifiedCppName())) {
+ && !AbstractMetaClass::findClass(m_metaClasses, entry)) {
qCWarning(lcShiboken).noquote().nospace()
<< QStringLiteral("type '%1' is specified in typesystem, but not defined. This could potentially lead to compilation errors.")
.arg(entry->qualifiedCppName());
diff --git a/sources/shiboken2/generator/generator.cpp b/sources/shiboken2/generator/generator.cpp
index 91e940f51..4b76c2d2c 100644
--- a/sources/shiboken2/generator/generator.cpp
+++ b/sources/shiboken2/generator/generator.cpp
@@ -421,7 +421,7 @@ bool Generator::generate()
for (const AbstractMetaType *type : qAsConst(m_d->instantiatedSmartPointers)) {
AbstractMetaClass *smartPointerClass =
- AbstractMetaClass::findClass(m_d->apiextractor->smartPointers(), type->name());
+ AbstractMetaClass::findClass(m_d->apiextractor->smartPointers(), type->typeEntry());
GeneratorContext context(smartPointerClass, type, true);
if (!generateFileForContext(context))
return false;
diff --git a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
index 2fedf9ae1..79129d6b8 100644
--- a/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
+++ b/sources/shiboken2/generator/shiboken2/cppgenerator.cpp
@@ -3076,7 +3076,7 @@ QString CppGenerator::argumentNameFromIndex(const AbstractMetaFunction* func, in
AbstractMetaType *returnType = getTypeWithoutContainer(funcType);
if (returnType) {
pyArgName = QLatin1String(PYTHON_RETURN_VAR);
- *wrappedClass = AbstractMetaClass::findClass(classes(), returnType->typeEntry()->name());
+ *wrappedClass = AbstractMetaClass::findClass(classes(), returnType->typeEntry());
} else {
QString message = QLatin1String("Invalid Argument index (0, return value) on function modification: ")
+ (funcType ? funcType->name() : QLatin1String("void")) + QLatin1Char(' ');
@@ -3090,7 +3090,7 @@ QString CppGenerator::argumentNameFromIndex(const AbstractMetaFunction* func, in
AbstractMetaType* argType = getTypeWithoutContainer(func->arguments().at(realIndex)->type());
if (argType) {
- *wrappedClass = AbstractMetaClass::findClass(classes(), argType->typeEntry()->name());
+ *wrappedClass = AbstractMetaClass::findClass(classes(), argType->typeEntry());
if (argIndex == 1
&& !func->isConstructor()
&& OverloadData::isSingleArgument(getFunctionGroups(func->implementingClass())[func->name()]))