aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/typesystem.h
Commit message (Collapse)AuthorAgeFilesLines
* shiboken: Add debug output for function modificationsFriedemann Kleint2018-11-241-0/+15
| | | | | | Task-number: PYSIDE-834 Change-Id: I2530b44f704ef96b784a77512f71777d9fd492bb Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Fix crash when garbage collecting in a non-GUI threadFriedemann Kleint2018-10-151-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | If a GUI class happens to be detected unreferenced when garbage collecting in a non-GUI thread and is subsequently deleted, crashes can occur for QWidgets and similar classes. The hitherto unimplemented delete-in-main-thread" attribute should be used. Add the missing implementation. Add the field to shiboken's type entry and SbkObjectTypePrivate class and pass it via newly introduced flags to introduceWrapperType(). Defer the deletion when invoked from the background thread and store the list of destructors in a list in binding manager run by Py_AddPendingCall(). Task-number: PYSIDE-743 Task-number: PYSIDE-810 Change-Id: Id4668a6a1e32392be9dcf1229e1e10c492b2a5f5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add exception handlingFriedemann Kleint2018-09-271-0/+9
| | | | | | | | | | | | | Add XML elements specifying an exception handling mode to type system, complex type entries (classes) and function modifications. From the mode and the exception specification as detected by Clang, deduce whether to generate try/catch code. Task-number: PYSIDE-62 Change-Id: Ib76adc21cefd81bf9f82f819a3c151056c33a3b7 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Initialize pointer members of TypedefEntryFriedemann Kleint2018-09-211-2/+2
| | | | | | | | Amends 2bfd1de3495b18c0ecc251260442a9a46009861e Task-number: PYSIDE-725 Change-Id: I4adb9022feee954ca65dc60f07bf71bd9b92dc11 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Improve handling of non-type template integer parametersFriedemann Kleint2018-09-131-1/+2
| | | | | | | | | | | | | | When trying to specify the base class template<int R, int C> QGenericMatrix of the QMatrixRxN classes, clashes of the SBK..IDX enumeration values occurred since the integers were not part of the type name. Fix that by dynamically adding dummy entries of EnumValueTypeEntry for the integer values encountered on the fly. Task-number: PYSIDE-725 Change-Id: Ie6b4489b5293e04b7c2c76861341c99b136cd558 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Store null enum valuesFriedemann Kleint2018-09-121-0/+6
| | | | | | | | | | | | | If an enum has a null value, store that on the EnumTypeEntry for use in Generator::minimalConstructor() as a default value. Fully qualify scoped enum value type entries for this purpose. The value can then be used for default values instead of an ugly static_cast<EnumType>(0). Task-number: PYSIDE-62 Change-Id: I42cb2ca63fb1da6c795df630ab30bded66aac901 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Add a typedef typesystem entryFriedemann Kleint2018-09-051-1/+36
| | | | | | | | | | | | | The intention is be able to specify typedef std::optional<int> OptionalInt in the typesystem file and generate code for it (without having a typedef in C++). Task-number: PYSIDE-725 Change-Id: I5847a3c3f68556ac1d0ea3635f65a29caa6cb208 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Add clone() to the typesystem entry classesFriedemann Kleint2018-09-051-1/+94
| | | | | | | | | | This is a prerequisite for adding a typedef entry. Add copy constructors and clone() methods. Task-number: PYSIDE-725 Change-Id: I7cee679432be70e2349071f1dd62335fda564fe3 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Replace some character #defines by char constantsFriedemann Kleint2018-09-041-2/+2
| | | | | | | | | | | | | | | Change defines to variables where possible (not used in string literal concatenations). Remove constants only used in one file from the header. Change regular expressions to raw string literals for clarity. Replace static instance of the CONVERTTOCPP regular expressions by an accessor of ShibokenGenerator. Change PATH_SPLITTER in main.cpp define to a QChar constant. Change-Id: If6766e0467ca2c635788240414c984d60feef875 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Remove data fields representing unimplemented attributesFriedemann Kleint2018-08-301-93/+1
| | | | | | | | | Remove member variables and enumeration values. Task-number: PYSIDE-743 Change-Id: Id7bff33b180e99e19d02bd895e45e4f0749dc042 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* shiboken: Fix the allow-thread attribute to actually have an effectFriedemann Kleint2018-07-251-9/+6
| | | | | | | | | | | | | | | | Previously, calls to BEGIN_ALLOW_THREADS/END_ALLOW_THREADS were always generated since the value of XML attribute was not used. Fix it to actually use the value. Since having it default to "no" caused a number of deadlocks (related to thread functions or functions calling a virtual function (potentially reimplemented in Python), introduce "auto" as default value. "auto" turns off BEGIN_ALLOW_THREADS/END_ALLOW_THREADS for simple getter functions. Task-number: PYSIDE-743 Change-Id: I4833afef14f2552c75b3424417c2702ce25cb379 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Add debug output for container typesFriedemann Kleint2018-07-241-0/+3
| | | | | Change-Id: Ied74ec8ca7e3b3c439204c5010b0b727be3b13b2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Refactor attribute parsing in typesystem parserFriedemann Kleint2018-07-191-1/+2
| | | | | | | | | | | | | | | | | | | | | Split up the 1400 lines Handler::startElement() function into smaller helper functions. Previously, the function populated a hash with the default values of all attributes. The values were then set by fetchAttributes() from the XML attributes and applied later on. In this setup, it is not possible to add deprecation warnings since it not possible to tell which attributes were actually present in the file. Change this to operate on the QXmlStreamAttributes list from which the consumed options are removed. Add a warning about unused attributes. It is now possible to add deprecation warnings and the default values are now more obvious. Task-number: PYSIDE-743 Change-Id: I1ee04e9490b3664bba4c976fe654183819610b58 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Refactor attribute enumeration lookups in parserFriedemann Kleint2018-07-191-20/+2
| | | | | | | | | | | | Replace the static QHashes in Handler::startElement() and other places which required converting and lower-casing the QStringRef's returned by the QXmlStreamReader by lookup functions that take a QStringView, which can be constructed from QString or QStringRef. Task-number: PYSIDE-743 Change-Id: I10234f2ddfff13ee7e0ee67f9aee118a088e5ab8 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Improve debug output of TypeEntry classesFriedemann Kleint2018-07-161-0/+10
| | | | | | Task-number: PYSIDE-743 Change-Id: Ie4794c6387ef5ffaf8a5813b744fa725427b5f09 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Make revision and SBK index a member of TypeEntryFriedemann Kleint2018-07-131-0/+7
| | | | | | | | | | | | | | | | | | They were previously stored in a global hash, apparently due to BC issues. Replace the global set/getTypeIndex/Revision functions by member functions of TypeEntry in typedatabase.cpp. As a drive-by change, simplify the code assigning the SBK numbers to use a flat list of entries ordered by revision and name instead of a grouped hash (bearing in mind that revision is rarely used) and might be removed one day). Also replace the use of std::unique() by the !contains()/append() pattern since std::unique() assumes an ordered list which is likely not the case. Task-number: PYSIDE-725 Task-number: PYSIDE-743 Change-Id: I9356acf1f5795446c08f266c1323f1db65cd490c Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Remove global-static hashes used for members of TypeEntryFriedemann Kleint2018-07-131-0/+2
| | | | | | | | | | | TypeEntry::customConversion and ComplexTypeEntry::defaultConstructor where previously stored in global-static hashes, apparently due to BC issues. This can now be fixed. Task-number: PYSIDE-725 Task-number: PYSIDE-743 Change-Id: If4f28246a5b83e3772021a518058a9d152bb3e3f Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Make targetLangPackage() a normal property of TypeEntryFriedemann Kleint2018-07-131-19/+3
| | | | | | | | | | Normally, only the root typesystem element has a package specification; there is no need to have virtual functions for it. Task-number: PYSIDE-725 Task-number: PYSIDE-743 Change-Id: I3b86c8418cf16ce372c1953279a115e2eff0e984 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Remove unused TypeEntry classesFriedemann Kleint2018-07-131-38/+0
| | | | | | | Task-number: PYSIDE-725 Task-number: PYSIDE-743 Change-Id: I61fcd8af7329c14ef064795c13787005b4375548 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Improve error message about missing function for modificationFriedemann Kleint2018-06-221-0/+4
| | | | | | | | | The signature is passed through TypeDatabase::normalizedSignature() which calls QMetaObject::normalizedSignature(). Keep the original signature and output it in the error message. Change-Id: Ibd1ddd0dee17d828710caf4bf6d674c35776b4c2 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Change license from all the filesCristian Maureira-Fredes2018-05-031-1/+1
| | | | | | | | | | | | | | | | | Removing the word 'project' from all the headers, and changing the PySide reference from the examples to Qt for Python: The following line was used inside the source/ and build_scripts/ directory: for i in $(grep -r "the Qt for Python project" * |grep -v "pyside2-tools" | awk '{print $1}' | sed 's/:.*//g');do sed -i 's/the\ Qt\ for\ Python\ project/Qt\ for\ Python/g' $i;done and the following line was used inside the examples/ directory: for i in $(grep -r "of the PySide" * |grep -v "pyside2-tools" | awk '{print $1}' | sed 's/:.*//g');do sed -i 's/of\ the\ PySide/of\ the\ Qt\ for\ Python/g' $i;done Change-Id: Ic480714686ad62ac4d81c670f87f1c2033d4ffa1 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
* Rename PySide references to Qt for PythonCristian Maureira-Fredes2018-04-271-1/+1
| | | | | | | | | When referring to the project one should use "Qt for Python" and for the module "PySide2" Change-Id: I36497df245c9f6dd60d6e160e2fc805e48cefcae Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Detect class enums by Clang entirelyFriedemann Kleint2018-04-191-13/+0
| | | | | | | | | | | | | | The Clang function clang_EnumDecl_isScoped() tells whether an enum is a class, so, there is no need to specify that in the typesystem. Use that information to pass it up to the metalang classes and revert the parts of 44cb6c51e6c3b43376f284941454dc8c13b81c3f that added it to the type system. Task-number: PYSIDE-487 Change-Id: Ie10885f74168821d0307e91b6f1f7f3f30dd074b Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* siboken/Typesystem: Replace double used for versions by QVersionNumberFriedemann Kleint2018-03-201-28/+26
| | | | | | | | | | | | | - Change TypeSystemEntry::m_version from double to QVersionNumber. - Determine version at the beginning of the start element processing of the parser and use that. - Remove AddedFunction::m_version which is not needed. - Remove unused parameter double vr from AbstractMetaBuilderPrivate::translateType(). Change-Id: I2941667ba565f8c11aa0c14446ec7d6934da99dc Reviewed-by: Christian Tismer <tismer@stackless.com>
* Type system: Add attribute indicating C++ 11 enum classesFriedemann Kleint2018-02-281-10/+13
| | | | | | | | | | | | | Introduce enumeration for the type to EnumTypeEntry which can be specified by the boolean "class" attribute. For the enum classes, the value names need to be qualified by the enum name to match the C++ API. For the C++ generator, add an overload to Shiboken::createScopedEnumItem() that takes a PyTypeObject and add the enum items to the enum so that the name is in the enum scope. Change-Id: Ia0e469d13b08c196b9ddd965b9cf3cc62a38630b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Remove unused code related to enumerationsFriedemann Kleint2018-02-281-16/+2
| | | | | | | | Remove class struct EnumValueRedirection and add explanatory comment to EnumValueTypeEntry. Change-Id: Ic4665436f301943805c7985188bc41c4ad3e8336 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Refactor typesystem modification structsFriedemann Kleint2017-12-051-119/+52
| | | | | | | | | | | - Use member initialization where possible - Make constructors explicit - Remove unused version attributes, unused comparison operators of FunctionModification and unused struct ExpensePolicy - Rearrange members to minimize Clang warnings about padding Change-Id: I1423f120b2117237c2674cdbb6d06923c842999f Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Cleanup of the TypeEntry hierarchyFriedemann Kleint2017-12-041-260/+71
| | | | | | | | | | | Use member initialization where possible. Move constructors/destructors of classes in hierarchies out of line (fixing Clang warnings about classes having no virtual out of line methods). Add override and move virtual functions out of line. Remove unused method ComplexTypeEntry *ComplexTypeEntry::copy(). Change-Id: Ie4a6c30cb0c99be35697f29ebe407b327079222a Reviewed-by: Christian Tismer <tismer@stackless.com>
* FunctionModification: Make it possible to specify a regular expressionFriedemann Kleint2017-08-291-1/+11
| | | | | | | | | It should make it easier to specify the <array> modifications for GL functions. Task-number: PYSIDE-516 Change-Id: Ieb2e540f61785d13ee46a196a18d03b311d308e1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add new <array> argument modification indicating array usageFriedemann Kleint2017-08-031-2/+3
| | | | | | | | | | | | The modification can be used to indicate that for example int* is meant to be used as int[]. This is reflected in the NativePointerAsArrayPattern usage pattern of AbstractMetaType. Task-number: PYSIDE-354 Task-number: PYSIDE-516 Change-Id: Icaeb3cce4be9ce06caa2cab628d4e8fc1b684819 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* move everying into sources/shiboken2 (5.9 edition)Oswald Buddenhagen2017-05-221-0/+1975
in preparation for a subtree merge. this should not be necessary to do in a separate commit, but git is a tad stupid about following history correctly without it.