aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/generator/shiboken/cppgenerator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* shiboken6: Generate polymorphic bases into type discovery functionsFriedemann Kleint5 days1-1/+1
| | | | | | | | | In case of a chain QLabel->QWidget->QObject; QWidget should be marked as a polymorphic base and checked for example for functions returning a QWidget *. Change-Id: I44306d6635794119e6f18658a438e64160c5c41c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* libshiboken: Split the Shiboken::Object::newObject() functionFriedemann Kleint5 days1-20/+22
| | | | | | | | | | | | | | | | | | | Remove the bool exactType parameter from the existing newObject() by splitting it into 3 functions: newObjectForType() creates an instance for the type passed in. newObjectWithHeuristics() takes an additional typeName parameter obtained from typeid().name() on the C++ pointer which may contain the derived class name and also tries to find the most derived class using the type discovery graph. newObjectForPointer() is new and contains a test for multiple inheritance in the inheritance tree (disabling use of the most derived class) which was previously generated into the code. Change-Id: Ic0a25f8ec17dc20364b37062de6f20544cd2f09e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Simplify code in argument pointer conversionFriedemann Kleint11 days1-8/+4
| | | | | | | | | | | | | Shiboken::Object::newObject() ignores the type name passed in when exactType=true, do not generate code to determine and allocate the type name in that case. Amends e254c3c2aa140016e298107a0297885234abfde7. Pick-to: 6.7 Task-number: PYSIDE-868 Change-Id: Icae92bab0ab0358c93601d4f57180fb1bf0c4269 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Lazy-initialize the dependency graphFriedemann Kleint2024-04-251-4/+33
| | | | | | | | | | | | | | | | | | | | | Change the dependency graph in the BindingManager from PyTypeObject *-based nodes to nodes which are wrapping the TypeInitStruct * and hashing on the type name. This allows for creating the types on demand when walking along the edges and calling the type discovery functions. This only creates the required types instead of the entire lazy group of polymorphic classes. The graph is now populated by from the generated code using a function named initInheritance() instead of dynamically from introduceWrapperType. Task-number: PYSIDE-2404 Task-number: PYSIDE-2675 Pick-to: 6.7 Change-Id: I030d4957c221f4defbb7cc52a6927287b70d9864 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Revert "Lazy Load: Fix polymorphic classes by identifying lazy groups"Friedemann Kleint2024-04-251-51/+15
| | | | | | | | | | | | | This reverts commit 9f09e1dda0f167432110a22db6f9a5accf800734. Let's try to make the dependency graph lazy. Revert the change, excluding the test bits. Task-number: PYSIDE-2404 Task-number: PYSIDE-2675 Pick-to: 6.7 Change-Id: I0d28678f09834a09255dce28862e0970d68ac9fa Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* shiboken6: Fix leaking tuples in introduceWrapperType()Friedemann Kleint2024-04-241-37/+47
| | | | | | | | | | | | | | | | | When calling introduceWrapperType(), the generated code creates and leaks a tuple of base types if there are base classes. When there are no base classes, a tuple (containing SbkObjectType) is created and leaked within introduceWrapperType(). To fix this, generate the complete tuple including SbkObjectType in the generated code and remove the base type parameter to introduceWrapperType(). Pick-to: 6.7 Task-number: PYSIDE-1617 Change-Id: Ib3bec8e6b94bea14a46df826667373d3f859dfd5 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Lazy Load: Fix polymorphic classes by identifying lazy groupsFriedemann Kleint2024-04-231-15/+51
| | | | | | | | | | | | | Classes with a polymorphicIdValue have an expression which may reference a related class. We use that to identify a lazy group, which has to be initialized at once. This is now completely solved. Pick-to: 6.7 Fixes: PYSIDE-2675 Change-Id: I957a1b2b95d37b96cc2e98082fc7f92e601322cb Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken6: Generate Python override code for added virtualsFriedemann Kleint2024-04-221-16/+50
| | | | | | | | | | | | Introduce "Python override" as a special type of user-added function which will cause a function calling a Python override into the native wrapper. This can then be called from a virtual that has a signature which cannot be handled in Python. Fixes: PYSIDE-2602 Pick-to: 6.7 Change-Id: I5fc44ebe3f585078e87d3230d5e6f4faa67a4ee1 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Introduce new position for code injection into virtual methodsFriedemann Kleint2024-04-221-0/+5
| | | | | | | | | | Make it possible to inject code before the Python override is called. Task-number: PYSIDE-2602 Pick-to: 6.7 Change-Id: I0e5b4ced34ae8b41df5acdb34912b853f60b372f Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Fix minor issues in code generationFriedemann Kleint2024-04-171-2/+2
| | | | | | | | Drop white space and use nullptr. Pick-to: 6.7 6.5 Change-Id: I2a29103ef342b541965fb1ad089fbf48019aaf4f Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* shiboken6: Add a placeholder for the base class to polymorphic-id-expressionFriedemann Kleint2024-04-121-3/+19
| | | | | | | | | | | | | Add %B for base class in addition to %1 for the class itself, which is not useful and may lead to undefined behavior. As a drive-by fix up the hitherto unused "polymorphic-base" which is a boolean indicating the base class. Pick-to: 6.7 Task-number: PYSIDE-2675 Change-Id: I078191dc7b4c686b196fe58d6df9a249cdf2b151 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Add a way of disable lazy initialization per classFriedemann Kleint2024-04-121-4/+11
| | | | | | | | | Task-number: PYSIDE-2675 Task-number: PYSIDE-2404 Pick-to: 6.7 Change-Id: I11400172b0f0045fadd3183d4f0b16688b4119b6 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Lazy Import: Ensure type creation functions being idempotentChristian Tismer2024-04-111-5/+7
| | | | | | | | | | | | | | | | | | Under circumstances it was possible to create a type twice. There would be many more changes necessary to ensure that this can never happen. Very simple to prevent this was by checking that a second call of the creation function does nothing, IOW making the functions idempotent. Tested with and without laziness. Task-number: PYSIDE-2404 Change-Id: I70e3335a12f0cbe1111febaace7275e87c843bd4 Fixes: PYSIDE-2674 Pick-to: 6.7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken6: Refactor function virtualMethodReturn()Friedemann Kleint2024-04-091-26/+41
| | | | | | | | | Remove the TextStream parameter and throw an exception instead of generating an #error if something goes wrong. Task-number: PYSIDE-2602 Change-Id: I56cb0c9b45a4161ce04df273836d77948338c521 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Split out the part writing a Python overrideFriedemann Kleint2024-04-091-1/+10
| | | | | | | Pick-to: 6.7 Task-number: PYSIDE-2602 Change-Id: Id810e37a29b246339acc97a09f890d82e2c0d4f6 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Introduce a variable for the global scope prefixFriedemann Kleint2024-04-081-29/+30
| | | | | | | | | | | | | | | Introduce a variable for the global scope prefix, defaulting to "::". The header generator needs a prefix for the Sbk_Type<>() template specifications to work. This allows for some cleanup; std:: types and wrapper classes will no longer be qualified with that. Pick-to: 6.7 Task-number: PYSIDE-2590 Change-Id: I0203915b53509f1257100cdb6ca38038b14591ee Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Register typedefs of container typesFriedemann Kleint2024-03-181-2/+14
| | | | | | | | | | | | | | | | | | For signals like QRemoteObjectRegistry.remoteObjectAdded(QRemoteObjectSourceLocation) where using QRemoteObjectSourceLocation = std::pair<QString,QRemoteObjectSourceLocationInfo> one needed to specify the fully qualified C++ name in @Slot() for the metaobject system to work and the shiboken converter to be found. Record the typedefs and register the container converters under the typedef name, too. Fixes: PYSIDE-2633 Change-Id: Ifc62f096277949a507957a0466adb47d082695c7 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* shiboken6: Refactor writing out converter names registrationFriedemann Kleint2024-03-141-36/+42
| | | | | | | | | | | | | | Introduce a streamable type for the purpose and a helper function for registering in all scopes and streamline the code accordingly. In writeContainerConverterInitialization(), move the name registration out of the custom converter loop since it is needed only once. Task-number: PYSIDE-2633 Change-Id: Ia1256f6c76dc006a1d96b7deaf54a1891e696d12 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* LazyInit: Move the get arguments into a static structureChristian Tismer2024-03-131-13/+34
| | | | | | | | | | | | | | | | | | | | The central get function is used very often. Since the string constants are repeated many times and there seems to be no constant folding, it is better to re-arrange the structure a bit to avoid code bloat. By moving the get arguments into a struct, we avoid all repetitions of string constants and minimize the runtime overhead. The structure is now fully backward compatible and works with unchanged scriptableapplication. Task-number: PYSIDE-2404 Change-Id: Ie7c788ef75cc3d58366532c5f14ab013ebd792b5 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* LazyInit: Implement Lazy Initialization by Delayed Module EntriesChristian Tismer2024-03-131-22/+50
| | | | | | | | | | | | | | | | | | | | Lazy init is done by module entries which are delayed. Although visible in the module, the classes are only created when actually accessed by getattr. Internally, the access to the global Init_xxx functions is redirected to a Shiboken::Module::get function which resolves the classes if not already present in the global type array. PYSIDE6_OPTION_LAZY 0 - no lazy loading 1 - lazy load all known modules 2 - lazy load all modules Task-number: PYSIDE-2404 Change-Id: I98c01856e293732c166662050d0fbc6f6ec9082b Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Deprecation Python 3.8Cristián Maureira-Fredes2024-03-121-3/+3
| | | | | | | | | | | The changes related PYSIDE-939 can be removed when 3.9 support is dropped, because the problem was fixed and included in 3.9.13 so we cannot assume everyone will be on that version or superior. Change-Id: I78afc660edc6fbb3bb1a2438e17366e63b24e375 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Fix connecting to signals with QFlags<>Friedemann Kleint2024-03-011-1/+4
| | | | | | | | | | | | | | Additionally register the shiboken converter under the type alias name ("Qt::Alignment"), which appears in the meta method signature besides the full name ("QFlags<Qt::AlignmentFlag>"). Manifests as signal: QBluetoothDeviceDiscoveryAgent::deviceUpdated(QBluetoothDeviceInfo, QBluetoothDeviceInfo::Fields) Pick-to: 6.6 Fixes: PYSIDE-2613 Change-Id: I7ecce8e0b3f8ddf790c40260fc156184e83cad69 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Improve code snippet error handlingFriedemann Kleint2024-01-311-14/+26
| | | | | | | | | | | | | Type conversion errors in code snippets can be hard to diagnose, particularly when they occur in an invalid context due to misspelt snippet markers. Add some functions wrapping the in try/catch, adding some context information to the error messages. Pick-to: 6.6 Change-Id: I7e35f298497b7fd0b582f43d6941a683e18377b3 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Prepare for making the global scope prefix configurableFriedemann Kleint2024-01-291-14/+12
| | | | | | | | | | | | Use helper getFullTypeName() in more places. Remove the global scope prefix from wrapper classes, they should not cause ambiguities. Pick-to: 6.6 Task-number: PYSIDE-2590 Change-Id: I47b6a69c27ea5469f8f11ec10fc349dec4689c60 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Add type behavior to SbkObjectTypeFriedemann Kleint2024-01-171-0/+2
| | | | | | | | | | | | | Fill the existing fields and output it in dump(). This saves looking up the type in the type system file when analzying bugs. Query functions might be added later should a need arise. As a drive-by, output the ref count as well. Task-number: PYSIDE-1898 Task-number: PYSIDE-930 Change-Id: Ie5a43d7971dd82e7da1930216041efaccfb324f0 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Use PyType_GetSlot() instead of accessing PyTypeObject's slotsFriedemann Kleint2024-01-161-5/+29
| | | | | | | | | | PyTypeObject is not exposed in the stable API; accessor functions should be used to retrieve the slots. Task-number: PYSIDE-560 Change-Id: I97f842c17a00bd5fb18d16c5c6ac3c7b66dcf705 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Fix error in generated code when all enum values are deprecatedFriedemann Kleint2024-01-051-1/+2
| | | | | | | | | Amends 9dbc3a214ee72bcf57faad9855e60b70ef165f94. Pick-to: 6.6 6.5 Task-number: PYSIDE-1735 Change-Id: Ia32b096450c6fa7ee4a1717e5f5c17a50520a5d9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Refactor writing the meta object functionsFriedemann Kleint2023-12-081-4/+3
| | | | | | | | Lump the declarations together and add a function for checking. Task-number: PYSIDE-2535 Change-Id: I2f80e789a582beef0487ad3ea704241ddc555544 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Add a submodule attribute to the typesystemFriedemann Kleint2023-12-081-2/+20
| | | | | | | | | | | | | | Add an attribute and let it generate the AddObject() call. As a drive-by, remove documentation of the (unimplemented) default-superclass attribute. [ChangeLog][shiboken6] An attribute to generate submodules has been added to the typesystem. Fixes: PYSIDE-2447 Change-Id: Ibecdb96a7c2cf02e42fff81b034ce15c6a516098 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Port some QString-type variables of the generator to latin1Friedemann Kleint2023-11-291-15/+13
| | | | | | | | | As a drive-by, introduce PYTHON_SELF_VAR and CPP_ARG, renaming the CPP_ARG() function. Task-number: PYSIDE-2537 Change-Id: I5fcd14802966aa5587f53141c639686de6596eaf Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Add support for QAnyStringView to class TextStreamFriedemann Kleint2023-11-291-34/+34
| | | | | | | | | This requires adding a few more stream operators to avoid ambiguities. Task-number: PYSIDE-2537 Change-Id: I53210292467681e3430a4b8d9b8d567abee486d0 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Remove some further uses of QStringLiteralFriedemann Kleint2023-11-291-6/+6
| | | | | | Task-number: PYSIDE-2537 Change-Id: Ie71b17eec385b31842d6693b3492db565d479fd0 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Remove inline functions using QStringLiteralFriedemann Kleint2023-11-291-12/+12
| | | | | | | | | | Replace the formely used static inline QString foo() { return QStringLiteral("foo"); } by latin1 literals. Task-number: PYSIDE-2537 Change-Id: Ia4e9827e2b2a2f65f06751d549e8d79002386878 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Port the MetaClass::find*() helpers to QAnyStringViewFriedemann Kleint2023-11-271-1/+1
| | | | | | Task-number: PYSIDE-2537 Change-Id: I7d9c160b4b8c46854b11722c05510da766dcc3f5 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix losing the default value when the type alteredFriedemann Kleint2023-10-301-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | The changes influence, for instance, the following line: ```python @staticmethod def translate( context: str, key: str, disambiguation: Optional[str] = ..., n: int = ... ) -> str: ... ``` Namely, the `disambiguation` argument now indicates that it has a default value. It seems that the `pyi-type` attribute of the modify-argument tag eats the argument default value. The commit should add the omitted values if they're provided. Initial-patch-by: Anton Yablokov (stsav012@gmail.com) Pick-to: 6.6 Change-Id: Ie3914c3ef13578ef8cfff9ecb8c6c64f167b5360 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Refactor multiple inheritance offset calculationFriedemann Kleint2023-10-261-11/+15
| | | | | | | | | | | | | | | | - Avoid std::set allocation by using standard algorithms operating on the int array instead. - Fix one-time initialization for hierarchies where all offsets are 0 by using -2 as magic constant. - Reduce mutex lock operations by initializing all base addresses in the wrapper map in one go. - Reduce mutex lock operations by releasing the base addresses in the wrapper map in one go. Pick-to: 6.6 Task-number: PYSIDE-2506 Change-Id: I7c19b4287a9fcb7a47894b0a06bbeb5698cff7d7 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Get rid of tp_dict in general, amendedChristian Tismer2023-10-111-12/+15
| | | | | | | | | | | | | | | | | | A few more cases of cppgenerator were added. This are now really all cases, because tp_dict is no longer exported. As a very positive side effect, there is no longer direct tp_dict access in the "init_<type>" functions. Usage of PepType_GetDict would have created a permanent extra-reference. NOTE: It was necessary to set SKIP_UNITY_BUILD_INCLUSION on pep384impl.cpp in order to let this work with unity. Change-Id: I021dbc978b51265db96d5d3d438e06aa96230cc1 Pick-to: 6.2 6.5 6.6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken6: Fix some static code analysis warnings in the generated codeFriedemann Kleint2023-10-101-40/+46
| | | | | | | | | | | | | Remove left-over reinterpret_cast<> from SbkType to PyType (SbkType was removed). Fix warnings about implicit cast to bool (pointer/int). Fix some auto * definitions of pointers. Generate wrapper destructors as override when applicable. Pick-to: 6.6 6.5 Change-Id: I961a1c64821bbf0f2648f5e897029f1aa7d61a43 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Potential fix for a linker error on macOS SonomaFriedemann Kleint2023-10-051-1/+1
| | | | | | | | | | | | Remove inline from CppGenerator::writeSetattroDefaultReturn() since it is used from cppgenerator_smartpointer.cpp. Amends f6d11df9409da11e084f57633025c2806735e8b7. Pick-to: 6.6 Task-number: PYSIDE-2462 Fixes: PYSIDE-2480 Change-Id: I2b2491fb98487dad67e6483565ce459f968374ed Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Add a __repr__ function for smart pointersFriedemann Kleint2023-10-021-10/+23
| | | | | | | | | | | | | | Add a generic repr function to the string utilities of libshiboken. Add a new module sbksmartpointer with a specialized repr function adding pointee information to libshiboken. Generate code to call it into the smart pointer code. Pick-to: 6.6 Task-number: PYSIDE-2462 Change-Id: Ie7b8956051bc1b7ef817c15d26deb1dc3099fd30 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Replace QPair by std::pairFriedemann Kleint2023-09-291-2/+2
| | | | | | Pick-to: 6.6 6.5 Change-Id: Ic64a2a2c162c54fbbfb6ddc5004ffe1944bfd37a Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Refactor generation of the __copy__ functionFriedemann Kleint2023-09-271-17/+21
| | | | | | | | | | | | Change CppGenerator::writeCopyFunction() to follow the pattern of the other special functions: Pass in the definition and signature streams and return the function name. The special handling of __copy__ in writePyMethodDefs() can then be removed. Pick-to: 6.6 Task-number: PYSIDE-2462 Change-Id: I27b1711156c0c9b9f844bbf744ddc0df50d82edd Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Split out smart pointer code from CppGeneratorFriedemann Kleint2023-09-271-430/+6
| | | | | | | Pick-to: 6.6 Task-number: PYSIDE-2462 Change-Id: Ida1d297f1f5fda53146cd967795bcce2d6f933f7 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Split out generator stringsFriedemann Kleint2023-09-271-30/+13
| | | | | | | | | | | | | | | Revisit their usage and turn some into helper functions. Move some additional strings from CppGenerator there. The change is preparing for splitting out the smart pointer code from CppGenerator. As a drive-by, extract a helper for writing casts to PyCFunction. Pick-to: 6.6 Task-number: PYSIDE-2462 Change-Id: I82fe8c935d4377ee154b4b83c461edeb60090a0e Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Fix calling conventions in TextStream/formattingFriedemann Kleint2023-09-201-7/+7
| | | | | | | | | | Pass enum by value and a large struct by const-ref. As a drive-by, change sbkUnusedVariableCast() to use QStringView so that it works with UTF-16 literals as well. Pick-to: 6.6 6.5 Change-Id: I8e1ed8fce872ea0d346b8ade1d0e1e857cacd73f Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Fix some clang-tidy warningsFriedemann Kleint2023-09-201-11/+7
| | | | | | | | | | | | | | | | - narrowing conversion qsizetype->int - Repeating return type for default-constructed values - Make methods const - Add missing references - Use range-based for - Use Q_DISABLE_COPY_MOVE where applicable - Initialize variables - Remove unused function parameters Pick-to: 6.6 6.5 Change-Id: I65290fe2dab5283a5cbbf6f82c413c3cf294f1bd Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Make more generator methods staticFriedemann Kleint2023-09-191-34/+42
| | | | | | | | | | | | | After db3ef22bc3725cabdc46f3359509326df5f270cf (making generator options statically accessible), more generator methods can be made static. Apply several rounds of clang-tidy scanning for [readability-convert-member-functions-to-static]. Pick-to: 6.6 Change-Id: I67f4c5652f37d3aa1dfa56c18ce5dff3c503a341 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Move the finding of bool casts into the class cacheFriedemann Kleint2023-09-181-42/+0
| | | | | | | | | | | Finding the right function for implementing nb_bool is a lengthy function; move it into the static class cache for access by the header and source generators. Pick-to: 6.6 6.5 Change-Id: I1c7a32ffe115f612b84a6091487e51ba5b7f1247 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
* shiboken6: Replace options related to nb_zero by nb_boolFriedemann Kleint2023-09-061-2/+2
| | | | | | | | | | | | | | nb_zero is Python 2 terminology. Rename the related functions and use new options. [ChangeLog][shiboken6] The command line options --use-operator-bool-as-nb_nonzero and --use-isnull-as-nb_nonzero have been replaced by --use-operator-bool-as-nb-bool and --use-isnull-as-nb-bool, respectivily to match Python 3 terminology. The old options continue to work. Change-Id: I1201f4b15e021c8df96740149c20fa1478c12ae1 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Fix default parameters for containers without indirectionsFriedemann Kleint2023-09-061-2/+2
| | | | | | | | | | | | e48b696ffab552785d38d72dff6c9dda796c9628 disabled default parameters for containers since indirections of the argument type can cause clashes. Enable it for the case of no indirections. Fixes: PYSIDE-2454 Pick-to: 6.5 Change-Id: Ie23b2e90244d7fe9e52e31c8314d51293fdbd8fa Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>