aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/tests/testmodifyfunction.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Rename shiboken2 to shiboken6Friedemann Kleint2020-10-281-470/+0
| | | | | | | | 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>
* shiboken2: AbstractMetaArgument: use QSharedData[Pointer]Friedemann Kleint2020-10-271-4/+4
| | | | | | | | | | | | | | | | | | | | Similar to AbstractMetaType, AbstractMetaArgument was previously kept as a raw pointer. The data were copied numerous times by AbstractMetaArgument::copy() when adding the inherited functions to a AbstractMetaClass. Similar to what was done for AbstractMetaType in 6cad0686101b252cfdbd1a6768a2b02c39aa1d8a, change the type to be based on QSharedData[Pointer]. It can then be passed around and treated like a C++ value type, with Qt sharing the data when possible behind the scenes. * Remove inheritance from AbstractMetaVariable by moving the fields over. * Remove the unused field m_originalName. Change-Id: Ic9e476ca71e163de131fbecc267d0a4e336cb0b9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken2: AbstractMetaType: use QSharedData[Pointer]Friedemann Kleint2020-10-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Previously, shiboken2 kept AbstractMetaType by a raw pointer. The data were copied numerous times by AbstractMetaType::copy() when adding the inherited functions to a AbstractMetaClass or specializing templates, sometimes with a bool flag indicating ownership. To get rid of the copies and ownership issues, change the type to be based on QSharedData[Pointer]. It can then be passed around and treated like a C++ value type, with Qt sharing the data when possible behind the scenes. - Extract AbstractMetaType to a separate header/source - Remove unused AbstractMetaType::setInstantiationInCpp() - Remove unused member m_package - Rewrite the comparison of AbstractMetaType which becomes relevant for checking/detaching to do a complete comparison. It was previously unused, intended for a different implementation of view types with special cases. - Rework debug formatting - Invalid meta types are indicated by the "Invalid" usage pattern instead of null pointers Change-Id: Ic4b1feecafb4f0355f39e178c2703b104e45cf6c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-10-201-4/+4
|\ | | | | | | Change-Id: Iaabea628351fac9da88b5779b537f62262ff82a7
| * shiboken2/ApiExtractor tests: Avoid detaching of listsFriedemann Kleint2020-10-201-4/+4
| | | | | | | | | | | | | | Use constFirst/Last() instead of first()/last(). Change-Id: I3e7c72e3ab72b86565eea087b470f2a51b2999f8 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | shiboken2: Fix exception handling for C++ 17Friedemann Kleint2020-07-101-1/+5
|/ | | | | | | | | | | | | throw() has been removed in C++17, causing testmodifyfunction to fail for Qt 6. noexcept(false) should be used instead. noexcept() takes a constexpr value, which we cannot easily compute. Add handling for the simple true, false cases by checking the code snippet. Task-number: PYSIDE-904 Change-Id: Icb9f8770d2de2b9f218bfa72e516e360c0cd65aa Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Change the default of allow-thread to falseCristián Maureira-Fredes2020-03-131-6/+6
| | | | | | | | | | | | | | | | | | | | This process introduced many unnecessary calls to the Py_BEGIN/END_ALLOW_THREAD macro to PySide, which had a negative impact on the overall behavior when studying the responsiveness of UIs with threads. Some tests were adapted to include the new allow-thread behavior. [ChangeLog][shiboken] The default of the "allow-thread" attribute has been changed to false as it was observed to cause performance issues when using threads. Task-number: PYSIDE-803 Change-Id: I2cd67c86340f7bf7a2c5694869d17fe2027a0abb Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken: Add allow-thread attribute to type system and class entriesFriedemann Kleint2019-02-281-10/+24
| | | | | | | | | | | | | | In the typesystem parser, add the allow-thread attribute to root and complex type entry. Rewrite the handling of allow-thread (cached) in AbstractMetaFunction similar to the exception handling (store the modification in AbstractMetaFunction and go down the class hierarchy if it is unspecified). Change-Id: I00e6e2ab25208fda63ec20522814cbfccbb8c42d Fixes: PYSIDE-931 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Fix exception handling when specified in base classFriedemann Kleint2019-02-281-0/+11
| | | | | | | | | | | | | | | | | | | | | Class-level exception specifications on a base class were not working so far. This requires a larger refactoring, since the base classes are not yet known at the point where class functions were traversed (AbstractMetaBuilder::setupInheritance() is called at a later stage). To fix this, store the actual type system modification in the AbstractMetaFunction and move the logic determining whether to generate exception handling into AbstractMetaFunction::generateExceptionHandling(). In this function, recurse down the base classes if the function does not have a modification set. This is a preparation for giving the allow-thread attribute, which can currently only be used at a function level, a similar handling. Task-number: PYSIDE-62 Change-Id: I28597559511d330cf860c6f6e21ffea229bfab3e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Extend the exception handling testFriedemann Kleint2019-02-261-10/+95
| | | | | | | | | | | | | | Turn the test into a data driven test to also test modifications to the class and typesystem level and test more cases, for example overriding modifications on a higher level. This is a preparation for giving the allow-thread attribute, which can currently only be used at a function level, a similar handling. Task-number: PYSIDE-62 Task-number: PYSIDE-931 Change-Id: Id5fe65b7d0edb4279b47aaa6e59dfb6cda2d75a3 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Add exception handlingFriedemann Kleint2018-09-271-0/+4
| | | | | | | | | | | | | 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: Flip the default behavior the --api-version optionFriedemann Kleint2018-09-211-3/+6
| | | | | | | | | | | | | | | | | | | | | When no option was passed, all type system entries with a "since" would be silently excluded. For example, the scriptable application would only see Qt API that does not have a "since" attribute. This could be fixed by adding version options for all dependent Qt libraries it uses to the build steps, but this is tedious and error-prone. Flip the behavior such that an empty version list specification means "latest". Add helper functionality to clear the versions to the TypeDatabase and use that in the tests to start out with a clean list. Change the tests to use a QString for the version. Add a test for the new behavior. Task-number: PYSIDE-814 Change-Id: Ie6137ba6095ce562813bacbadbf4028d0e2c061f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Extend exception specificationFriedemann Kleint2018-09-171-0/+34
| | | | | | | | | | | | | Change boolean 'noexcept' flag into an enumeration that indicates whether a function throws, is 'noexcept' or the behavior is unknown. This makes it easier to implement an 'auto' mode for exception handling. Task-number: PYSIDE-62 Change-Id: I4e5405863e5af2a54f3528ba5eb5c51d3929703d Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Fix the allow-thread attribute to actually have an effectFriedemann Kleint2018-07-251-0/+54
| | | | | | | | | | | | | | | | 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>
* 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>
* FunctionModification: Make it possible to specify a regular expressionFriedemann Kleint2017-08-291-3/+15
| | | | | | | | | 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>
* move everying into sources/shiboken2 (5.9 edition)Oswald Buddenhagen2017-05-221-0/+249
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.