aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/generator/shiboken/shibokengenerator.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-02-17 11:21:19 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-02-17 15:16:07 +0100
commit1a53685c10dc3dab972a42fe02166ff0349320f4 (patch)
treee73903b2480a30013fa901ad89ed4ad2f05478cc /sources/shiboken6/generator/shiboken/shibokengenerator.h
parent27d4e8e66008c2d95f06c957c1036638c7284dbf (diff)
shiboken6: Fix handling of parameters for values with copy constructors only
Introduce a check function to ShibokenGenerator to ensure it is pass-by-value or pass-by-const-ref to prevent dereferencing the parameters in case they are passed by pointer (see QHelpContentItem::childPosition(QHelpContentItem *)). Change-Id: I385e2bd5c0dfc34ce1ba75cb0c6eebde7ea9c68a Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'sources/shiboken6/generator/shiboken/shibokengenerator.h')
-rw-r--r--sources/shiboken6/generator/shiboken/shibokengenerator.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/sources/shiboken6/generator/shiboken/shibokengenerator.h b/sources/shiboken6/generator/shiboken/shibokengenerator.h
index aaf88ec53..bcba349cf 100644
--- a/sources/shiboken6/generator/shiboken/shibokengenerator.h
+++ b/sources/shiboken6/generator/shiboken/shibokengenerator.h
@@ -220,10 +220,16 @@ protected:
static bool isPyInt(const TypeEntry *type);
static bool isPyInt(const AbstractMetaType &type);
+ /// Returns whether the underlying type is a value type with copy constructor only
static bool isValueTypeWithCopyConstructorOnly(const ApiExtractorResult &api,
const TypeEntry *type);
static bool isValueTypeWithCopyConstructorOnly(const ApiExtractorResult &api,
const AbstractMetaType &type);
+ /// Returns whether the type (function argument) is a value type with
+ /// copy constructor only is passed as value or const-ref and thus
+ /// no default value can be constructed.
+ static bool valueTypeWithCopyConstructorOnlyPassed(const ApiExtractorResult &api,
+ const AbstractMetaType &type);
static bool isNullPtr(const QString &value);