aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/generator/shiboken/headergenerator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* shiboken6: Port class FileOut to use exceptionsFriedemann Kleint2021-06-211-7/+8
| | | | | | | Complements f7901b0b29e831a3799bd7fc39dbdf5e67271ae8. Change-Id: I1d04ffd8f4b28c095b2def08075068dcdebba099 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Fix duplicate indexes for template instantiationsFriedemann Kleint2021-06-161-2/+29
| | | | | | | | | | | | | | | | | | | | | | For a typedef "using Foo=QList<int>", shiboken generates SBK_QLIST_INT besides SBK_FOO which is then matched by function arguments. The code was however missing a check to restrict this to typedefs, so it triggered for class Alternative : public QVariantList, class Sequence : public QVariantList producing duplicate indexes. Restrict this to real typedefs (which are also represented as classes. Split out the function creating the special alternate index for clarity and add a check for potential equivalent typedefs which would also produce clashes. Pick-to: 6.1 Task-number: PYSIDE-1571 Change-Id: I9275963c4ddb8fc589e414ee1fa19282f6004793 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Introduce a private attributeFriedemann Kleint2021-06-091-8/+56
| | | | | | | | | | | Generate a separate, private module header containing classes marked as "private" in the typesystem. This can be used for classes that are not used in dependent modules and helps to prevent propagation of for example private headers required for them. Task-number: PYSIDE-802 Change-Id: If7f19c152d007c689bf719e13292107dceb802da Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Remove AbstractMetaAttributesFriedemann Kleint2021-02-191-1/+1
| | | | | | | | | | | | Remove AbstractMetaAttributes as a base class of AbstractMetaFunction and AbstractMetaClass. Split the Attributes enumerations into those applying to classes and functions, respectively and add them to AbstractMetaFunction and AbstractMetaClass. Change-Id: Ie60517876af4096fd6234479ee7dc7fbcca1eda6 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Enable building with --avoid-protected-hack for gcc, clangFriedemann Kleint2021-02-041-2/+3
| | | | | | | | | | | | | | | | Disable the C++ wrapper generation for classes with private destructors for these compilers. Fix one additional condition overlooked by 1d044f467070a040713c9566a8a8de3a56c571e7. With that, it is in principle possible to build with g++ and --avoid-protected-hack except for the PrivateDtor shiboken test, which tests accessing protected methods for classes with private destructors. Task-number: PYSIDE-1202 Task-number: PYSIDE-504 Change-Id: Ie40ad56c913dd544303aa7d795e80282afb43705 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Simplify handling of protected enumsFriedemann Kleint2021-02-041-2/+19
| | | | | | | | | | | | In case the protected hack is disabled, make protected enums publicly accessible by writing a "using" directive into the wrapper class. The module init code still needs the surrogate enum for the conversion functions. Change-Id: I81977c0e181b06af3c0ab67ed37486639a163bc4 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Simplify handling of protected fieldsFriedemann Kleint2021-02-041-34/+10
| | | | | | | | | | | In case the protected hack is disabled, make protected fields publicly accessible by writing a "using" directive into the wrapper class instead of generating accessor functions. They can thus be treated like normal fields accessed via wrapper class, saving some generated code. Change-Id: I44854a0cb324d0d4e27bb56b0c5f5a879af04701 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Fix inline wrapper being generated for the wrong classFriedemann Kleint2021-02-021-52/+47
| | | | | | | | | | | | | | | When generating the inline wrappers in the header, the implementing class should be used instead of the owner, otherwise things can go wrong in case of multiple inheritance (for example function setProperty() being inherited from QObject and QDesignerPropertySheetExtension). Since the code writing such a wrapper is duplicated in HeaderGenerator, move it to a separate function. Task-number: PYSIDE-1455 Change-Id: I9481d0d64802ac2c9251759958fb8345863d6889 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Make more functions static using clang tidyFriedemann Kleint2021-01-231-2/+2
| | | | | | | | | Apply the fix created by clang tidy' -wreadability-convert-member-functions-to-static warning with some manual correction. Change-Id: I394bd96881fa25dbcb7a725b79d10395fcbb8676 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Make more generator functions staticFriedemann Kleint2021-01-211-1/+2
| | | | | Change-Id: Ief8aa743f47216e728a241a7cd4de360271c5568 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6/ApiExtractorResult: Use const AbstractMetaClass * for the class listFriedemann Kleint2020-12-221-3/+3
| | | | | | | | | | Add the missing overloads of AbstractMetaClass::findClass() and adapt some types. Pick-to: 6.0 Change-Id: I65851248b4b6a2e1d4f57fc58ecaf75fb4c00b29 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* shiboken6: Introduce class ApiExtractorResultFriedemann Kleint2020-12-221-11/+15
| | | | | | | | | | | | | | Separate the generators from ApiExtractor by introducing a class ApiExtractorResult storing the results of an ApiExtractor run. Move some query functions there. With that, some generator functions can already be made static by passing the ApiExtractorResult and OverloadData can be decoupled from the generator. Pick-to: 6.0 Change-Id: Iaba3ebff4aecb722eec4a606423738260983d905 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Store AbstractMetaFunction using a QSharedPointerFriedemann Kleint2020-11-301-6/+5
| | | | | | | | | | | | | | | | | | Store the list functions (global / class member) as a QList<QSharedPointer<const AbstractMetaFunction> instead of a raw pointer list. This makes passing around function lists easier and solves the memory leaks caused by mixing cloned and unmodified functions while collecting the overload lists in the generators. - Change the function signatures accordingly - Add a qSharedPointerConstCast() for non-const access. - Restructure the traversing of added functions in the AbstractMetaBuilder - Remove some unused typedefs and functions unearthed by the change Change-Id: I08a6c5243750e3eb3813bc3f7172899ad2b13e22 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Replace QVector by QListFriedemann Kleint2020-11-251-3/+3
| | | | | | | | | | | | | | | | Change AbstractMetaClass::templateArguments() to return TypeEntries (const TypeEntry *) instead non-const. Remove redundant typedef OverloadData::MetaFunctionList. Use existing typedefs in some places. Add new typedefs for MetaObjectBuilder::EnumValues and AbstractMetaFunctionCList. Change-Id: Ia241b5fbe54d60ea57175fb1f6c844604e066a3d Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Introduce a new Text streamFriedemann Kleint2020-11-251-73/+58
| | | | | | | | | | | | | | | | | | | Add a new text stream wrapping QTextStream with built-in indent. This removes the need to have INDENT as a separate member variable or function parameter and to output it at the beginning of each line. It also makes it easier to factor out the write() functions since they no longer need the indent. Make the write* functions const where possible. The doc generator is left as-is for the moment. Rename the old Indentation to Indentation4 to avoid conflicts. Change-Id: I6866e7360df119859adeee567d2b18a37cb63a79 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Move further C++ check functions from the generators to MetaLang*Friedemann Kleint2020-11-171-1/+1
| | | | | Change-Id: I14fe14a2c7a5efff01dcd34bc1682cd8e264ab86 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Qualify the generator functionsFriedemann Kleint2020-11-161-7/+7
| | | | | | | Mark them as static or const where applicable. Change-Id: Ia8b9fd876c9b871163fd5af251ba8b31f337bd01 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Port AbstractMetaEnum/Value to use QSharedDataPointerFriedemann Kleint2020-11-111-24/+19
| | | | | | | | Change the client code to store it by value. For the various find() and traverseEnum() functions, use a std::optional to replace the pointer. Change-Id: Ie4e671bf95e569741fa3c9a399bfe239ceac0dec Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Port AbstractMetaField to use QSharedDataPointerFriedemann Kleint2020-11-101-6/+5
| | | | | | | | | | Fold AbstractMetaVariable into AbstractMetaField and use a QSharedDataPointer for it. Change the client code to store it by value. For the find() and traverseField() functions, use a std::optional to replace the pointer. Change-Id: Ibaa301b9aaae8851fcaa077327235cc5aaad7342 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Introduce a private class hierarchy for TypeEntryFriedemann Kleint2020-11-101-0/+1
| | | | | | | | | | | | | | | | | Move the data members of the TypeEntry classes to private classes, using convenience macros modeled after Qt's Q_D macro. The main motivation here is header hygiene and decoupling; typesystem.h was including a lot of classes. This requires moving some code around: - Move the debug formatting helpers of the TypeEntry classes from typedatabase.cpp to typesystem.cpp. - Move struct TypeRejection to typedatabase.h - Reorder typesystem.cpp in order of declaration. Change-Id: I24fe501d98940afd44caf75057cd6131cfbd6b6e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Split the abstractmetalang headers and sourcesFriedemann Kleint2020-11-061-0/+3
| | | | | | | | Split out enums, fields and functions. Only AbstractMetaClass remains in abstractmetalang.h. Change-Id: I49846f92fafc5969d83aa4a1767eb4ac23f39d1c Reviewed-by: Christian Tismer <tismer@stackless.com>
* Rename shiboken2 to shiboken6Friedemann Kleint2020-10-281-0/+661
Adapt CMake files, build scripts, tests and examples. Task-number: PYSIDE-904 Change-Id: I4cb5ee4c8df539546014b08202a7b1e98ed3ff07 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>