aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/modifications.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-09-14 13:52:14 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-10-01 11:24:55 +0200
commit2edf0042bb23fa8528dfb964377dae5bd35ee932 (patch)
treecafc76b224135aef870fe60e3215c18eb3ded1b0 /sources/shiboken6/ApiExtractor/modifications.cpp
parent6c62738a9a051c4e06444c6d37c766f7ccc696c8 (diff)
shiboken6: Refactor modified types of functions
Remove AbstractMetaFunction::typeReplaced(), which returned the modified type of an argument or the return type as a string. Instead, for function arguments, for which modified types must always be valid AbstractMetaTypes, add a getter modifiedType() returning an AbstractMetaType to AbstractMetaArgument. This fixes a number of potential bugs when accessing typeReplaced(int) with the wrong position due to removed arguments. The modified argument types are parsed from the XML strings in early on in AbstractMetaClass::fixFunctions() with proper error reporting. For return types, for which modified types need to be valid only when generating a type check for virtual method return in the C++ wrapper, add a function modifiedTypeName() to AbstractMetaFunction. Adapt the client code accordingly. Split apart CppGenerator::writeTypeCheck() into one overload taking an AbstractMetaType and one taking a string. Task-number: PYSIDE-1660 Change-Id: Id95379892b40ae2632ca33ed27263bada0ec015d Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken6/ApiExtractor/modifications.cpp')
-rw-r--r--sources/shiboken6/ApiExtractor/modifications.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/sources/shiboken6/ApiExtractor/modifications.cpp b/sources/shiboken6/ApiExtractor/modifications.cpp
index 8c6f31187..92b445791 100644
--- a/sources/shiboken6/ApiExtractor/modifications.cpp
+++ b/sources/shiboken6/ApiExtractor/modifications.cpp
@@ -481,7 +481,7 @@ ArgumentModification::ArgumentModification(ArgumentModification &&) = default;
ArgumentModification &ArgumentModification::operator=(ArgumentModification &&) = default;
ArgumentModification::~ArgumentModification() = default;
-QString ArgumentModification::modifiedType() const
+const QString &ArgumentModification::modifiedType() const
{
return d->modified_type;
}
@@ -492,6 +492,11 @@ void ArgumentModification::setModifiedType(const QString &value)
d->modified_type = value;
}
+bool ArgumentModification::isTypeModified() const
+{
+ return !d->modified_type.isEmpty();
+}
+
QString ArgumentModification::pyiType() const
{
return d->pyiType;