aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator/generator.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Rename shiboken2 to shiboken6Friedemann Kleint2020-10-281-972/+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-14/+14
| | | | | | | | | | | | | | | | | | | | 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-102/+99
| | | | | | | | | | | | | | | | | | | | | | | | | | 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-141-3/+2
|\ | | | | | | Change-Id: I46f5d2dc758d0e1f23377c91ba7496793461771e
| * shiboken2: Some RefactoringsFriedemann Kleint2020-10-141-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | - AbstractMetaType: Pass TypeEntry to constructor - AbstractMetaType: Return instantiations() by const ref - AbstractMetaClass: Make baseTemplateInstantiations a member instead of a global hash. Simplify the code accordingly. Task-number: PYSIDE-1202 Change-Id: I1a18aa4ff97481af8cb13e8732fe3952c48edb29 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-10-081-2/+1
|\| | | | | | | Change-Id: I30aaad19852c50b1222222ba66171f9c98ecb7c8
| * shiboken2: Rearrange values of enum TypeEntry::CodeGenerationFriedemann Kleint2020-10-081-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TypeEntry::CodeGeneration::GenerateCpp was unused. Consequently, the GenerateAll mask is not needed, either. Replace GenerateCpp and GenerateTargetLang by a generic GenerateCode value. Introduce a new GenerationDisabled value to be able to distinguish a generate='no' XML attribute from a plain rejection. Fix many invalid usages of bool generateCode() testing against the flag value. Use the enum instead of uint for the code generation field. Task-number: PYSIDE-1202 Change-Id: I0aec5bd1ebfb9a50b80d5a187372c4271490e1b3 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-10-011-1/+15
|\| | | | | | | Change-Id: Idaf124ad5e1d6a41d52918cecba47499be5e7324
| * shiboken2: Refactor handling of invisible top level namespacesFriedemann Kleint2020-09-301-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To avoid having to add a ShibokenGenerator::lookForFunctionsInClassesNotToBeGenerated() to fix the function issue, replace ShibokenGenerator::lookForEnumsInClassesNotToBeGenerated() by several helper functions: - Add a list of top level invisible namespace to the generators - Add functions to retrieve enumerations of nested invisible namespaces to AbstractMetaClass with recursion helpers. Task-number: PYSIDE-1075 Change-Id: I421113770e622611caeb221498b872d0a6ba1aeb Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-291-7/+5
|\| | | | | | | Change-Id: Ie6da3938b82f5ebe96dd12bd65a3ccc4180d2fba
| * shiboken2: MetaBuilder/ApiExtractor/Generator: Return class/enum/function ↵Friedemann Kleint2020-09-281-7/+5
| | | | | | | | | | | | | | | | | | | | lists by const ref This allows for removing a few temporary variables and/or qAsConst(). Task-number: PYSIDE-1075 Change-Id: I0fe3544f0ce4d3a8d56de9c93e300972e0844177 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.15' into devFriedemann Kleint2020-09-161-1/+2
|\| | | | | | | Change-Id: I114a003e36bbe9eb7452f13c1515e3419648e228
| * shiboken2: Refactor primitive type lists in overload decisorFriedemann Kleint2020-09-111-1/+2
| | | | | | | | | | | | | | | | | | | | Add a separate header with the type names and use that. Add the missing long long on this occasion. Task-number: PYSIDE-1372 Change-Id: Id3c35c6b2c4e7eebfe1d25b555ab62468cb89f1d Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Start porting away from QStringRefFriedemann Kleint2020-08-191-1/+1
|/ | | | | | | | | | | | | QStringRef will be replaced by QStringView. Remove most usages or use auto. This will require a 2nd cleanup removing its usages from the QXmlStreamReader code once this has landed in qtbase. Task-number: QTBUG-84319 Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: I2885df70d5f883bcad7bb3a31618fc1d63116df5 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken2: Remove code indenterFriedemann Kleint2020-06-191-33/+6
| | | | | | | | | | | With the previous changes fixing the spaces of the snippets, the indenter can be removed. It just requires creating local indentors when writing to separate text streams to avoid unnecessarily indenting by the global indenter. Change-Id: Ic9d9661bb1827d40d6f38dc2d47b5fd84729887c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken2: Improve whitespaces formatting in injected codeFriedemann Kleint2020-06-191-1/+3
| | | | | | | | | - Trim newlines and dedent all snippets from XML - Move the trailing newlines into the code snippet function. - Do not indent preprocessor directives Change-Id: Ic8c3745f0b88ee4ed27ac9cbaf376d71a50d9188 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Move wrapperName and type into GeneratorContextFriedemann Kleint2020-05-151-1/+7
| | | | | | | | | | | | | | | Introduce a Type enumeration to GeneratorContext and add the wrapper name as a string. Overwrite creation function in ShibokenGenerator to add this. Remove unused wrapperName overloads. Use the wrapper name and type from the GeneratorContext where applicable instead of repeatedly running the check in shouldGenerateCppWrapper(). Change-Id: I52cace3ad165c2cd6c6ce718cec822abfb8ad8ce Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Prepare for extending GeneratorContextFriedemann Kleint2020-05-151-4/+19
| | | | | | | | | Remove the constructor GeneratorContext and add creation functions to the generators. Make the class creation function virtual so that ShibokenGenerator can override it. Change-Id: I7bc002555356be73ddab5a2095802747796acb7e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Constify GeneratorContextFriedemann Kleint2020-05-151-2/+2
| | | | | | | | | | | | Pass around by const-ref and return a const pointer to the class. In HeaderGenerator::generateClass(), make a copy of the context passed in to prevent writing back via reference in the base class loop. Change-Id: I0338bd93b5a53c25ec18bc45b407ab67d8c7c91e Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Remove some progress and other messagesFriedemann Kleint2020-04-181-2/+0
| | | | | | Task-number: PYSIDE-1265 Change-Id: I8c9651efcbe3d893ba191e0cf78cdcea39410b5c Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Fix shared pointer return value in virtual functionFriedemann Kleint2020-02-041-0/+6
| | | | | | | | | | Smart pointer values did not have a minimal constructor defined, add that. Also add a special case to the return type warning, since that does not have the instantiated type. Fixes: PYSIDE-1188 Change-Id: Ibadd7273f839eb19e1eeb5c912f124e3798207df Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Handle smart pointers with const pointeesFriedemann Kleint2019-12-121-13/+34
| | | | | | | | | | | | | | | | | Treat them equally to smart pointers with non-const pointees by searching for the pointee type entry in the instantiation search and stripping the const there. Create an additional type index equal to the non-const pointee index for the const pointee instantiation. This has the slight drawback that it is possible to invoke non-const calls on the pointee in Python, but this is nearly unfixable since the dispatch happens in the getattro method, where the information about constness is lost. Task-number: PYSIDE-454 Change-Id: Ib514816e408d727656b1599060e105ccd021bb07 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Fix usage of Qt's endl, preparing for Qt 6Friedemann Kleint2019-12-061-1/+1
| | | | | | | | endl and other manipulators will move into the Qt namespace in Qt 6. Replace it by '\n' or add the namespace. Change-Id: Id9632973b253557c99b2f4e0a84c3db12c55f5b4 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Fix classes in hidden namespacesFriedemann Kleint2019-12-031-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There was an existing functionality to hide namespaces when specifying generate="no" on namespace-type which did not work for classes. In addition, it was implemented using the generation attributes of TypeEntry. This is problematic since dependent typesystems are loaded with generate="no", which actually means that no code should be generated for them. To fix this, introduce a new "visible" attribute for namespaces which also accommodates for hiding C++ 11 inline namespaces. Some projects uses the namespaces as packagename while creating python bindings, and to avoid duplicate names they ignore the original c++ namespace. For example a class like that: namespace Qt3D { class Vector; } The namespace "Qt3D" will be used as package name so the namespace "Qt3D" should be ignored during the generation, otherwise the 'Vector' type will be represented by 'Qt3D.Qt3D.Vector' and that is not what we want. Initial-patch-by: Renato Araujo Oliveira Filho <renato.araujo@kdab.com> Fixes: PYSIDE-1074 Change-Id: I3fd391ac3d839d3f8f510c6a4d4000f7d92eacff Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Fix crash when smartptr template class cannot be foundFriedemann Kleint2019-11-181-1/+8
| | | | | | | | | | shiboken currently crashes when naively trying to use std::shared_ptr since it does not see the template due to system directories being excluded from clang parsing. Add an error message and bail out. Task-number: PYSIDE-454 Change-Id: I6627e968061f8f704a90f898879f3861308e1705 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken/AbstractMetaArgument: Separate functionsFriedemann Kleint2019-10-041-4/+5
| | | | | | | | | | | | | Split out AbstractMetaArgument::hasOriginalDefaultValueExpression() and restrict AbstractMetaArgument::hasDefaultValueExpression() to the effective (removed/modified or original expression). Use hasOriginalDefaultValueExpression() since the affected code is only interested in whether the code has a native default expression. Task-number: PYSIDE-1095 Change-Id: I043ae99c315a8a41295efc2c4a15cd5a6ce74293 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Cleanup pointer whitespace everywhereChristian Tismer2019-06-241-36/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Among other files to fix, basewrapper.(cpp|h) was full of uncommon pointer whitespace. After fixing that, I could not resist and fixed also libshiboken, generators, and after acceptance also PySide. Most of the time, this regex worked fine (\w\w+)([*&]+)[ ]*(?![&*]*[/=]) replaced with \1 \2 but everything was checked by hand. I did not touch the shiboken tests which are quite hairy. It turned out that inserting a space between a variable and asterisk causes a crash of shiboken, if the same line contains "CONVERTTOCPP". This was temporarily fixed by adding another space after it. Example.. sources/pyside2/PySide2/glue/qtcore.cpp line 977 QByteArray * cppSelf = %CONVERTTOCPP[QByteArray *](obj); //XXX /|\ omitting this space crashes shiboken! cppgenerator.cpp was special, since it was modified to _generate_ correct pointer whitespace. This caused a few testcases to fail, which had to be adjusted, again. This was difficult since some internal names must end on "*" and generated code normally not. Removing the last errors involved binary search on path sets... Apply C++ 11 fixits to the changed code, where applicable. Done-with: Friedemann.Kleint@qt.io Task-number: PYSIDE-1037 Change-Id: I4ac070f52c5efb296c05d581c9d46e6f397a6c81 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken: Generate code for smart pointers only within declaring packageFriedemann Kleint2019-06-131-2/+5
| | | | | | | | | | | | | | | | Check on the type entry whether code needs to be generated in the current package. Fixes: PYSIDE-1024 Change-Id: I82132b077ac6192b96d979cb5596d0e6fecbc76b Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Fix handling shared pointers passed by const-ref, take 2Friedemann Kleint2019-06-131-1/+7
| | | | | | | | | | | | | | | | With fd126b28e1d9b02ea16c813bc392461bdb05bd1d, broken wrapper code would still be generated for "const_QSharedPointer_QSize___&" depending on whether the const-ref or plain value type was encountered first when parsing. Fix the problem by stripping the qualifiers from the metatype added to GeneratorPrivate::m_instantiatedSmartPointers partially reverting fd126b28e1d9b02ea16c813bc392461bdb05bd1d. Change-Id: Ie6691e045b7d65baa3a0bc72dd8637f09eeaf111 Fixes: PYSIDE-1016 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Fix generation of init functions and types for const-refs of smart ↵Friedemann Kleint2019-06-061-0/+2
| | | | | | | | | | | | | | pointers Add a convenience to strip all qualifiers and use that. This at least fixes the naming (for example, getInitFunctionName returning "const_QSharedPointer_QSize___&"), the init function for the type itself is missing, though. Task-number: PYSIDE-1016 Change-Id: Id61b3c879199fc061e2846007951e3e9c82b85c4 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Remove some special handling for QObject'sFriedemann Kleint2019-04-101-1/+1
| | | | | | | | | | | | For types, QObjects are equivalent to objects, there is no need to differentiate. Remove the code trying to find whether a type is a QObject. Only AbstractMetaClass needs to know whether it inherits QObject. Add a simple check recursing down the base classes. Change-Id: I2365b451c8873f044b06c09b58aff29e2db3c5b7 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Search for classes by type entry instead of nameFriedemann Kleint2019-04-031-1/+1
| | | | | | | | | Searching by name is more efficient and has problems when extending namespaces. Search by type entry instead where possible. Change-Id: I131329a6648bb7f0a02cba08a5fbbc0531e0c51f Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Further refactorings related to the package nameFriedemann Kleint2019-04-021-10/+12
| | | | | | | | | | | | Let Generator::packageName() return the default package name of the type data base instead of storing it in a member variable. Instead, use a member variable for the module name which is derived from it, since it is queried many times. Use the default type system entry instead of searching for it via package name. Change-Id: I171330b3d73d2e3ceac239e4c1c6f130e9f5ee7b Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken/Typedatabase: Store type system entries separatelyFriedemann Kleint2019-03-261-12/+6
| | | | | | | | | This makes it easier to access the default type system entry, which will always be the first one in the list. Change-Id: Ie0844cef5fa4f0cd8bc50c28898e54a42845c830 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Generate static_cast for constructor parameters with spaceFriedemann Kleint2018-11-141-2/+7
| | | | | | | | unsigned long(0) does not work, use static_cast<unsigned long>(0). Fixes: PYSIDE-846 Change-Id: If41baebdf0b1228b658408e4c300872d17143e6f Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Stop updating timestamps of generated files that haven't changedAlexandru Croitor2018-10-231-14/+1
| | | | | | | | | | | | | | This is a change in preparation for improved incremental builds, where modifying one typesystem XML file will not force rebuilding all generated cpp files. The previous logic was incorrect, file timestamps should not be updated if the generated files are unchanged, instead the build rules need to be adapted to prevent unnecessary rebuilds. Change-Id: Ia47f8ff1970e974d0e617b6891ab58666da3b1ff Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Use class FileOut for the module source file as wellFriedemann Kleint2018-10-191-18/+3
| | | | | | | | | | | 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: Check whether enum should be converted to int for the protected hackFriedemann Kleint2018-10-011-1/+21
| | | | | | | | | | | 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-281-11/+1
| | | | | | | | | | 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: Add default constructible with default valuesFriedemann Kleint2018-09-131-1/+10
| | | | | | | | | | | | | | Extend the check for default constructible by also checking whether the first argument has an unmodified default value, for example: explicit QSqlIndex(const QString &cursorName = QString(), const QString &name = QString()); This can be treated like default constructible, except that {} may not be used for return values. Task-number: PYSIDE-62 Change-Id: I70af2a624de54201158a4b56e51b67ef115c2fc6 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Refactor Generator::minimalConstructor(AbstractMetaClass)Friedemann Kleint2018-09-131-81/+32
| | | | | | | | | | | | | | | | | | | | 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: Introduce DefaultValueFriedemann Kleint2018-09-121-38/+153
| | | | | | | | | | | | | | | | | | | | Introduce a small class storing the return value of Generator::minimalConstructor() consisting of a type enumeration and a value, offering formatting for the use cases variable initializations, return values and constructor arguments lists. Having distinct formatting for the different use cases has some advantages: - Can use nullptr without casts (except in constructor arguments lists, where the type is needed for disambiguation). - In the previous implementation using a string, "" indicated an error; so, it was not possible to use it for default-constructors. It is now possible to handle default-constructors for initialization ("Foo f" instead of "Foo f = Foo()". - Can use {} for return values. Task-number: PYSIDE-62 Change-Id: I73229cb957d4b92b43de4cdbc3c66703f48faa61 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Store null enum valuesFriedemann Kleint2018-09-121-1/+5
| | | | | | | | | | | | | 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: Fix non-deterministic order of some SBK type indexesFriedemann Kleint2018-07-261-9/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix some clang-tidy warnings in shibokenFriedemann Kleint2018-07-231-6/+7
| | | | | | | | | | | | | | | | | - '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: Refactor command line arguments handlingFriedemann Kleint2018-07-161-2/+7
| | | | | | | | | | | In main, replace the class ArgsHandler by plain QMap handling. Remove the args parameter of Generator::doSetup() and add a new virtual handleOption(key, value) to the generators instead. Add missing initialization. Change-Id: I9bc844172a81244f729d87a3d4262545e6433904 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Remove unused code from the generatorsFriedemann Kleint2018-06-281-13/+0
| | | | | Change-Id: I88c4148000acba2ba1e2013fe587e7f5fbe6c2ca Reviewed-by: Christian Tismer <tismer@stackless.com>
* 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: Fix some clazy warningsFriedemann Kleint2018-01-171-2/+2
| | | | | | | | | | | | - 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>