aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* | shiboken: Replace some character #defines by char constantsFriedemann Kleint2018-09-042-2/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-305-174/+4
| | | | | | | | | | | | | | | | | | 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>
* | Clarify template error messageTilman Roeder2018-08-201-1/+1
| | | | | | | | | | Change-Id: I928ed3d07cd66393675d014050c3bf3ab2ea5c49 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* | shiboken: Implement template inheritance for fieldsFriedemann Kleint2018-08-033-0/+120
| | | | | | | | | | | | | | | | | | Add the fields to the typedef'ed class specializing the type similar to the functions. Task-number: PYSIDE-725 Change-Id: I2daae9bd3c8a73fbd868f495cfc3a2dfba703103 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | shiboken: Refactor code involved in inheriting template classesFriedemann Kleint2018-08-034-70/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Add a helper template to conveniently search for a MetaClass by name and convenience function to search in lists. - Remove parameter bool *ok from AbstractMetaBuilderPrivate::inheritTemplateType() and check on returned pointer instead. - In the inheritTemplate*() functions, use QScopedPointer to ensure the result is deleted on failure. - Search for a shadowing function first before creating the copy in inheritTemplate(). Task-number: PYSIDE-725 Change-Id: I3183087fb42b22a2189c17b94eaafdb4c1151f0e Reviewed-by: Christian Tismer <tismer@stackless.com>
* | shiboken: Add template base class to the debug operator of AbstractMetaClassFriedemann Kleint2018-08-011-0/+2
| | | | | | | | | | | | Task-number: PYSIDE-725 Change-Id: I68a57bbd98d111faa42dc62b667985281517df31 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken: Simplify TypeDatabase::findTypes()Friedemann Kleint2018-07-311-5/+2
| | | | | | | | | | | | | | | | | | | | Use QMultiMap::equal_range(). Amends a6d12454983f8b1f2f8e7087de4b11ccd9126178 Task-number: PYSIDE-757 Change-Id: I82018ca78226f8fe45cd1ab43d8c05a0b0fc8811 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken: Code cleanupFriedemann Kleint2018-07-312-19/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Remove code working around a Qt bug and a modification on a type entry name which was apparently intended to strip off qualifiers using a regex, but has no effect since the QString overload was called. Remove check for null in AbstractMetaBuilderPrivate::addAbstractMetaClass() and modify call sites accordingly. Change-Id: I7ab2a163fe558af09f2c7989bdec1561e9bbb203 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken: Warn about unimplemented attributesFriedemann Kleint2018-07-301-13/+107
| | | | | | | | | | | | | | Task-number: PYSIDE-743 Change-Id: I7caddc5c84749911db3a550006ca9f9884b20958 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken: Add some number to the progress messagesFriedemann Kleint2018-07-301-5/+10
| | | | | | | | | | | | | | | | Show number of classes, etc. Change-Id: I2ca7a1b4eae09db7ea71e8843182f69df95b7c1c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken: Fix order of type indexesFriedemann Kleint2018-07-261-0/+17
| | | | | | | | | | | | | | | | | | Sort the classes, enumerations and global functions alphabetically. Task-number: PYSIDE-757 Change-Id: I65fd7058fa5dff6f5724915b142d68bd18dba4c7 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken: Fix non-deterministic order of some SBK type indexesFriedemann Kleint2018-07-264-101/+107
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change underlying type of the type database from a QHash<qualified_name, list of entries> to a QMultiMap<qualified_name, entry>. Previously, there was an allEntries() accessor and a function named entries() building a QHash<qualified_name, entry>. Simplify this so that there is only an entries() accessor returning the QMultiMap. Refactor the various Typedatabase::find() functions to operate on an iterator range of the QMultiMap. This unearthed some bugs: 1) In the generators, the call to findType(packageName()) would return the namespace entry for "sample" instead of the intended module type entry named "sample" due to the ordering. Add a new function to search for module type entries and assert that it finds it. 2) There was a duplicate, empty primitive type entry for QModelIndexList. Task-number: PYSIDE-757 Change-Id: I1814e4ca67d306e1488398507707cfd07b3f2c78 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken: Add support for type aliases (using)Friedemann Kleint2018-07-263-10/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QAbstractRayCaster is the first class in Qt to use type aliases: using Hits = QVector<QRayCasterHit>; Treat them as typedefs if a canonical type can be obtained for them. This requires adding some simplification of the canonical types obtained for standard containers. Task-number: PYSIDE-751 Change-Id: I521a8b02d3c8cb89e4f72a817fbacc5955041570 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>