aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/abstractmetalang.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix some clang-tidy warnings in shibokenFriedemann Kleint2018-07-231-19/+19
| | | | | | | | | | | | | | | | | - 'else if' after return/break/continue - Use const ref for complex arguments passed by value where possible - Fix 'if (foo) delete foo' to 'delete foo' - Use container.isEmpty() instead of container.size() in checks - Use ' = default' for trivial constructors/destructors - Use range based for where possible - Complete constructor initializer lists - Fix invocations of static methods - Replace some reinterpret_cast by static_cast - Remove unused variables/fields - Use initializer lists for return types Change-Id: Id5b44a2f9d429f66ef069d532a1cd31df796d38e Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Add comparison to AbstractMetaTypeFriedemann Kleint2018-07-231-0/+20
| | | | | | | | | | | Extend the existing rudimentary comparison function from the meta builder and provide comparison operators. This will be useful for later refactorings. Task-number: PYSIDE-672 Change-Id: I793656a733db676d9bc3ab8910869e50274f6a79 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Improve support for volatileFriedemann Kleint2018-07-111-0/+6
| | | | | | | | | | | Previously, the volatile keyword ended up as a part of the qualified type name while parsing in translateType(). Add the token to TypeParser and add it to AbstractMetaType. Task-number: PYSIDE-672 Change-Id: I553ea1b35e7e99ffde4442471b82e32be84731ba Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Introduce enumeration for C++ indirectionsFriedemann Kleint2018-07-111-7/+12
| | | | | | | | | | | Replace the int "indirections" field of TypeInfo and AbstractMetaType by a Vector of an enumeration representing '*' and "* const". It is then possible distinguish between "int *" and "int *const". Task-number: PYSIDE-672 Change-Id: I68677fa515abb7e94217fc1c2b6ac28b42678284 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Extend debug operatorsFriedemann Kleint2018-07-041-0/+22
| | | | | | | | Output template arguments of TypeEntry/AbstractMetaType. Task-number: PYSIDE-672 Change-Id: Ib7e161c8313f91a540659c395a8684498e86aba2 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Documentation: Skip methods added by the meta builderFriedemann Kleint2018-05-181-4/+7
| | | | | | | | | Introduce an attribute for added methods and exclude them from the documentation generation. Task-number: PYSIDE-363 Change-Id: I06d3f468bcec4d0480012d29e26dabadae51634b Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix wrongly generated code for enums passed by const-refFriedemann Kleint2018-05-161-6/+8
| | | | | | | | | | | | | | First encountered in: QtScxmlEvent::setEventType(const EventType &); The metatype was wrongly detected as NativePointerPattern in AbstractMetaType::determineUsagePattern(). Introduce a helper for detecting plain const-ref and use that consistently. Change-Id: I6b105bc99ae63e4737c5d628e79f23b7acbcca3d 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: Use enum values from ClangFriedemann Kleint2018-04-191-2/+5
| | | | | | | | | | | | | | Remove a lot of ugly value parsing code in favor of clang_getEnumConstantDeclValue() and clang_getEnumConstantDeclUnsignedValue() depending on the type. Introduce a class EnumValue containing a union of qint64 and quint64 values to represent signed/unsigned values correctly and use that in the code model and meta language classes. Change-Id: If2efb7cfd560237907678b8f6fdfb0bc689c0c93 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Detect class enums by Clang entirelyFriedemann Kleint2018-04-191-5/+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>
* shiboken: Refactor finding of enumerationsFriedemann Kleint2018-02-231-58/+40
| | | | | | | | | | | | | | | - 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>
* shiboken: Fix some clazy warningsFriedemann Kleint2018-01-171-1/+0
| | | | | | | | | | | | - 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>
* Remove attributes Final and FinalInCppFriedemann Kleint2017-12-211-11/+7
| | | | | | | | | | 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-211-397/+0
| | | | | | | | | | | | 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: Stop using the FinalInCpp attribute for classesFriedemann Kleint2017-12-091-6/+5
| | | | | | | | | | | | | | | 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-061-10/+23
| | | | | | | | | 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-051-11/+65
| | | | | | | | | 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>
* 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: Use information about virtual from the code modelFriedemann Kleint2017-12-021-1/+1
| | | | | Change-Id: I27411e810fc3b3ff9d3bb629b5ebc2c7fdaa59ef Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken/MetaLang: Add information about override/finalFriedemann Kleint2017-12-021-1/+18
| | | | | | | Take over information from code model and test. Change-Id: Ibed2973e09b117966ed241798125f60ba337b0e9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken/AbstractMetaAttributes: Remove some unused attributesFriedemann Kleint2017-12-011-22/+3
| | | | | | | Remove Native, FinalOverload, InterfaceFunction, Fake. Change-Id: I1232751169fafb144387343857a962bafee714e9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Add new <array> argument modification indicating array usageFriedemann Kleint2017-08-031-0/+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>
* libshiboken: Add Array convertersFriedemann Kleint2017-08-031-0/+22
| | | | | | | | | | | | | | | | 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: Improve Handling of array typesFriedemann Kleint2017-08-031-2/+21
| | | | | | | | | | | 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>
* AbstractMetaType: Join the signature functionsFriedemann Kleint2017-07-111-50/+21
| | | | | | | | | | 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>
* Shiboken: Improve debug operators of the type systemFriedemann Kleint2017-07-111-2/+18
| | | | | | | | | | | - Add debug operator for TypeParser::Info - Add verbose mode to AbstractMetaType - Output more information for TypeEntry Task-number: PYSIDE-354 Task-number: PYSIDE-516 Change-Id: Id9882e89f9b5a51929f27b100d28396d3f6c4198 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Remove AbstractMetaFunction::invalid()Friedemann Kleint2017-05-291-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change AbstractMetaBuilderPrivate::traverseFunction() to consistently return 0 if something does not fit. Previously, functions with half-parsed arguments with the invalid flag set were returned. This caused strange side effects since the flag was not checked in all places. The only relevant information is whether some constructors were rejected. In that case, no default constructors or default copy constructors should be generated. This is now determined by checking the code model function item; the attribute HasRejectConstructor is introduced for this. This fixes: - Make it possible to reject the QTextStreamManipulator constructor taking a function pointer without having a default constructor generated: typedef void (QTextStream::*QTSMFI)(int); QTextStreamManipulator(QTSMFI m, int a) Q_DECL_NOTHROW - Implement QtCharts whose class QAbstractSeries has a rejected constructor. Change-Id: I6310574ba677dac20699f257340d2c2a55674353 Reviewed-by: Christian Tismer <tismer@stackless.com>
* move everying into sources/shiboken2 (5.9 edition)Oswald Buddenhagen2017-05-221-0/+2784
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.