aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/parser
Commit message (Collapse)AuthorAgeFilesLines
* Move the shiboken-generator source aroundFriedemann Kleint2025-11-248-3381/+0
| | | | | | | | | THIS COMMIT WAS GENERATED BY A SCRIPT Task-number: PYSIDE-962 Task-number: PYSIDE-1587 Change-Id: I58b05c3d05606efb6303193f2d7f907a0ab5741b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken6: Fix clazy warnings about too-large underlying types of enumerationsFriedemann Kleint2025-10-023-11/+11
| | | | | | | Use the types suggested by clang-tidy. Change-Id: I0bc80d00e75305423caa4254b1383979e89128ec Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6/code model: Add a type category roughly modelled after libclang's ↵Friedemann Kleint2025-09-175-9/+50
| | | | | | | | | | | | CXType_Kind Use what clang considers to be the "canonical" type for a category enumeration. This is useful for follow-up changes to simplify type resolution. Pick-to: 6.10 Change-Id: Ic9f23308cf6bf4b5b29f3c2fff119cba58f3ac1e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6/code model: _TypeDefModelItem: Add accessFriedemann Kleint2025-09-172-1/+15
| | | | | Change-Id: I45eaf7f67588fd7c25ff2eab959d2470e62c6e87 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Remove unused code paths for Q_ENUMFriedemann Kleint2025-09-152-14/+1
| | | | | | | | | | | There was apparently some code path checking whether an enum had a Q_ENUM declaration; but the value was not used and the clang parser no longer determines it. Remove it. Pick-to: 6.10 6.9 6.8 Task-number: PYSIDE-323 Change-Id: I486c68e0980a03ee8c6a9b8e5656e5697df63c4e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6/code model: Add utility function returning the qualified name as ↵Friedemann Kleint2025-09-152-0/+6
| | | | | | | | | string Pick-to: 6.10 6.9 6.8 Task-number: PYSIDE-323 Change-Id: I7388966bf35cd4f8d569049464450cc0ceba9615 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Fix passing QFlags by const-refFriedemann Kleint2025-05-232-14/+29
| | | | | | | | | | | | | | | The type resolution code searched the result of TypeInfo::toString() in the type database, which may contain qualifications like "const Foo &". To fix this, add a function returning the name with instantiations only and use that. As a drive-by, add a convenvience function returning the qualified name as a string and simplify the code accordingly. Pick-to: 6.9 Change-Id: I071e8dc3f65257e300007d53688c442a683813e1 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Allow for building with Clang 14 (Yocto)Friedemann Kleint2025-04-301-1/+15
| | | | | | | | | | | | | | | Replace clang functions clang_CXXMethod_isCopyAssignmentOperator() and clang_CXXMethod_isMoveAssignmentOperator() by a manual check function depending on clang version. Amends 6410710ab9580f71ab58ac38e67d74bbde5dbce4. Complements b887919ea244a057f15be9c1cdc652538e3fe9a0. Fixes: PYSIDE-3091 Task-number: PYSIDE-3004 Pick-to: 6.9 Change-Id: I18b073e7fe572ffe8b4635a26cec45b0b6adbac3 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Port to Qt include styleFriedemann Kleint2025-03-277-21/+20
| | | | | | | | | Replace the Qt forwarding headers by the .h files. This brings down the dependency list by approx 6%. Pick-to: 6.9 Change-Id: Iaa57400fd20600b940119a6016041b885a68d207 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Handle further class special functionsFriedemann Kleint2025-02-112-0/+8
| | | | | | | | | | | | | | | | - Obtain (copy) assignment operators from libclang and introduce another function type for assignments from other types, which do not impact copy-constructibility. - Handle deleted assignment/move assignment. - Add function query operators. - Disable adding of implicit copy constructor when assignment/move is present. Testing follows in a subsequent patch. Task-number: PYSIDE-3004 Change-Id: I11451bada3f970fb76e80b8ee76e1406441bb9db Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Fix some clang-tidy warningsFriedemann Kleint2025-02-032-3/+1
| | | | | | | | | | | | - Fix invocation of static functions - Use std::any, range-based for where applicable - Use std::make_shared instead of new - Replace QByteArrayLiteral() by literal - Use const-ref to avoid copies Pick-to: 6.8 Change-Id: Iec864bd6eee8fb06f5afd122084a9e0f551ff8f1 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Fix clang-tidy warning about using std::any_of instead of loopsFriedemann Kleint2024-06-241-5/+4
| | | | | Change-Id: Ic85973e29870456bf422a3ac75fd9d68524ad886 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Fix static analysis warningsFriedemann Kleint2024-06-245-29/+29
| | | | | | | | | | | | | | | | | | - Initialize variables - Use auto * - Use const references to prevent copies - Remove const from function returns - Remove repeated return types - Fix else after return/throw - Make functions const/static where appropriate - Add missing override - Fix some invocations of static methods - Fix some int types (qsizetype) to avoid lossy conversions - Minor cleanups - Remove some macros Change-Id: I414b8451703b136f135383289de49e743e84fb3a Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Extract common C++ function attributesFriedemann Kleint2024-04-173-90/+26
| | | | | | | | | | | | | | | | Extract attributes common to C++ functions from AbstractMetaFunction's attributes to a flags type in codemodel_enums.h for re-use in AbstractMetaFunction, FunctionModelItem and AddedFunction. A lot of boolean setters and getters can then be removed and the flags easily transferred from code model to the meta language code. Task-number: PYSIDE-2602 Pick-to: 6.7 Change-Id: I9da1bb0d70051cd6bb3113290e8ccedfe4d13908 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Remove unused function modificationsFriedemann Kleint2024-04-172-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: Register typedefs of container typesFriedemann Kleint2024-03-182-0/+8
| | | | | | | | | | | | | | | | | | 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>
* Use new comparison helpers for equality in shiboken/libpysideFriedemann Kleint2024-03-014-18/+17
| | | | | | | | | Task-number: QTBUG-103757 Task-number: PYSIDE-2497 Change-Id: I1b0fd5b1cad908ee612ab33ca0aacffc55947d87 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Replace <QtCore/QtGlobal> by respective smaller headersFriedemann Kleint2024-01-251-1/+2
| | | | | | | Task-number: QTBUG-99313 Task-number: QTBUG-97601 Change-Id: I2422a995d73f19e385c73d54410004f7b8f9d77b Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Remove some further uses of QStringLiteralFriedemann Kleint2023-11-291-2/+1
| | | | | | Task-number: PYSIDE-2537 Change-Id: Ie71b17eec385b31842d6693b3492db565d479fd0 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Remove inline functions using QStringLiteralFriedemann Kleint2023-11-292-7/+4
| | | | | | | | | | 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 CodeModel::find*() helpers to QAnyStringViewFriedemann Kleint2023-11-272-48/+32
| | | | | | | | As a drive-by, replace some old find predicates by lambdas. Task-number: PYSIDE-2537 Change-Id: I2fbb3f86f87a497f2aa7d22d666ae2d3aa641364 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Fix special functionsFriedemann Kleint2023-10-051-1/+12
| | | | | | | Pick-to: 6.6 Task-number: PYSIDE-2479 Change-Id: I858b53e45cf73d1fa8d695530e529aed7aa8e79b Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Replace QPair by std::pairFriedemann Kleint2023-09-293-3/+7
| | | | | | Pick-to: 6.6 6.5 Change-Id: Ic64a2a2c162c54fbbfb6ddc5004ffe1944bfd37a Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Fix some clang-tidy warningsFriedemann Kleint2023-09-203-11/+9
| | | | | | | | | | | | | | | | - 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-192-5/+4
| | | | | | | | | 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: Streamline/Improve enum codeFriedemann Kleint2023-07-032-0/+24
| | | | | | | | | | | | | | - Remove ShibokenGenerator::getSimplifiedIntTypeName() (which made assumptions on the width of int/long), use plain type names instead. - Use const arrays - Streamline the formatting with some helper functions Amends 895c452fd874fe4dfeb5a44e8c959136ceedba13. Task-number: PYSIDE-1735 Change-Id: Icab3327a282ec3402e04f4fdffa5ffd64b2d3a8f Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Change the debug output for enums with flags to hexFriedemann Kleint2023-06-272-0/+9
| | | | | | | Task-number: PYSIDE-1735 Task-number: PYSIDE-2088 Change-Id: I96d2cde0b4b933151e839a236e62efb1115015b8 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Cast enum values to unsigned custom types in meta builderFriedemann Kleint2023-06-242-0/+11
| | | | | | | | | | The EnumValue will then reflect the proper value. Task-number: PYSIDE-2088 Task-number: PYSIDE-1735 Change-Id: I9543d71417b72c98c63a97f1a53443501097ef9a Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Add the underlying type to AbstractMetaEnumFriedemann Kleint2023-06-202-0/+14
| | | | | | Task-number: PYSIDE-1735 Change-Id: I7733c93baffa1396d5a43b68069e9e8848e9fe49 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6/clang: Record scope resolution of arguments/function returnFriedemann Kleint2023-04-282-0/+33
| | | | | | | | | | | | | Add a flag indicating whether a type was specified with a leading "::" (scope resolution). Such parameters previously caused the function to rejected due to the "::TypeName" not being found. The type resolution added for clang 16 strips these qualifiers though, so, the information needs to be stored. Task-number: PYSIDE-2288 Pick-to: 6.5 5.15 Change-Id: I27d27c94ec43bcc4cb3b79e6e9ce6706c749a1e9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Refactor code model classesFriedemann Kleint2023-04-282-56/+137
| | | | | | | | | | Use member initialization and use base class constructors. De-inline constructors to avoid bloat. Pick-to: 6.5 5.15 Task-number: PYSIDE-2288 Change-Id: Iea0474d4972d9bf5cfa501ac04d829e9801e98e3 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Parse const from template parameters (unexposed types)Friedemann Kleint2023-01-061-0/+4
| | | | | | | | | | For types returned as "unexposed" by clang, shiboken parses the template type as string. Handle "const" in that case (for std::span<const int>). Task-number: PYSIDE-2174 Change-Id: I8c2a3b5e936e3d6cb4c3f906457d54bfde2d17cb Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Port from QSharedPointer to std::shared_ptrFriedemann Kleint2023-01-054-29/+30
| | | | | | | 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/generator: Fix CMake UNITY_BUILD (jumbo)Friedemann Kleint2022-12-162-30/+2
| | | | | | | | - Use a string literal for "::" - Add a header for debug helpers Change-Id: I605a00fea1b936032afa93d9be45b7da31d42473 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Purge remaining uses of old Qt string literalsFriedemann Kleint2022-11-221-3/+5
| | | | | | | | | | Amends a3e882b06eda8f9a63cf3834a99640034775269b. Pick-to: 6.4 Task-number: QTBUG-98434 Change-Id: I23ad60d6e4201aa2d8dbf3fa8892d3df3c56c5fc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Port some loop variables to qsizetypeFriedemann Kleint2022-10-133-15/+15
| | | | | | | | 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>
* Port from qAsConst() to std::as_const()Friedemann Kleint2022-10-131-1/+1
| | | | | | | | qAsConst() will be deprecated in Qt 6.5. Task-number: QTBUG-99313 Change-Id: Ibc7c2e26b0e52cec905a406ef081e0b99bcce50f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Propagate C++ enum deprecationFriedemann Kleint2022-08-224-4/+43
| | | | | | | | | | | | | Add AbstractMetaEnum::isDeprecated() and AbstractMetaEnumValue::isDeprecated() which are set by the clang parser for deprecated enums and values (for example, QVariant::Type). As a drive-by, streamline the debug output of the enums, removing the repretitive EnumValue type name. Task-number: PYSIDE-1735 Change-Id: I4c98965ca4a948f5f084f781914194e5bf4d4ea2 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Implement the spaceship comparison operator of C++ 20Friedemann Kleint2022-06-212-1/+9
| | | | | | | | Synthesize all comparison operators if one is found in the code model. Task-number: QTBUG-103757 Change-Id: I78fbcd93bc4cd172266f9dd0dbb2ebcf3a8bb7f2 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Use SPDX license identifiersLucie Gérard2022-05-278-221/+21
| | | | | | | | | | | 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: Remove deprecated QLatin1StringFriedemann Kleint2022-04-251-11/+15
| | | | | | | | | | 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-4/+4
| | | | | | | | | | 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-252-17/+12
| | | | | | | | | 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: Fix comparison operators in namespacesFriedemann Kleint2022-03-222-0/+27
| | | | | | | | | | | | | | | | Change qtbase/e7fd9a9f4ab1fcc017174d6d7760c731857b89fc introduced some mixed flag operators in Qt which caused compile errors. They should be ignored by traverseOperatorFunction() since they cannot be attributed to any class, but traverseOperatorFunction() was only called for the global namespace. Fix by calling it for operator functions in namespaces as well. Task-number: QTBUG-99948 Pick-to: 6.2 Change-Id: I57419563f10f1a0d33aea027a166119f969bca5d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Port code to use size() instead of count() of Qt containersFriedemann Kleint2022-03-172-5/+5
| | | | | | | | | | | count() will be deprecated. Fix some integer types in loops and modernize code in changed lines. Pick-to: 6.2 Change-Id: Idf21927661ea6c8866ee36e7c623043271e21620 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Add internal flags to AbstractMetaFunctionFriedemann Kleint2021-12-162-0/+14
| | | | | | | | | | | | Add some internal flags useful mainly for documentation indicating: - whether AbstractMetaBuilder removed operator arguments, which is useful for the documentation. - the function was inherited from a (container) template - the function was declared a hidden friend Task-number: PYSIDE-1106 Change-Id: Id31b1448a084f45ab7b3191b28c952d0226816e7 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Implement enum search by value in code modelFriedemann Kleint2021-11-052-2/+114
| | | | | | | | | | | | | | | | | | | | | | | | Replace (currently unused) AbstractMetaBuilder::searchForEnumScope() by _ScopeModelItem::findEnumByValue() returning an enum and the fully qualified name. This function is intended for resolving enum values used as default values for functions taking int where the underlying enum is not known. As opposed to old code, all parts of a (partially) qualified name are checked for a match to ensure no mismatches of equally named values. Another advantage is that also enum values that are not in the type system are found. The function returns the fully qualified name (also including the enum name for non-class type enums). Task-number: PYSIDE-1691 Pick-to: 6.2 Change-Id: I89ebfdf8435470c626cfdee4fc0d0738cc3fc195 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Store pointer enclosing scope in code model itemsFriedemann Kleint2021-11-042-0/+22
| | | | | | | | | | | Store a flat pointer to the enclosing class in _ScopeModelItem. This is needed for implementing enum resolution in the code model directly. Task-number: PYSIDE-1691 Pick-to: 6.2 Change-Id: Ic44edb5f121503990044faa4bc6db65220d81c51 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Store a pointer to base classes in the code modelFriedemann Kleint2021-11-042-9/+2
| | | | | | | | | | | | Extend the struct _ClassModelItem::BaseClass by an optional ClassModelItem pointing to the class directly and populate it by the builder. This is needed for implementing enum resolution in the code model directly. Task-number: PYSIDE-1691 Pick-to: 6.2 Change-Id: I1abce6cbb777384ccbb187e79c09b5cb9da1563b Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Handle enums without valuesFriedemann Kleint2021-10-182-0/+20
| | | | | | | | | | | | shiboken used to ignore enumerations without values assuming they were just forward declaration of an enum classes. It turns out that there are such cases (QCborTag). To fix this, add empty enums always and replace them by the ones with values. Task-number: PYSIDE-1691 Pick-to: 6.2 Change-Id: I5de69f86ed45bd9f239e6d6017e7dc4a554f5378 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>