aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor
Commit message (Collapse)AuthorAgeFilesLines
* shiboken: Generate deprecation information for functions and classesFriedemann Kleint2019-03-131-0/+4
| | | | | | | | | Add a deprecation note to deprecated functions and classes. There is a standard deprecated directive, but it takes the version as a mandatory parameter, which we are unable to obtain from Clang. Change-Id: Ice27b297fbd86def41d99b0f3505551ed301077f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Make the indentor helper class more flexibleFriedemann Kleint2019-03-131-2/+0
| | | | | | | | | | | Move it to a separate header and turn it into a non-type template with a tabWidth parameter to make it possible to use it with arbitrary tab widths. Turn it into a non-type template taking the tab width. Change-Id: Ib2b6a7379ce66d1a22e73b4cb6a4a9a9b457014d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Handle <array> modifications in template inheritanceFriedemann Kleint2019-03-014-34/+62
| | | | | | | | | | | | | | | | | | | | Array modifications did not work in template specializations (like typedef QGenericMatrix<2,2,int> QMatrix2x2> causing warnings like: There's no user provided way (conversion rule, argument removal, custom code, etc) to handle the primitive type 'const float *' of argument 1 in function 'QMatrix2x2::QMatrix2x2(const float * values)'. Rewrite the array modification code to operate on AbstractMetaType only instead of requiring code model data types and add the missing handling to AbstractMetaBuilderPrivate::inheritTemplate(). Add a test. Note that the warning was fixed by another change removing the array modification since it did not take effect due to the presence of a manually added PySequence constructor. Change-Id: Ie4a1092fbef7237f8858790a74e2f75070ef6586 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Add allow-thread attribute to type system and class entriesFriedemann Kleint2019-02-288-35/+97
| | | | | | | | | | | | | | 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-284-45/+91
| | | | | | | | | | | | | | | | | | | | | 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-262-11/+97
| | | | | | | | | | | | | | 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>
* Modernize cmake buildAlexandru Croitor2019-02-071-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a CMake super project that includes the shiboken2, PySide2 and pyside2-tools subprojects, so that it's possible to build everything from Qt Creator (or any other IDE that supports CMake) with minimal set up effort, and thus inform the IDE CMake integration of all relevant files, for easier code editing, navigation and refactoring. This also lays the foundation for allowing 3rd parties to use the shiboken2 generator to generate custom modules. This is achieved by eliminating various hardcoded paths for libraries and include directories. Start using CMake targets throughout the build code to correctly propagate link flags and include dirs for libshiboken and shiboken2 executable targets. Same for the libpyside target. Generate two separate cmake config files (build-tree / install-tree) that can be used with find_package(Shiboken2), to make sure that the PySide2 project can be built as part of the super project build. This is currently the only way I've found to allow the super build to work. Note that for the build-tree find_package() to work, the CMAKE_MODULE_PATH has to be adjusted in the super project file. The generated config files contain variables and logic that allow usage of the installed shiboken package in downstream projects (PySide2). This involves things like getting the includes and libraries for the currently found python interpreter, the shiboken build type (release or debug), was shiboken built with limited api support, etc. Generate 2 separate (build-tree and install-tree) config files for PySide2, similar to how it's done for the shiboken case, for pyside2-tools to build correctly. Install shiboken2 target files using install(EXPORT) to allow building PySide2 with an installed Shiboken2 package (as opposed to one that is built as part of the super project). Same with PySide2 targets for pyside2-tools subproject. Make sure not to redefine uninstall targets if they are already defined. Add a --shorter-paths setup.py option, which would be used by the Windows CI, to circumvent creating paths that are too long, and thus avoiding build issues. Output the build characteristics / classifiers into the generated build_history/YYYY-MM-DD_AAAAAA/build_dir.txt file, so it can be used by the test runner to properly filter out blacklisted tests. This was necessary due to the shorter paths options. Fix various issues regarding target includes and library dependencies. Remove certain duplicated cmake code (like limited api check and build type checks) in PySide2, given that that information will now be present in the exported shiboken2 config file. Include a short README.cmake.md file that describes how to build the super project. References used https://rix0r.nl/blog/2015/08/13/cmake-guide/ https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/ https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1 https://cliutils.gitlab.io/modern-cmake/chapters/basics/functions.html https://cmake.org/cmake/help/v3.0/manual/cmake-packages.7.html https://github.com/ComicSansMS/libstratcom/blob/master/CMakeLists.txt Abandoned approach using ExternalProject references: https://cmake.org/cmake/help/latest/module/ExternalProject.html https://stackoverflow.com/questions/44990964/how-to-perform-cmakefind-package-at-build-stage-only Fixes: PYSIDE-919 Change-Id: Iaa15d20b279a04c5e16ce2795d03f912bc44a389 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Replace QString::null/isNull() by QString()/isEmpty()Friedemann Kleint2019-02-062-4/+4
| | | | | | | | | | | | | | Fix warnings appearing in Qt 5.13: sources/shiboken2/generator/shiboken2/shibokengenerator.cpp:873:25: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/shibokengenerator.cpp:873:25: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/shibokengenerator.cpp:880:25: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/shibokengenerator.cpp:880:25: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/cppgenerator.cpp:5060:34: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/cppgenerator.cpp:5060:34: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations] Change-Id: I7c938df64babf824b58bf5c785b281a88d5111db Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Replace the deprecated Qt algorithms by their std:: equivalentsFriedemann Kleint2019-02-051-1/+5
| | | | | | | | | | | | | | Fix warnings occurring in 5.13: sources/shiboken2/ApiExtractor/abstractmetalang.cpp:1431:66: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator, LessThan) [with RandomAccessIterator = AbstractMetaFunction**; LessThan = bool (*)(AbstractMetaFunction*, AbstractMetaFunction*)]’ is deprecated: Use std::sort [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/cppgenerator.cpp:358:43: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator) [with RandomAccessIterator = Include*]’ is deprecated: Use std::sort [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/cppgenerator.cpp:1683:55: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator) [with RandomAccessIterator = QList<QString>::iterator]’ is deprecated: Use std::sort [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/cppgenerator.cpp:5500:53: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator) [with RandomAccessIterator = Include*]’ is deprecated: Use std::sort [-Wdeprecated-declarations] sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp:1585:65: warning: ‘void qSort(RandomAccessIterator, RandomAccessIterator, LessThan) [with RandomAccessIterator = AbstractMetaFunction**; LessThan = bool (*)(const AbstractMetaFunction*, const AbstractMetaFunction*)]’ is deprecated: Use std::sort [-Wdeprecated-declarations] sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp:1681:24: warning: ‘void qSort(Container&) [with Container = QStringList]’ is deprecated: Use std::sort [-Wdeprecated-declarations] sources/shiboken2/generator/qtdoc/qtdocgenerator.cpp:2054:25: warning: ‘void qSort(Container&) [with Container = QStringList]’ is deprecated: Use std::sort [-Wdeprecated-declarations] Change-Id: If6940941ac31327597ce362a31b27773f4d5b94c Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Suppress warnings about missing types for dropped entriesFriedemann Kleint2019-01-311-0/+1
| | | | | | | | | Fix warnings in case Qt is not built with SCTP: qt.shiboken: (network) type 'QSctpServer' is specified in typesystem, but not defined. This could potentially lead to compilation errors. qt.shiboken: (network) type 'QSctpSocket' is specified in typesystem, but not defined. This could potentially lead to compilation errors. Change-Id: I0352e34011f2123e08fe3330a53dcdadc468d6a9 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Add option to skip deprecated functionsFriedemann Kleint2019-01-316-2/+37
| | | | | | | | | | | | | Pass the "deprecated" annotation from Clang into the meta language and reject functions based on it when the the command line option --skip-deprecated is set. By default, have Python output a deprecation warning when a deprecated function is called (which is visible when passing -Wd). Task-number: PYSIDE-487 Change-Id: Ic28d82963fde11f258b2559b562d3f24017fe98d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Make constructor checks more fine-grainedFriedemann Kleint2019-01-303-16/+19
| | | | | | | | | | | | | | | | ShibokenGenerator::isValueTypeWithCopyConstructorOnly() returned false for QWebEngineHistoryItem since the check for AbstractMetaAttributes::HasRejectedConstructor triggered on WebEngineHistoryItem(QWebEngineHistoryItemPrivate *priv), causing the function to bail out. To prevent this, add a new AbstractMetaAttributes::HasRejectedDefaultConstructor attribute and use that in isValueTypeWithCopyConstructorOnly(). Task-number: PYSIDE-906 Change-Id: I4fee83b89f0a4c44e7e8d69e118ed7f2b03ceee1 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Replace C-style NULL by nullptrFriedemann Kleint2019-01-111-1/+1
| | | | | | | | | | | | | | Replace in comments, code and generated code. Rename variable NULL_VALUE to NULL_PTR and make extern for follow-up changes. Rewrite code using NULL in QString::arg() (resulting apparently from some misunderstanding that it requires a terminating nullptr) to use printf-formatting to fix a warning: format not a string literal and no format arguments [-Wformat-security]). Change-Id: I97c111cadc09192132308924136eb6ede7a6bf44 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Make warning about non-existing templates fatalFriedemann Kleint2018-12-113-65/+14
| | | | | | | | It should abort as it will usually result in broken code. Change-Id: I81d930c4516b0ee97dec985525fab8140fdce3dc Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Fix finding of the Clang lib dirFriedemann Kleint2018-12-051-6/+6
| | | | | | | | | | | | Query llvm-config for the lib dir instead of constructing the path from the prefix in case the Clang location is obtained via llvm-config. Assume a standard build in case the Clang location is obtained via environment variables. Change-Id: I7628d90706100a61f8a605e931bd023b27f1f442 Fixes: PYSIDE-867 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* shiboken: Fix build with Qt 5.13Friedemann Kleint2018-12-041-0/+1
| | | | | | | | | | | Add missing include, fixing: sources/shiboken2/ApiExtractor/clangparser/clangutils.h:91:17: error: field 'childMessages' has incomplete type 'QStringList' appearing in Qt 5.13 due to some header rearrangements. Change-Id: Iab22538af8688ebb3dcbaf0e1042b1198bde5800 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Add file snippet handling to native-to-target and add-conversionFriedemann Kleint2018-11-283-5/+25
| | | | | | Task-number: PYSIDE-834 Change-Id: I3daad497ed32a56c05c8dc2b06271e243d579b99 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Fix file snippet code missing for derived classesFriedemann Kleint2018-11-282-35/+46
| | | | | | | | | | | | | Previously, the files were not read when no code was generated. This caused the code to be missing for methods in classes inheriting from a class in a dependent typesystem (for example, QAbstractSocket inheriting QIODevice). Split out the reading into a helper checking the attributes and always read the snippets. Task-number: PYSIDE-834 Change-Id: Iecc6285422afbf3b3e2ff4846850f8c2dbcabaf1 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Doc: Update copyright statements and obsolete infoTopi Reinio2018-11-262-4/+4
| | | | | | | | | Update the copyright statements visible in Shiboken2 and ApiExtractor documentation sets. Update the name of the Qt documentation tool. Change-Id: I09726e15a6b860f2698df683138a02683596d07d Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken: Add debug output for function modificationsFriedemann Kleint2018-11-243-10/+150
| | | | | | Task-number: PYSIDE-834 Change-Id: I2530b44f704ef96b784a77512f71777d9fd492bb Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Remove defunct code trying to merge namespacesFriedemann Kleint2018-10-303-15/+4
| | | | | | | | | Remove the function _NamespaceModelItem::uniqueNamespaces() which created a QSet of_NamespaceModelItem *. Hashing by pointer values does not have any effect. Change-Id: I723024f0004aacecf4f06a1baa10678848d4a56b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Add snippet extraction to shibokenFriedemann Kleint2018-10-206-9/+103
| | | | | | | | | | | Add a snippet attribute to inject-code and conversion-rule instructing shiboken to extract code from a source file using annotations. Task-number: PYSIDE-834 Change-Id: I576c4a48fe68e9d26fe46e324af5baa88a5c1d34 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken/ApiExtractor tests: Use qrc files for test resourcesFriedemann Kleint2018-10-205-13/+22
| | | | | | | | | | | | This removes the need to copy around test files and the test will also run when launched from a different directory. Extend and fix the declare_test() CMake macro to also add resource files, add .qrc files and modify the tests accordingly. Task-number: PYSIDE-834 Change-Id: Id469e0b11837f7c6a7d71a20494ac019a32d8ed0 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Use class FileOut for the module source file as wellFriedemann Kleint2018-10-192-0/+22
| | | | | | | | | | | Ensure the diff/dry-run options work for this file as well. Move the touchFile() utility around and adapt the verifyDirectoryFor() helper to take a string. Task-number: PYSIDE-834 Change-Id: Ic34b5f8eff304d9de85f60082f582f0537805cd4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Set multiline for the regular expressions for warning suppressionFriedemann Kleint2018-10-191-1/+2
| | | | | | | | Some warnings are multiline (function modification). Change-Id: I34db1b15cd0122576e65122c0665d8b4987781fc Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix crash when garbage collecting in a non-GUI threadFriedemann Kleint2018-10-155-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* shiboken: Check whether enum should be converted to int for the protected hackFriedemann Kleint2018-10-012-0/+11
| | | | | | | | | | | Find the AbstractMetaEnum belonging to the type entry and perform some checks. Generally do not use int for public enums. Warn when a protected scoped enum is encountered as this cannot be converted. Task-number: PYSIDE-817 Change-Id: I02b566093b331ea2ea627bf72964aad0a1a51c83 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Refactor finding of enumsFriedemann Kleint2018-09-285-49/+16
| | | | | | | | | | In the AbstractMetaBuilder, change the list of enums into a QHash with the type entry as key since that is mostly used for searching. Streamline and simplify the search functionality accordingly. Task-number: PYSIDE-817 Change-Id: I205cad1f90bc26511ea6b6e9b76ddb1bae544cf1 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken/AbstractMetaBuilder: Remove unused member variablesFriedemann Kleint2018-09-282-23/+0
| | | | | | Task-number: PYSIDE-817 Change-Id: Id7e8fb1b18abb51d6fdf450c4069e5ba88b53285 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Add exception handlingFriedemann Kleint2018-09-2711-12/+163
| | | | | | | | | | | | | 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: Flip the default behavior the --api-version optionFriedemann Kleint2018-09-2112-18/+76
| | | | | | | | | | | | | | | | | | | | | 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: Use correct function to find the typesystem entry when parsingFriedemann Kleint2018-09-181-2/+2
| | | | | Change-Id: I8f8138e405eaac86cd3012b703c28ff77aa4e2c8 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Refactor code for querying functions of AbstractMetaClassFriedemann Kleint2018-09-182-53/+81
| | | | | | | | | Move the checking code to a static method taking an AbstractMetaFunction and add static methods operating on a list. This makes it possible to implement checks without constructing temporary lists. Change-Id: I9b137858f81396f8243f2d1be5277e6a38be4c84 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Use member initialization in typesystem XML parserFriedemann Kleint2018-09-182-14/+10
| | | | | Change-Id: I38b9e8a457371f5e364b06fc90821753df4af3e9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Simplify code looking for copy constructorsFriedemann Kleint2018-09-183-15/+11
| | | | | | | | | Replace various loops operating on lists by a convenience function AbstractMetaFunction *AbstractMetaClass::copyConstructor() const Change-Id: If38b954ae01856a84835a17a7e4d3e981b5aac9b Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Extend exception specificationFriedemann Kleint2018-09-179-25/+102
| | | | | | | | | | | | | 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: Do not generate implicit conversions for array-modified constructorsFriedemann Kleint2018-09-142-0/+13
| | | | | | | | | | | Otherwise, syntax errors would be generated for QMatrix2x2(const float*), which is an array. Change-Id: Ic5c67e221934a4635c2bbeb83cd378ff4a02af66 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Improve handling of non-type template integer parametersFriedemann Kleint2018-09-132-16/+32
| | | | | | | | | | | | | | 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: Fix warnings about unused variablesFriedemann Kleint2018-09-131-1/+0
| | | | | | | | sources/shiboken2/tests/libsample/objecttype.cpp:283:17: warning: unused variable 'fake_child' [-Wunused-variable] sources/shiboken2/ApiExtractor/doxygenparser.cpp:71:15: warning: unused variable 'numPrefixes' [-Wunused-variable] Change-Id: I409f22e1450e9ae0f3f5924cb6dd47991d12a2ad Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Refactor Generator::minimalConstructor(AbstractMetaClass)Friedemann Kleint2018-09-131-0/+7
| | | | | | | | | | | | | | | | | | | | Add some convenience functions returning the status of default expressions to AbstractMetaArgument. Rewrite the function to only insert suitable candidates into an ordered multimap instead of looping twice over all candidates. This unearthed a bug in the old algorithm trying to find the maximum number of arguments: When no candidates were found, maxArgs was left at 0, which caused it to assume default constructible. This triggered for the QMatrixNxN classes inheriting QGenericMatrix<int, int, Type> with (unsupported) non-type template parameters. For these, the default constructor needs to be specified now. Task-number: PYSIDE-62 Change-Id: I5ce2bed43001780553048d8af0addaba2b22410b Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* shiboken: Line-wrap message about not find function for modificationFriedemann Kleint2018-09-121-9/+11
| | | | | | | | Put each candidate on a new line and limit the number of member functions in the output. Change-Id: Ia628e61009997b37e0f3c2129fba5ccfa29f763e Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Store null enum valuesFriedemann Kleint2018-09-123-2/+19
| | | | | | | | | | | | | 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: Centralize most msg* functions in a separate fileFriedemann Kleint2018-09-1011-260/+582
| | | | | | | | | This makes it easier to maintain a consistent style, unclutters the source and allows for re-using formatting helpers. Change-Id: I4f29637a22afb457f629272e2d86f14bedb36008 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Fix parsing of typedef typesystem entriesFriedemann Kleint2018-09-071-8/+12
| | | | | | | | | Pop the parse stack entry for typedef entries as well which was overlooked in bfd1de3495b18c0ecc251260442a9a46009861e. Task-number: PYSIDE-725 Change-Id: If1f572076b9442ed3a434e3b6fb7b10c17def12d Reviewed-by: Christian Tismer <tismer@stackless.com>
* Merge remote-tracking branch 'origin/5.11' into devFriedemann Kleint2018-09-071-1/+1
|\ | | | | | | Change-Id: I81270510e3a27915781a50769bb627e666970142
| * shiboken: Fix handling of dropped type entriesFriedemann Kleint2018-09-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When parsing the typesystem XML file, decrement variable containing the depth of dropped entries in Handler::endElement(). Otherwise, when dropping a type like <object-type name="QDtls" since="5.12"> <enum-type name="HandshakeState"/> </object-type> all subsequent entries would be droppped. Change-Id: I640a916e8c8dbddcaeaebc3859300cc2a0eb1b0c Reviewed-by: Christian Tismer <tismer@stackless.com>
* | shiboken: Improve error messages about rejected enumsFriedemann Kleint2018-09-061-7/+75
| | | | | | | | | | | | | | | | | | | | | | Use different messages for type entry not found and conflicting types. Spell out values of anonymous enums and indicate scoped enums and associated classes. Change-Id: Id60eb70c28790019b29ebae174369e6963909587 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* | shiboken: Add a typedef typesystem entryFriedemann Kleint2018-09-0510-10/+248
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-052-1/+220
| | | | | | | | | | | | | | | | | | | | 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>