aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/modifications.cpp
Commit message (Collapse)AuthorAgeFilesLines
* shiboken6: Remove unused function modificationsFriedemann Kleint2024-04-171-14/+0
| | | | | | | | | As a drive-by, fix the "public" modification flag to be 4. Task-number: PYSIDE-2602 Pick-to: 6.7 Change-Id: I5bacc2bf17e5307df02b9e6d6adadc09d04a9ded Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Fix some clang-tidy warningsFriedemann Kleint2023-09-201-1/+1
| | | | | | | | | | | | | | | | - 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: Fix clang-tidy warning [performance-noexcept-move-constructor]Friedemann Kleint2023-09-191-6/+6
| | | | | | | | | Add noexcept, fixing: warning: move assignment operators should be marked noexcept. Pick-to: 6.6 6.5 Change-Id: I4d1244d07bdb88fafb8e67158cfdd4c53119c8b3 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Remove unused "thread" attribute of <modify-function>Friedemann Kleint2023-07-261-14/+0
| | | | | | | | | Output a warning in the parser. Pick-to: 6.5 Task-number: PYSIDE-2384 Change-Id: I6aa5c527558055d8e80c8b787c11cde3cd834ef3 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Port from QSharedPointer to std::shared_ptrFriedemann Kleint2023-01-051-1/+1
| | | | | | | Task-number: QTBUG-109570 Change-Id: Iabdafb0a5ab211e32c1bbf7face78fd5102a49b9 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Port some loop variables to qsizetypeFriedemann Kleint2022-10-131-1/+1
| | | | | | | | Where possible, used range-based for. Otherwise, use qsizetype for loop variables. Change-Id: I4773bee8468ce73722656ec73845369b7d40d4cd Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Match function modifications by unresolved signature as wellFriedemann Kleint2022-09-301-4/+9
| | | | | | | | | | | | | Store the unresolved signature from the code model as an additional field in AbstractMetaFunction. Add a function modificationSignatures() to return a list of signatures to be matched against the modifications. [ChangeLog][shiboken6] The signatures for function modifications now also allow for specifying unresolved types. Change-Id: I258c4ff2ddf87542098568ee01ca4f444afd05ce Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Clean up includesFriedemann Kleint2022-09-211-3/+1
| | | | | | | | | Remove unused includes from headers; add includes to sources where needed. Change-Id: I05efd95a9340eaf42cc5d606e2aef97acdaf83c7 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* shiboken6: Split AddedFunction from modificationsFriedemann Kleint2022-09-051-215/+0
| | | | | | Task-number: PYSIDE-2025 Change-Id: I34b6692e4e61dd6c03207ef60a794fee01bf675e Reviewed-by: Christian Tismer <tismer@stackless.com>
* Use SPDX license identifiersLucie Gérard2022-05-271-27/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: I065150015bdb84a3096b5b39c061cf0a20ab637d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Extract class CodeSnip into separate filesFriedemann Kleint2022-05-171-66/+1
| | | | | | Change-Id: Iff46540cdb764d4caa2efad26cc5e28347cef54f Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Remove deprecated QLatin1StringFriedemann Kleint2022-04-251-14/+22
| | | | | | | | | | Introduce a compatibility header to provide the 6.4 API to 6.3 to reduce merge conflicts. Task-number: QTBUG-98434 Pick-to: 6.3 6.2 Change-Id: Iab3f9f894019b4135afa96b930325966348210d0 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Migrate from QLatin1String to UTF-16 string literalsFriedemann Kleint2022-04-251-2/+2
| | | | | | | | | | Use the QStringView overloads of the comparison functions in order to minimize merge conflicts after the deprecation of QLatin1String in 6.4. Task-number: QTBUG-98434 Pick-to: 6.3 6.2 Change-Id: Ia0df398ab8f3e61a0b629971ccbec2273a78499b Reviewed-by: Christian Tismer <tismer@stackless.com>
* Migrate from QLatin1Char to UTF-16 char literalsFriedemann Kleint2022-04-251-11/+11
| | | | | | | | | Preparing for the deprecation of QLatin1Char in 6.4. Task-number: QTBUG-98434 Pick-to: 6.3 6.2 Change-Id: I8bc92aa9f4e6dbfcb12d2025c5a1e760ab4f0d7f Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6/Type system parser: Purge empty code snippetsFriedemann Kleint2022-01-181-0/+18
| | | | | | | | | | | Newline characters in conjunction with <insert-template> cause empty snippets to be added. Add functions to purge them. Pick-to: 6.2 Task-number: PYSIDE-1766 Change-Id: I534de369b45c4e785a643f6539a5c7fb395909f2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Fix debug operators for code snipsFriedemann Kleint2022-01-121-9/+24
| | | | | | | | | | | Declare the operator and output conversion rules of argument modifications. Output code snip fragments and template names. Pick-to: 6.2 Task-number: PYSIDE-1766 Change-Id: I56de33a2a56eee2fa357c5dda89cc391c99b76f9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Refactor modified types of functionsFriedemann Kleint2021-10-011-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* shiboken6: Add opaque containers for C++ sequence containersFriedemann Kleint2021-09-241-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a class that directly wraps a C++ sequence container, allow for modifying them. For all instantiated containers, generate a special (sequence) type that wraps the C++ container directly. For example, it will be accessible as a QList_int. This is achieved via providing a template for a type private that relies on a conversion traits template for conversion. Only the conversion traits specialization code needs to be generated. Use cases: - Allowing for modifying Fields of such container types (non-owning) - Pass it into functions taking such containers instead of converting back and forth from a PyList (constructed in Python, owning) [ChangeLog][shiboken6] Support for opaque C++ sequence scontainers has been added, allowing to pass a wrapped C++ container directly instead of converting it back and forth from Python sequences. Task-number: PYSIDE-1605 Change-Id: I49d378eb1a0151730d817d5bdd4b71a7c3b5cdda Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Fix crash when parsing adding functions with empty parameter typeFriedemann Kleint2021-08-271-1/+4
| | | | | | | | | Writing something like <add-function signature="foo(,,a)"/> would cause a crash. Bail out with an error instead. Pick-to: 6.1 Change-Id: I9e49cdbcd44b53e603afdcc863fa8b93a750250d Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6/Doc generator: Dedent documentation code snippetsFriedemann Kleint2021-06-181-69/+0
| | | | | | | | | | | | | Split out helpers for fixing code snippets from class CodeSnipAbstract (which is necessary since the QtXmlToSphinx test is compiled from single source files) and use them. Fixes a number of sphinx warnings about "Unexpected indentation" in data visualization examples. Pick-to: 6.1 Change-Id: I109f5f6a8158689f5c966630f1b29d797b48607d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Add a modification for PYI typesFriedemann Kleint2021-06-151-0/+12
| | | | | | | | | | | | | | | Make it possible to directly specify the type, overriding the modified type and the original type. This helps for example to enclose a pointer return value within Optional[]. [ChangeLog][shiboken6] It is now possible to specify a function argument type to appear in the .pyi files. Task-number: PYSIDE-1329 Task-number: PYSIDE-1467 Task-number: PYSIDE-1588 Change-Id: I7a62059c1f85d09f6f607a4a8d3536894460b751 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Refactor argument ownershipFriedemann Kleint2021-05-201-7/+22
| | | | | | | | | | | | In ArgumentModification, replace the QHash<TypeSystem::Language, TypeSystem::Ownership> by 2 getters and setters for native and target language. Rename InvalidOwnership to UnspecifiedOwnership. Pick-to: 6.1 Change-Id: I4f1a6bd67f50a7c2064b7543df197f580ffb73ca Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* shiboken6: Fix injecting documentation for added functions with parameter namesFriedemann Kleint2021-04-231-0/+26
| | | | | | | | Strip the parameter names from the modification signature so that it matches the C++ type signature. Change-Id: I8ca4e124e3c579d222d52f949f0d01b44eae92bf Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Join Modification into FunctionModificationFriedemann Kleint2021-04-131-77/+56
| | | | | | | | This completes b69d8899b1c592aa9a6cdfa43da3137af3fa16de, separating the modification classes. Change-Id: I7a8436facbce8a4ef8872b3867b21d62ae07fab7 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: No longer crash on fatal errorsFriedemann Kleint2021-03-101-2/+6
| | | | | | | | | | | | | shiboken has some fatal errors which are too deeply nested to catch with return values. Introduce exception handling to handle this. Add an exception class and replace the existing qFatal() calls by a exceptions. Wrap a try/catch around main() and the tester helper. Change-Id: I03243849dc299f7696ef73d9d4123480ac5cbd66 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Add support for a snake case typesystem attributeFriedemann Kleint2020-12-071-0/+24
| | | | | | | | | | | | | Add a snake case attribute to type system, complex type entry, function type entry as well as to function and field modifications. Add a function definitionNames() to AbstractMetaFunction/Field returning the names under which the function/field will be registered. Change the code writing the registration accordingly. Fixes: PYSIDE-1441 Change-Id: I178390bb80fa25aad9f8a56e99e4cc70064178eb Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Use a QSharedDataPointer for ArgumentModificationFriedemann Kleint2020-12-031-18/+192
| | | | | | | | | For reasons of consistency and header hygiene. As a drive by, remove unused argument modification replace-value. Change-Id: I44d0a244c89f2bf10242544111d23e072df3b480 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Simplify handling of removed attributeFriedemann Kleint2020-12-021-8/+8
| | | | | | | | | | | | The meaning of the TypeSystem::Language enumeration value on the remove elements was unclear; and it is only ever used with 'all'. Replace it by a boolean value and simplify the code accordingly. Adapt the documentation. Change-Id: I82d082e6d551403642936294a11abbac09d723dd Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Refactor field modificationsFriedemann Kleint2020-12-021-0/+82
| | | | | | | | | | | Decouple class FieldModification from the base class Modification since it does not need its attributes and turn in into a value class using QSharedDataPointer for consistency with FunctionModification. Remove some unused code and simplify removed handling. Change-Id: I9997559acd529bd070df5ff84610fe75c74a71a5 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Refactor code snip query functionsFriedemann Kleint2020-11-161-0/+5
| | | | | | | | | | | | Move most code snip query functions to AbstractMetaFunction, using a template function taking a predicate to avoid building a list of all snippets on every invocation. injectedCodeCallsCppFunction() remains in ShibokenGenerator as it depends on the GeneratorContext, but can use the new helpers. Change-Id: I06c5f8a36d977a3006e2c4e43afa9f3988cbe97b Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Port Modifications to use QSharedDataPointerFriedemann Kleint2020-11-121-40/+230
| | | | | | | | For caching in AbstractMetaFunction, they should be lightweight to copy around. Change-Id: Ic54293fcaf25ffe05f6930111870b2546f907d17 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Remove <argument-map> and "associated-to"Friedemann Kleint2020-11-111-10/+1
| | | | | | | | | | The element <argument-map> appears to be related to code snippets, but it is neither documented nor used anywhere. The attribute "associated-to" is also unused. Change-Id: Ib567d5391d0ee5284db5a38db4a4e803bf569ef4 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Replace AddedFunction::TypeInfo by TypeInfoFriedemann Kleint2020-11-091-126/+53
| | | | | | | | | | | | | | | | | | AddedFunction::TypeInfo was a stripped-down version of the code model's TypeInfo with its own, simplified parser. Replacing it by TypeInfo allows for removing the parser code and the entire AbstractMetaBuilderPrivate::translateType(AddedFunction::TypeInfo) branch. The more powerful TypeParser from the code model can then be used, allowing for more complex types in <add-function> or <declare-function>. As a drive by, replace the AddedFunction constructor by a static factory function, allowing to pass up parse errors. Change-Id: I33ad19e9b5ed30bd27898afe771401ddc98c8c73 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Add a new parser for AddedFunction parametersFriedemann Kleint2020-11-091-0/+110
| | | | | | | | | | | Observe' <' (templates), '{' (initializer lists), '[' (array dimensions) and '(' (initialization, function pointers) when splitting the parameter lists of added functions. Add a test. Change-Id: I8cdc135a2daceab5587c4b5545ed38f0a022b5f8 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Split out modification classes from typesystemFriedemann Kleint2020-11-061-0/+471
Change Modification::Modifiers to be a QFlags and remove unused functions. Change-Id: Ia4a6b9ef06415275b33891cb04772780cd7f2d65 Reviewed-by: Christian Tismer <tismer@stackless.com>