aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-10-28 08:27:26 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2022-10-31 13:08:30 +0100
commit122e6dd3bc11e6a1363b486522c2f36e6fe96934 (patch)
tree0e21bb6ea1b8482539b1cf8cfe88a22557ecdd6b /sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
parent3bbf20cb0f2cb30975e47eb826c71777871baac2 (diff)
shiboken6: Generate includes required to be able to forward-declare classes in the module header
- Add some helper functions to IncludeGroup. - Collect the includes of classes declared to be primitive types - Add more argument includes to classes and take return type modifications into account. Pick-to: 6.4 Task-number: PYSIDE-2099 Change-Id: I6c73a4e428d77b1af5ec128a3c9bc4876d44115e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp')
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
index 4a4f4489e..88cda5461 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
@@ -326,6 +326,10 @@ void AbstractMetaBuilderPrivate::traverseOperatorFunction(const FunctionModelIte
metaFunction->setFlags(flags);
metaFunction->setAccess(Access::Public);
baseoperandClass->addFunction(AbstractMetaFunctionCPtr(metaFunction));
+ if (!metaFunction->arguments().isEmpty()) {
+ const auto include = metaFunction->arguments().constFirst().type().typeEntry()->include();
+ baseoperandClass->typeEntry()->addArgumentInclude(include);
+ }
Q_ASSERT(!metaFunction->wasPrivate());
}
@@ -1035,10 +1039,14 @@ AbstractMetaClass *AbstractMetaBuilderPrivate::traverseClass(const FileModelItem
reason = AbstractMetaBuilder::GenerationDisabled;
} else if (!type) {
TypeEntry *te = TypeDatabase::instance()->findType(fullClassName);
- if (te && !te->isComplex())
+ if (te && !te->isComplex()) {
reason = AbstractMetaBuilder::RedefinedToNotClass;
- else
+ // Set the default include file name
+ if (!te->include().isValid())
+ setInclude(te, classItem->fileName());
+ } else {
reason = AbstractMetaBuilder::NotInTypeSystem;
+ }
} else if (type->codeGeneration() == TypeEntry::GenerateNothing) {
reason = AbstractMetaBuilder::GenerationDisabled;
}