aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor
Commit message (Collapse)AuthorAgeFilesLines
* shiboken: Remove unused code related to enumerationsFriedemann Kleint2018-02-282-29/+2
| | | | | | | | Remove class struct EnumValueRedirection and add explanatory comment to EnumValueTypeEntry. Change-Id: Ic4665436f301943805c7985188bc41c4ad3e8336 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Type system parser: Refactor convertBoolean()Friedemann Kleint2018-02-282-10/+10
| | | | | | | | Turn it into a static helper and use QString::compare() to avoid the call to toLower(). Change-Id: Ifc10a7e8b5df4df80ee23135e32aea34ed72d295 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Type system parser: Introduce QStringLiteral for attribute valuesFriedemann Kleint2018-02-281-29/+34
| | | | | | | Avoid QString allocations for them. Change-Id: Ia55fba30f790a938900e7b5217daeaa6098beaf6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Refactor finding of enumerationsFriedemann Kleint2018-02-235-75/+52
| | | | | | | | | | | | | | | - Add helper AbstractMetaEnum::findEnumValue() which finds unqualified as well as qualified enum values. - Remove unused function bstractMetaClass::findEnumForValue(QString). - Remove 2nd parameter from AbstractMetaClass::findEnumValue(QString, AbstractMetaEnum *). The comment claimed that it is excluded from the search, but the condition was the reverse. Just removing it apparently does not do harm. Task-number: PYSIDE-487 Change-Id: I32b036045ea335b805fba79df327cc42d787f18c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* sphinx: Remove deprecated config keysFriedemann Kleint2018-02-231-2/+0
| | | | | | | | | | | | | | Remove - html_add_permalinks: the key has been changed to str and has a default. - html_use_smartypants: Replaced by smartquotes and defaults to true. Fixes warnings: WARNING: The config value `html_add_permalinks' has type `bool', defaults to `str'. WARNING: html_use_smartypants option is deprecated. Smart quotes are on by default; if you want to disable them, use the smartquotes option. Task-number: PYSIDE-363 Change-Id: I85092597a860f58cc012220edbf0c03749326432 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Reduce number of warnings when running shiboken on a custom moduleAlexandru Croitor2018-02-221-8/+18
| | | | | | | | | | | | | | | | | | | | | Running shiboken on a custom XML file (like the scriptableapplication example) would show tons of warnings about not being able to find certain types or enums or other things inside Qt modules. For scriptableapplication that was the case, because the wrappedclasses.h file would only include the <QMainWindow> header file, and not the rest of QtWidgets / QtGui headers, which means that shiboken found types declared in XML files, but could not find the actual declarations inside the preprocessed header file. This change adds some additional conditions so that warnings are not printed when a typesystem file is loaded with the generate="no" attribute, because no C++ code will actually be generated for types defined inside such a typesystem file. Task-number: PYSIDE-587 Change-Id: I1f166483c2f343796e08d3142e5e296c4ee43f27 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* QtDocParser: Fix and refactor queriesFriedemann Kleint2018-02-211-34/+58
| | | | | | | | | | | | - Use a QTextStream for better readability - Extract a helper function to format the function parameter type query: - Fix the function parameter type attribute ("left"->"type") - Fully qualify enumeration and other non-primitive types Task-number: PYSIDE-363 Change-Id: I529e839fb737f30bd9b70d10a48fcfb0c9141f8f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Documentation extraction: Add error handlingFriedemann Kleint2018-02-216-13/+100
| | | | | | | | | Trim the strings returned by the XPath queries and warn about failing queries. Task-number: PYSIDE-363 Change-Id: Ia0233d490497597cb78aa16b0908fe226270705c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* DocParser: Add helper function to create list of documentable functionsFriedemann Kleint2018-02-214-8/+38
| | | | | | | | | | | | | | Move code from shouldSkip() helper of the doc generator into the doc parser and use that for the qdoc/doxygen parsers. The additional checks (most importantly the check for declaringClass != ownerClass excluding the virtual functions added by AbstractMetaClass::fixFunctions() to derived classes) avoid running unneeded XPATH queries. Task-number: PYSIDE-363 Change-Id: Ib1141a348c96b269a50c63dd94fe93931c12d1ec Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix clazy warnings in the doc generatorsFriedemann Kleint2018-01-261-1/+0
| | | | | | | | | | | - Unused variables - Mixing const/non-const iterators - Signedness - Missing const ref in range-based for - Uninitialized variable Change-Id: I02e6d4c5b0416aa8462f7b9d567b562a702a5740 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: replace first()/last() by constFirst/constLast()Friedemann Kleint2018-01-173-15/+14
| | | | | | | | Fix clazy warnings about possibly detaching containers. Change-Id: I3c3a229de5e0c71f17c1f26273e1b0be3b0d7e81 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Fix some clazy warningsFriedemann Kleint2018-01-178-33/+27
| | | | | | | | | | | | - Mixing const/non-const iterators - Do not use operator[] on temporaries of type QVector - Remove unused nontrivial variables - Add Q_FALLTHROUGH() - Potential detach in range-based for Change-Id: I89391fdda616f119eadd7de529eb6cee69343f85 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix system header inclusions for proper support of C primitive typesAlexandru Croitor2018-01-151-1/+22
| | | | | | | | | | | | | | | | | | | | | | | | | In order for GL types like GLint64 to be available on macOS, the macOS-specific system header "gltypes.h" has to be parsed by libclang. Before this change, shiboken skipped parsing system headers (except for gl.h) because there are issues when trying to parse C++ std headers (ostream for example). The file "gltypes.h" contains the typedef declarations for GL numeric types. A few other system headers like "cstdint" are also needed (which contain the actual typedefs from int32_t to int for example). A few different system headers are also needed on Linux (also for GL -> numeric typedefs). This system header exclusion mechanism is far from a clean solution, but it seems like current versions of libclang do not provide enough preprocessor information to be able to limit the parsing to specific chunks of code (for example everything included by gltypes.h), thus we need to limit ourselves to exclusion by file paths. Change-Id: I58c151e2cb083e16f7cafb3dc9df2d757442bb59 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix system framework handling on macOSAlexandru Croitor2018-01-151-4/+8
| | | | | | | | | | | | | | | | | | System framework paths queried from the system clang compiler should be re-added to libclang via the -iframework command line argument instead of -F, so that they appear at the bottom of the list of candidate include search paths. This prevents issues with picking up incorrect headers, like an installed official package of Qt 4.8. Also there is no need to use CMAKE_SYSTEM_FRAMEWORK_PATH like in the 5.6 branch because it duplicates the list of includes and also causes conflicts with the same paths being added as both system and non-system include paths. It was necessary in 5.6 branch because the list of include paths was not queried from the clang compiler. Change-Id: I04b299fc5bc759842a0ab890a85170f153932e79 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Remove attributes Final and FinalInCppFriedemann Kleint2017-12-213-37/+17
| | | | | | | | | | Apparently, the meaning of FinalInCpp for functions was "virtual and not private". The previous code cleanup removed most uses of them. For the remaining cases, checking for virtual is sufficient. Change-Id: I6f794e36b99920af36fd0eba895be673dc35d9dd Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Remove unused code in abstractmetalang.hFriedemann Kleint2017-12-213-547/+25
| | | | | | | | | | | | The AbstractMeta* classes had a lot of functions trying to determine whether wrapper functions/classes should be generated. Apparently at some stage, this functionality was moved to the generator classes (apparently in conjunction with the "protected hack"), leaving the functions unused. Change-Id: Ia3fef96fe86cc6a6f9c70c674635bccf510362bc Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken/AbstractMetaBuilder: Remove create* functionsFriedemann Kleint2017-12-092-59/+15
| | | | | | | | There are no classes deriving from AbstractMetaBuilder, so there is no need to have virtual creation functions. Change-Id: I2d4c494ac6b0a17ceea71939a1f07a49a369df73 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Stop using the FinalInCpp attribute for classesFriedemann Kleint2017-12-093-17/+27
| | | | | | | | | | | | | | | Besides its use for functions, the FinalInCpp attribute was used for classes meaning something like neither the class nor its derived classes can be constructed due to presence of private destructors and absence of non-private constructors. Since 'final' is now a reserved word in C++ 11, this becomes confusing. Remove the usage of the attribute for classes, add a bit field indicating presence of a private constructors and a new function isConstructible() instead. Change-Id: Ieb2f9943c21511e4f59d228885361e3ad66fb266 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Refactor copying of the MetaLang* classesFriedemann Kleint2017-12-062-11/+35
| | | | | | | | | Disable copying of the base classes AbstractMetaAttributes and AbstractMetaVariable and refactor the copy() functions of the derived classes in terms of protected assign*() functions. Change-Id: I6cbe1cfa02207230e914ad41dddba46c866cb689 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Unify constructors of the MetaLang* classesFriedemann Kleint2017-12-052-108/+110
| | | | | | | | | 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). Change-Id: I511e7261a077db259e6c305cb1dcb08c1ee4810f Reviewed-by: Christian Tismer <tismer@stackless.com>
* Refactor typesystem modification structsFriedemann Kleint2017-12-053-184/+72
| | | | | | | | | | | - 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: Do not use QString::split() to find nameFriedemann Kleint2017-12-051-3/+10
| | | | | Change-Id: I83e254a5d0f7ba4613a04a73683ed08c273fc2ca Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Cleanup of the TypeEntry hierarchyFriedemann Kleint2017-12-042-260/+366
| | | | | | | | | | | 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>
* shiboken: Use information about virtual from the code modelFriedemann Kleint2017-12-022-3/+1
| | | | | Change-Id: I27411e810fc3b3ff9d3bb629b5ebc2c7fdaa59ef Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken/MetaLang: Add information about override/finalFriedemann Kleint2017-12-024-20/+71
| | | | | | | Take over information from code model and test. Change-Id: Ibed2973e09b117966ed241798125f60ba337b0e9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken/Clang parser: Add information about override/finalFriedemann Kleint2017-12-013-0/+51
| | | | | Change-Id: I0f1bad0567ae928d4117e7785e7788d9efd551c2 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken/AbstractMetaAttributes: Remove some unused attributesFriedemann Kleint2017-12-013-46/+3
| | | | | | | Remove Native, FinalOverload, InterfaceFunction, Fake. Change-Id: I1232751169fafb144387343857a962bafee714e9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Use the correct basename and extension for qdoc module filesTopi Reinio2017-11-141-2/+5
| | | | | | Change-Id: I0f123c3db5b50d193b927e8003771327d50ff344 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shikoben2: Extend type system path resolutionFriedemann Kleint2017-11-034-11/+40
| | | | | | | | | | | | - Remove stripping of directory components from the file names so that for example QtCore/typesystem_core.xml can also be resolved via type system path. - In addition, pass in the path of the current file being parsed so that for example typesystem_core_x11.xml is found from the directory of typesystem_core.xml while parsing Change-Id: Id10aafaf21750aa87460ccfe9ee3c3764086eda6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Add the c++ header include paths of g++Friedemann Kleint2017-10-251-0/+21
| | | | | | | | | | It seems standard C++ headers are not found by clang when run g++ 6.3.X on RHEL 7.4. Task-number: PYSIDE-431 Task-number: PYSIDE-513 Change-Id: Ibd400cfa854ce3a9f763c593969cd063346f8056 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Add Vulkan supportFriedemann Kleint2017-10-071-4/+17
| | | | | | Task-number: PYSIDE-431 Change-Id: I35995213d04a3fb7a6c8399b1397884cf43c09ba Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Add -Wno-microsoft-enum-value for MSVCFriedemann Kleint2017-10-071-0/+1
| | | | | | | | Silence numerous warnings: warning: enumerator value is not representable in the underlying type 'int' Change-Id: I82b4547c1392e1d65515e0bd51d5d76bac185a9e Reviewed-by: Christian Tismer <tismer@stackless.com>
* CodeModel: Handle access of inherited classesFriedemann Kleint2017-09-255-30/+53
| | | | | | | | | | | | | | Store the access of the base class in the code model. Remove protected/private base classes in the abstract meta builder as otherwise invalid code will be generated for classes like QAbstract3DGraph : public QWindow, protected QOpenGLFunctions when the protected hack is not in use (on Windows). Task-number: PYSIDE-487 Change-Id: I5bc2dad16f903da86e6e41450c2f9a76726ac028 Reviewed-by: Christian Tismer <tismer@stackless.com>
* qtdocparser: Default to suffix '.webxml'Friedemann Kleint2017-09-151-10/+10
| | | | | | | | | '.webxml' is the qdoc default suffix. Check for '.webxml', first, '.xml' second for compatibility. Task-number: PYSIDE-363 Change-Id: I90c6e8d407dc0afe7ef4df4d83b48ddb43d22955 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Typesystem parser: Look up external injected code in typesystem pathFriedemann Kleint2017-09-153-5/+7
| | | | | | | | | | | | | | Make TypeDatabase::modifiedTypesystemFilepath() public and add parameter preventing it from stripping the path so that it can handle 'glue/snippet.cpp' correctly. This removes the need to run shiboken with the working directory set to the type system file path in order to find the external injected code snippets for documentation generation. Task-number: PYSIDE-363 Change-Id: Ic61cc1d1187e326e5255b29759a9d42e27ebd8d4 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Do not consider gl.h a system include file (all platforms)Friedemann Kleint2017-09-131-3/+19
| | | | | | | | | | Amends db904f8e9ed06eac37151c9a8b955c63c1eb8a46 to apply to all platforms since the issue is also present on Linux. Task-number: PYSIDE-516 Change-Id: I564506f6aefc26e95beae90d95643553eba5dbff Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Windows: Do not consider gl.h a system include fileFriedemann Kleint2017-09-041-1/+19
| | | | | | | | Amends 10453490629859a01048d0b21688d6617279eeaf. Task-number: PYSIDE-516 Change-Id: Ie4bc2008669e4e34bedf0575de3ff75adbc2413e Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken2: Make message about unmatched functions more verboseFriedemann Kleint2017-09-041-2/+23
| | | | | | | | List all member functions if a candidate cannot be found (spelling error or similar). Change-Id: I86ca1556078051d2fc1f78f2091f5176f2a65423 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Refactor TypeEntry::isCppPrimitive()Friedemann Kleint2017-08-291-13/+18
| | | | | | | | | Introduce a helper function returning a sorted string vector to avoid converting each type string to a QByteArray. Change-Id: If9036d6251f5cc8d83ae13c8b5c3f731a6738657 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* FunctionModification: Make it possible to specify a regular expressionFriedemann Kleint2017-08-296-14/+65
| | | | | | | | | 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>
* Fix the chain of issues regarding QSslConfigurationAlexandru Croitor2017-08-242-1/+31
| | | | | | | | | | | | | | | | | | | | | | | | | The failure was seen on Windows CI build, but was actually present on all platforms if the QSsl checks were properly fixed, or if certain CMake versions randomly decided to force C++11 usage. The first issue was that QSsl wrappers were not generated on all platforms because the C++11 standard was not forced for the compilation tests done in the check_qt_class macro. This is a bug in CMake, and the official way of fixing this is introduced in the yet unreleased CMake 3.9 version. The current fix is a workaround to explicitly pass the C++11 standard switch to the try_compile invocation. The next issue concerns handling of const char[] C++ types. There are three such members in QSslConfiguration, which caused build failures due to incorrectly generated code. The solution is to treat "const char[]" types as "const char*" types, which generates correct conversion code. Tests were also added to check for such cases. Change-Id: I874a3591dfc5f385338de7e3aff2a2c0dd2f5719 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken: Prefix all warning messages by base prefix of typesystem fileFriedemann Kleint2017-08-232-1/+13
| | | | | | | | shiboken is run in parallel when building PySide2, so it is sometimes hard to tell where warnings come from. Change-Id: Iaccd91543e14e6e9c38ebfa2b0c285417f924d03 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Shiboken2: Add an index check for the <array> modificationFriedemann Kleint2017-08-221-1/+6
| | | | | | | | | Amends change 1578d14d1693122d4bcacede0d77527d8e898629. Task-number: PYSIDE-354 Task-number: PYSIDE-516 Change-Id: I50e5d0762f1b049a511c62f8aa8d08da4cb563d9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Add new <array> argument modification indicating array usageFriedemann Kleint2017-08-037-11/+69
| | | | | | | | | | | | 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>
* libshiboken: Add Array convertersFriedemann Kleint2017-08-033-0/+27
| | | | | | | | | | | | | | | | Add a SbkArrayConverter struct which provides a list of check functions that return a converter function for an array of matching size. Add simple array converters for arrays of C++ primitive types. Instances of the ArrayHandle<>, Array2Handle<> templates will be generated which may point to internal data or allocated arrays. Task-number: PYSIDE-354 Task-number: PYSIDE-516 Change-Id: I157606891fad345ccd7af6d4a9d4dcb0c634b2f4 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Shiboken: No longer change arrays[] to pointer typesFriedemann Kleint2017-08-032-33/+27
| | | | | | | | | | In AbstractMetaBuilder, no longer change array types like "int[]" to "int*". Task-number: PYSIDE-354 Task-number: PYSIDE-516 Change-Id: Ia9e15ae3fca895bf179275eb31a94323d91f4941 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Shiboken: Improve Handling of array typesFriedemann Kleint2017-08-033-2/+58
| | | | | | | | | | | Change the AbstractMetaType::signature() functions to work with the nested AbstractMetaType types instead of TypeEntry so that the correct array signatures appear in the signature of AbstractMetaFunction. Task-number: PYSIDE-354 Task-number: PYSIDE-516 Change-Id: I90aa11891c95ccdcbae81fb70db4bec0e62f5923 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix building on openSuSE and Ubuntu 16.04 CI machinesAlexandru Croitor2017-07-242-2/+21
| | | | | | | | | | | | | | | | | | | | Previously all the GCC header paths were explicitly passed to libclang, which caused redefinition errors of builtin functions or intrisics (like __rdtsc). Instead of passing the include paths explicitly, we rely on libclang itself recognizing that there are GCC paths in the default search locations. Also we need to pass the libclang builtin headers location, because it is not able to find them by itself. Usually the search location for these headers is to get the executable path location (aka the clang++ binary) and navigate to ../lib/clang/VERSION/include relative to that binary. But because the shared library is used instead of the binary, we need to explicitly pass that header location via the -isystem flag. Task-number: PYSIDE-513 Change-Id: I7c1127d85c0cea4c063c5c2a3548a1eef5eadaf3 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* Clang: Fix build with MSVC2017/Clang 4.1Friedemann Kleint2017-07-141-0/+6
| | | | | | | | | | - Remove option -fPIC for Windows, fixing error: unsupported option '-fPIC' for target 'x86_64-pc-windows-msvc'" - Raise language level to prevent constexpr errors in MSVC libraries Task-number: QTBUG-57086 Change-Id: Ic5bd84a8ce37c9f93d70d983257c98431aa18efe Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* AbstractMetaType: Join the signature functionsFriedemann Kleint2017-07-112-51/+23
| | | | | | | | | | Introduce a common helper function to format the signature for minimalSignature() / cppSignature() which differ only by whitespace. Task-number: PYSIDE-354 Task-number: PYSIDE-516 Change-Id: Ife6be7001618d73a7a2bc15e91bff4ae42192a45 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>