aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/ApiExtractor/parser/codemodel.h
Commit message (Collapse)AuthorAgeFilesLines
* Rename shiboken2 to shiboken6Friedemann Kleint2020-10-281-814/+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>
* Fix libsample/photon test for Qt 6 / WindowsFriedemann Kleint2020-07-201-0/+6
| | | | | | | | | | | | | | | The code model was seeing photon.h:93: template class LIBSAMPLE_API TemplateBase<IdentityType>; as complete class definitions, shadowing the previous template definition. Add some processing removing them. Task-number: PYSIDE-1339 Task-number: PYSIDE-904 Change-Id: If0f28feeb6e3ff8c064e8853784240695f79e0b4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken2: Add file location to more warningsFriedemann Kleint2020-06-231-0/+4
| | | | | | | | | | | | | | | | | | | | Output most warnings in the standard file:line syntax used by compilers. This is done for C++ source code and typesystem files. Introduce a class SourceLocation and add it to type entry, AbstractMetaFunction and AbstractMetaClass. Move more messages into messages.cpp and output the location. Change the errors reported by the XML typesystem parser to the same format. [ChangeLog][shiboken] A number of error and warning messages have been prefixed by file name and line for better tooling. Task-number: PYSIDE-904 Change-Id: Ie2008f4060757e9d7ca1b25c00c7c5585240a7b8 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Add support for template type aliasesFriedemann Kleint2020-05-181-1/+30
| | | | | | | | | | | | | In Qt 6 as of May 2020, this is used to alias QList to QVector: template<typename T> using QList = QVector<T> which shiboken needs to handle. Introduce a new code model item for this and add it to the resolver. Task-number: PYSIDE-904 Change-Id: I9e558635e843b60d44c0ceaaaa68b09b50c25c9f Reviewed-by: Christian Tismer <tismer@stackless.com>
* Merge remote-tracking branch 'origin/5.14' into 5.15Friedemann Kleint2020-03-131-0/+2
|\ | | | | | | Change-Id: Ia1c7d31c9f5d1fd8dbc33a0357c419301fd67b6a
| * dumpcodemodel: Qualify function argumentsFriedemann Kleint2020-03-091-0/+2
| | | | | | | | | | | | | | | | Amends d1604053e9ae354963a2b2447b3d196fc5dda73e. Task-number: PYSIDE-1240 Change-Id: I27882de3077fcd11fc98b10b8ddbd469990b77c4 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | Merge remote-tracking branch 'origin/5.14' into 5.15Friedemann Kleint2020-03-061-0/+2
|\| | | | | | | Change-Id: I116f2abfda7263fac8a31ffbe8fc82bfa0cbc618
| * Change the dumpcodemodel tool to output typesystem XMLFriedemann Kleint2020-03-051-0/+2
| | | | | | | | | | | | | | | | Make the previously existing debug output an option and output typesystem XML by default. Change-Id: I3d95bdb56446097377880e1ca0b54d3b8b93ea24 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | shiboken: Handle inline namespacesFriedemann Kleint2019-12-031-0/+4
|/ | | | | | | | | Check the attribute as returned by the clang parser and add it to the handling of the visible attribute of namespaces. Fixes: PYSIDE-990 Change-Id: I3428b59d6d9a5d60dd95db5fc0640772bd3985c8 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: List location of anonymous structs in rejected classesFriedemann Kleint2019-07-081-0/+1
| | | | | | | | Anonymous structs showed up as mysterious, empty entries in mjb_rejected_classes.log. Output the location. Change-Id: I0754e426a9fff3d1dac03aa587747ab0d7816df5 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Fix various clang warningsFriedemann Kleint2019-06-251-12/+10
| | | | | | | | | | | | | | | | | - Avoid copying complex types by using const ref - Use isEmpty() to check for container emptyness - Use range-based for - Use Q_DISABLE_COPY in 'public:' area - Fix spelling error - Use '= default' for trivial constructors/destructors - Remove non-null checks before deletion - Fix misleading indentation - Fix else after return - Simplify boolean expressions - Fix unused parameters, streamline code Change-Id: I8c6cadd8653e220ba8e5bdb4dd55524d13a81768 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Replace 'typedef' by 'using'Friedemann Kleint2019-06-251-1/+1
| | | | | | | | Apply Fixits by Qt Creator with some amendments. Remove iterator types by using auto instead. Change-Id: I8a75323da6ae5cdcc6b67af8be9376408953986b Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Fix generation of init functions and types for const-refs of smart ↵Friedemann Kleint2019-06-061-0/+1
| | | | | | | | | | | | | | 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: Make it possible to extend namespacesFriedemann Kleint2019-05-221-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Qt has some modules, where functions and classes are added to namespaces of other modules. For example, QtGui adds the free functions mightBeRichText() and convertFromPlainText() to the "Qt" namespace and Qt3DQuick adds a namespace "Quick" to the namespace "Qt3DCore" started in Qt3DCore. Shiboken was unable to handle this since the name of the index constant was derived from the namespace name and would thus clash. Also, all code model items from the base module would be re-generated into the extended namespace. To fix this: - No longer join namespace code model items in clang builder. - Search for pre-existing namespaces in traverseNamespace() before creating a new one, continuing populating it. - Add a "files" attribute taking a regular expression to match header names to the namespace type entry, making it possible to restrict code model items by files when extending namespaces (as otherwise, all base items are again added). - Add "extends" attribute specifying the package name of the namespace to extend, which will be used as base type in CPython. - Disambiguate the SBK indexes of namespaces and the init_ functions by adding the module name. Change-Id: Ib552e878911942fa4d52d2bb0c6695e5b2c4c341 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Refactor CodeModel::findItem()Friedemann Kleint2019-04-101-3/+3
| | | | | | | | | | Rewrite it to use a recursion, preparing for having several namespaces of the same name in the scope. Change the scope parameter to be of the ScopeModelItem type to avoid unnessary pointer casts. Change-Id: I9a06ff49d19f93fbc0aefc573544debeb813ef20 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Remove defunct code trying to merge namespacesFriedemann Kleint2018-10-301-2/+1
| | | | | | | | | 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>
* shiboken: Extend exception specificationFriedemann Kleint2018-09-171-2/+4
| | | | | | | | | | | | | 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: Add support for type aliases (using)Friedemann Kleint2018-07-261-0/+4
| | | | | | | | | | | | | | | 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>
* shiboken: Add exception specification to clang parserFriedemann Kleint2018-07-241-0/+5
| | | | | | | | | For exception handling, calls into C++ might need to wrapped in try/catch. Detect noexcept functions for which this can be omitted. Task-number: PYSIDE-62 Change-Id: I37aced91ace184edf211a457a60c131d516a4037 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Fix some clang-tidy warnings in shibokenFriedemann Kleint2018-07-231-2/+2
| | | | | | | | | | | | | | | | | - '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: Move detection of template arguments to ClangBuilderFriedemann Kleint2018-07-111-0/+5
| | | | | | | | | | | | | | | | Obtain the template arguments from Clang and fall back to parsing the type name where this is not possible (which may be the case inside a template declaration). The string-based formatting and re-parsing of the type in AbstractMetaBuilder::translateType() can then be removed, opening the way to passing up more complex types from Clang into the MetaBuilder. Task-number: PYSIDE-672 Change-Id: I43ff285c5f3720319bf40c65b1c27302ef1b934e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Improve const handlingFriedemann Kleint2018-07-111-0/+6
| | | | | | | | | | | | | | - Use new enum in code. - Rewrite the Clang type parsing to make use of it. - Adapt some typesystem files. This enables the distinction between "int *" and "int *const" and fixes the signatures from "int const &" to the more common "const int&". Task-number: PYSIDE-672 Change-Id: Ic1bff0015188c32f53d0e6f347b1523254cb7e4f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Introduce enumeration for C++ indirectionsFriedemann Kleint2018-07-111-7/+13
| | | | | | | | | | | 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: Add instantiations to TypeInfoFriedemann Kleint2018-07-111-2/+6
| | | | | | | | | | | | | | | | | When streamlining the typeinfo structs in 7f798dfc9fc6e3e9756f06f0fedc821e16f1320a, the parser was wrongly changed to use TypeInfo::m_arguments for template instantiations. This field is intented for function pointer arguments (which the parser does not support). Add a new TypeInfo::m_instantiations (matching AbstractMetaType::m_instantiations) for templates, support it in the type parser and to the toString() method. This allows to remove the mysterious TypeInfo::instantiationName() method. Task-number: PYSIDE-672 Change-Id: I705b26d65988ebfb837e8323941076b4fb37d120 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Fix handling of deleted functionsFriedemann Kleint2018-07-061-0/+8
| | | | | | | | | | | Check the cursor availability to detect deleted functions. This fixes the build of the Qt 5.12 API, which for the first time has a Q_DISABLE(QCBorStreamReader) in a public section, causing a copy constructor to be reported. Task-number: PYSIDE-487 Change-Id: I31ba0103cf612a4238c0e282ffcfeeab29df97d1 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Handle enum class forward declarationsFriedemann Kleint2018-07-061-0/+1
| | | | | | | | | | | | Add the enumeration to the scope stack only if it actually has values. This occurs for the first time in Qt 5.12, which introduces a forward declaration of enum class QCborSimpleType at src/corelib/kernel/qmetatype.h:65. Task-number: PYSIDE-487 Change-Id: I5798eb8e47bcd4d21dc554dc5cdd257c7163ca90 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Streamline the type parsing codeFriedemann Kleint2018-06-011-0/+3
| | | | | | | | | | | | | | Replace struct TypeParser::Info by TypeInfo and remove TypeParser::Info. Move method TypeParser::Info::instantiationName() to TypeInfo for this purpose. Change TypeParser::parse() to return TypeInfo. Task-number: QTBUG-672 Change-Id: I123d5bf378ad146867b571e47e31ae08a92b2504 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Streamline the type parsing codeFriedemann Kleint2018-05-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | - Remove bool *ok-parameter from AbstractMetaBuilderPrivate::translateType() It was only used to handle the special case of void return values of functions where translateType() returned nullptr/ok = true. Add a check TypeInfo::isVoid for this purpose and move this handling to traverseFunction instead. For all other cases, translateType() returning nullptr means failure. - Remove the code triggered by the bool resolveScope parameter of AbstractMetaBuilderPrivate::translateType(). It has been observed to not find any matches, likely due to the types being fully qualified by Clang. - Remove function AbstractMetaBuilderPrivate::decideUsagePattern() which was a one-liner calling AbstractMetaType::decideUsagePattern() Task-number: PYSIDE-672 Change-Id: I0336896917cb914d4d622eefa0a21e6e319efa0f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> 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-3/+14
| | | | | | | | | | | | | | 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-7/+6
| | | | | | | | | | | | | | 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/Clang parser: Add information about override/finalFriedemann Kleint2017-12-011-0/+12
| | | | | Change-Id: I0f1bad0567ae928d4117e7785e7788d9efd551c2 Reviewed-by: Christian Tismer <tismer@stackless.com>
* CodeModel: Handle access of inherited classesFriedemann Kleint2017-09-251-4/+9
| | | | | | | | | | | | | | 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>
* Use information about Constructor/Destructor functions from ClangFriedemann Kleint2017-05-291-0/+4
| | | | | | | Expand CodeModel::FunctionType accordingly. Change-Id: I2759f45e4c60f36d4583b1c475c4c2df1e00ace6 Reviewed-by: Christian Tismer <tismer@stackless.com>
* move everying into sources/shiboken2 (5.9 edition)Oswald Buddenhagen2017-05-221-0/+687
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.