diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-04-04 11:46:51 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2022-04-04 15:14:57 +0200 |
commit | f21f5c469813ab8fb13b2607624dd9a33c345acb (patch) | |
tree | 4e337303e7a5a028d5c6ea309f523921e4d78cf0 /sources/shiboken6/generator/shiboken/cppgenerator.h | |
parent | 545e90b4c434c7380a61113ec377ba56007eb0dc (diff) |
shiboken6: Add a check for null to the smart pointer access
If a null check method exists, generate a check into getattro() with
a better error message than the attribute access error.
This will be vital for std::optional to suppress a C++ exception
being thrown.
Pick-to: 6.2
Task-number: PYSIDE-454
Change-Id: I6d8e16e31c094aa695e150990c471007bcd34eb9
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken6/generator/shiboken/cppgenerator.h')
-rw-r--r-- | sources/shiboken6/generator/shiboken/cppgenerator.h | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sources/shiboken6/generator/shiboken/cppgenerator.h b/sources/shiboken6/generator/shiboken/cppgenerator.h index 9f0dc6732..9bed05432 100644 --- a/sources/shiboken6/generator/shiboken/cppgenerator.h +++ b/sources/shiboken6/generator/shiboken/cppgenerator.h @@ -189,11 +189,14 @@ private: void writeSetattroDefinition(TextStream &s, const AbstractMetaClass *metaClass) const; static void writeSetattroDefaultReturn(TextStream &s); - void writeSmartPointerSetattroFunction(TextStream &s, const GeneratorContext &context) const; + void writeSmartPointerSetattroFunction(TextStream &s, + const GeneratorContext &context) const; void writeSetattroFunction(TextStream &s, AttroCheck attroCheck, const GeneratorContext &context) const; static void writeGetattroDefinition(TextStream &s, const AbstractMetaClass *metaClass); - static void writeSmartPointerGetattroFunction(TextStream &s, const GeneratorContext &context); + static void writeSmartPointerGetattroFunction(TextStream &s, + const GeneratorContext &context, + const BoolCastFunctionOptional &boolCast); void writeGetattroFunction(TextStream &s, AttroCheck attroCheck, const GeneratorContext &context) const; QString qObjectGetAttroFunction() const; |