aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-10-22 07:51:43 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-10-22 11:28:12 +0000
commit4f303683ec328f429437c450c6dabad724c4e737 (patch)
tree98a7b6215f3d560e915f6cbd9391746c1ef68b0a
parent6ff6751b6037a01d776cf3f0f7a5828a04a3ad7c (diff)
shiboken6: Ignore nullptr when fixing of default values of function arguments
Task-number: PYSIDE-1691 Change-Id: I6ef69d065b7e47e15ca9b053b95db2d775b333e6 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit 2efc3669d07f77a08e334cf37913017523b8099b) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp2
-rw-r--r--sources/shiboken6/generator/shiboken/shibokengenerator.cpp4
2 files changed, 3 insertions, 3 deletions
diff --git a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
index 38f6d5f88..ddb4103a9 100644
--- a/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
+++ b/sources/shiboken6/ApiExtractor/abstractmetabuilder.cpp
@@ -2523,7 +2523,7 @@ QString AbstractMetaBuilderPrivate::fixDefaultValue(const ArgumentModelItem &ite
int /* argumentIndex */) const
{
QString expr = item->defaultValueExpression();
- if (expr.isEmpty() || expr == u"{}")
+ if (expr.isEmpty() || expr == u"{}" || expr == u"nullptr" || expr == u"NULL")
return expr;
expr.replace(u'\n', u' '); // breaks signature parser
diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
index 95a88d06e..04b9b7ed2 100644
--- a/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
+++ b/sources/shiboken6/generator/shiboken/shibokengenerator.cpp
@@ -382,7 +382,7 @@ QString ShibokenGenerator::guessScopeForDefaultValue(const AbstractMetaFunctionC
{
QString value = arg.defaultValueExpression();
- if (value.isEmpty() || value == QLatin1String("{}")
+ if (value.isEmpty() || value == u"{}" || value == u"nullptr" || value == u"NULL"
|| arg.hasModifiedDefaultValueExpression()
|| arg.type().isPointer()) {
return value;
@@ -402,7 +402,7 @@ QString ShibokenGenerator::guessScopeForDefaultValue(const AbstractMetaFunctionC
} else if (arg.type().typeEntry()->isValue()) {
auto metaClass = AbstractMetaClass::findClass(api().classes(),
arg.type().typeEntry());
- if (enumValueRegEx.match(value).hasMatch() && value != QLatin1String("NULL"))
+ if (enumValueRegEx.match(value).hasMatch())
prefix = AbstractMetaBuilder::resolveScopePrefix(metaClass, value);
} else if (arg.type().isPrimitive() && arg.type().name() == intT()) {
if (enumValueRegEx.match(value).hasMatch() && func->implementingClass())