diff options
Diffstat (limited to 'sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp')
| -rw-r--r-- | sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp index ae3237e8b..278c0b9c4 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp +++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp @@ -3010,6 +3010,19 @@ static ClassIndexHash::ConstIterator findByTypeEntry(const ClassIndexHash &map, return it; } +// Add a dependency of the class associated with typeEntry on clazz +static void addClassDependency(const TypeEntry *typeEntry, + const AbstractMetaClass *clazz, + int classIndex, const ClassIndexHash &map, + Graph *graph) +{ + if (typeEntry->isComplex() && typeEntry != clazz->typeEntry()) { + const auto it = findByTypeEntry(map, typeEntry); + if (it != map.cend() && it.key()->enclosingClass() != clazz) + graph->addEdge(it.value(), classIndex); + } +} + AbstractMetaClassList AbstractMetaBuilderPrivate::classesTopologicalSorted(const AbstractMetaClassList &classList, const Dependencies &additionalDependencies) const { @@ -3062,15 +3075,17 @@ AbstractMetaClassList AbstractMetaBuilderPrivate::classesTopologicalSorted(const // ("QString s = QString()"), add a dependency. if (!arg->originalDefaultValueExpression().isEmpty() && arg->type()->isValue()) { - auto typeEntry = arg->type()->typeEntry(); - if (typeEntry->isComplex() && typeEntry != clazz->typeEntry()) { - auto ait = findByTypeEntry(map, typeEntry); - if (ait != map.cend() && ait.key()->enclosingClass() != clazz) - graph.addEdge(ait.value(), classIndex); - } + addClassDependency(arg->type()->typeEntry(), clazz, classIndex, + map, &graph); } } } + // Member fields need to be initialized + const AbstractMetaFieldList &fields = clazz->fields(); + for (AbstractMetaField *field : fields) { + addClassDependency(field->type()->typeEntry(), clazz, classIndex, + map, &graph); + } } AbstractMetaClassList result; |
