aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/messages.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix documentation generationFriedemann Kleint2021-12-101-4/+21
| | | | | | | | | | | | | | | | | | | | | | | | The fuzzy checking introduced by 87efa57c6ddc1a8364b2ea4d9f909372d0af5cfc actually produced ambiguous matches like QStandardItemModel::insertRow(QStandardItem *), QStandardItemModel::insertRow(constd QList<QStandardItem *> &). Change this to be a 3 step process: First, try an exact type match. If that fails and there are arguments using const ref qualifications, try a fuzzy match. Check whether this produces a single match. Finally, try matching by argument count. As a drive-by, format qualifiers of template parameters like QList<QStandardItem *> correctly. Change the messages to report "Fallback used" instead of "Cannot find" if a fallback is found to make it easier to spot failures. Amends 87efa57c6ddc1a8364b2ea4d9f909372d0af5cfc. Pick-to: 6.2 Change-Id: I5b133274ae0f056e6901b0a66d385a270cabb9c9 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Add further methods to smart pointersFriedemann Kleint2021-11-241-0/+6
| | | | | | | | | | | | | | | | Add attributes for reset() and null-check. The shared pointer in the test uses isNull() which works due to the --use-isnull-as-nb_nonzero option, but it should be possible to explicitly specify that. [ChangeLog][shiboken6] Attributes for reset() and null-check of smart pointers have been added. Task-number: PYSIDE-454 Pick-to: 6.2 Change-Id: I22571eeb43f7f98b6a77b31066bf8daa681cb044 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Clean up messages about cyclic dependencies of overloaded functionsFriedemann Kleint2021-11-031-3/+6
| | | | | | | | | | | | | | | Move message helper msgCyclicDependency() from overloaddata.cpp to message.cpp to prevent a clash between the static helper and the one declared in messages.h. This was an oversight causing problems in 5.15: tqtc-pyside-setup/sources/shiboken2/generator/shiboken2/overloaddata.cpp: In function ‘QString msgCyclicDependency(const QString&, const QString&, const MetaFunctionList&)’: tqtc-pyside-setup/sources/shiboken2/generator/shiboken2/overloaddata.cpp:151:16: error: ‘QString msgCyclicDependency(const QString&, const QString&, const MetaFunctionList&)’ was declared ‘extern’ and later ‘static’ [-fpermissive] Pick-to: 6.2 5.15 Change-Id: I56375c5bbc483859f83658cfeb4df1e6067421a0 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Do not crash when class cannot be found in the overload sorterFriedemann Kleint2021-10-281-3/+11
| | | | | | | | | | | Print an error message instead. As a drive-by, add a helper to create a class-qualified signature for error reporting purposes to AbstractMetaFunction. Pick-to: 6.2 5.15 Task-number: PYSIDE-1684 Change-Id: I8417f405b4ce1b64060aad0696e5d328869cb83e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Store removed modification in AbstractMetaArgumentFriedemann Kleint2021-10-011-0/+12
| | | | | | | | | Similar to 984559a68d57d76b49c8ed0cbaf3492521aebebd, store the "removed" modification in AbstractMetaArgument. Task-number: PYSIDE-1660 Change-Id: Id541b4dccdcf3eba708a0da5dc873fe3b20b8151 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Refactor modified types of functionsFriedemann Kleint2021-10-011-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove AbstractMetaFunction::typeReplaced(), which returned the modified type of an argument or the return type as a string. Instead, for function arguments, for which modified types must always be valid AbstractMetaTypes, add a getter modifiedType() returning an AbstractMetaType to AbstractMetaArgument. This fixes a number of potential bugs when accessing typeReplaced(int) with the wrong position due to removed arguments. The modified argument types are parsed from the XML strings in early on in AbstractMetaClass::fixFunctions() with proper error reporting. For return types, for which modified types need to be valid only when generating a type check for virtual method return in the C++ wrapper, add a function modifiedTypeName() to AbstractMetaFunction. Adapt the client code accordingly. Split apart CppGenerator::writeTypeCheck() into one overload taking an AbstractMetaType and one taking a string. Task-number: PYSIDE-1660 Change-Id: Id95379892b40ae2632ca33ed27263bada0ec015d Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Remove ShibokenGenerator::guessCPythonCheckFunction()Friedemann Kleint2021-09-301-0/+6
| | | | | | | | | | | | | | | | Since all CPython types are now built-in custom types, there is no longer a need to guess the check functions. Custom types passed to writeTypeCheck should be valid AbstractMetaTypes; throw an exception if this fails. Define a check function for Qml's VolatileBool where it was relying on heuristics. Task-number: PYSIDE-1660 Change-Id: I9641c63ae2942db86dbf84488429b7e25f0491a0 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* shiboken6: TypeEntry: Use a pointer to the target lang API type entryFriedemann Kleint2021-09-241-0/+6
| | | | | | | | | | | | | Replace the string m_targetLangApiName by a pointer to the type entry; allowing to retrieve the check function. Similarly, in TargetToNativeConversion::sourceTypeCheck(), use the existing type entry to retrieve the check function, allowing for removing some heuristics. Task-number: PYSIDE-1660 Change-Id: Ieeda43f804b4e129d3cc0984e36bd0c0d546fd86 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Improve message for a mismatched global functionFriedemann Kleint2021-09-241-2/+6
| | | | | | | | Output a list of candidates with matching name in case some type was misspelt. Change-Id: Ie763a912d02907d562f3feeb2eba44e811d80118 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Add support for built-in typesFriedemann Kleint2021-09-171-0/+11
| | | | | | | | | Add a built-in flag to TypeEntry and fix the duplicate type entry checking logic to handle built-in types with a different warning. Task-number: PYSIDE-1660 Change-Id: I22b0fc92b0f19b4163a4311441638176ff6a4bfb Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: remove obsolete error messageChristian Tismer2021-06-181-12/+0
| | | | | | | | | | | | This message became pointless in PySide6 because the word "iterator" no longer creates clashes in shiboken and PySide. Thanks for checking this, Friedemann! Change-Id: Ib0496039ab194049fd1f09867de1bbcfeb47d21e Pick-to: 6.1 Fixes: PYSIDE-498 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken6: Remove "Invalid" enumeration values that exist only for error ↵Friedemann Kleint2021-05-201-2/+0
| | | | | | | | | | | checking Change the lookup functions to return a std::optional, allowing for removing the defaults. Use uniform error handling and messages. Pick-to: 6.1 Change-Id: I49cb414e1044693f75af914d7c3c0dc45140ffc8 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Make missing snippet labels a fatal errorFriedemann Kleint2021-03-101-0/+9
| | | | | | | | Use a std::optional for helper extractSnippet() to be able to distinguish an empty result from an error. Change-Id: Id8da10f56155de54e50930c85f510704d2db8f48 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Add constructors of base classes imported via "using"Friedemann Kleint2021-03-011-0/+11
| | | | | | | | | | | | | Parse "using" declarations in the clang builder using some code from the base class determination algorithm. Resolve them to struct UsingMember containing the base class and the member name in the metabuilder and check whether any base constructors are imported via "using". Add them as functions like the default constructor. Change-Id: I121a70f0591c6d1e6f9daedfb653206c49c07a3f Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Improve error messages of added funcsFriedemann Kleint2021-01-261-4/+16
| | | | | | | | Pass the innner message out so that it appears in the qFatal() message. Change-Id: Ib38d54de58647037204d76bc7c78fcb3bf82fca5 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Refactor options parsingFriedemann Kleint2021-01-201-3/+4
| | | | | | | | | | | | Replace the string map in the CommandLineArguments struct by a QVariantMap, which can store strings and string lists. A number of list split and join operations can then be removed. Replace the path splitter by QDir::listSeparator(). Task-number: PYSIDE-1477 Change-Id: I70b798e531787d4932605ed5121b523fff5c1110 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6/ApiExtractorResult: Use const AbstractMetaClass * for the class listFriedemann Kleint2020-12-221-1/+1
| | | | | | | | | | Add the missing overloads of AbstractMetaClass::findClass() and adapt some types. Pick-to: 6.0 Change-Id: I65851248b4b6a2e1d4f57fc58ecaf75fb4c00b29 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Shiboken6: Decouple QtXmlToSphinx from the doc generatorFriedemann Kleint2020-12-151-30/+0
| | | | | | | | | | | | | To enable testing, decouple QtXmlToSphinx from the doc generator by introducing a parameter struct QtXmlToSphinxParameters and an interface QtXmlToSphinxDocGeneratorInterface. Move the messages back into qtxmltosphinx.cpp and move the helper function convertToRst to the doc generator since it uses FileOut. Pick-to: 6.0 Change-Id: I176888dcbd65003856ea8797a5629949598801d5 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Store AbstractMetaFunction using a QSharedPointerFriedemann Kleint2020-11-301-1/+1
| | | | | | | | | | | | | | | | | | Store the list functions (global / class member) as a QList<QSharedPointer<const AbstractMetaFunction> instead of a raw pointer list. This makes passing around function lists easier and solves the memory leaks caused by mixing cloned and unmodified functions while collecting the overload lists in the generators. - Change the function signatures accordingly - Add a qSharedPointerConstCast() for non-const access. - Restructure the traversing of added functions in the AbstractMetaBuilder - Remove some unused typedefs and functions unearthed by the change Change-Id: I08a6c5243750e3eb3813bc3f7172899ad2b13e22 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Replace QVector by QListFriedemann Kleint2020-11-251-1/+1
| | | | | | | | | | | | | | | | Change AbstractMetaClass::templateArguments() to return TypeEntries (const TypeEntry *) instead non-const. Remove redundant typedef OverloadData::MetaFunctionList. Use existing typedefs in some places. Add new typedefs for MetaObjectBuilder::EnumValues and AbstractMetaFunctionCList. Change-Id: Ia241b5fbe54d60ea57175fb1f6c844604e066a3d Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Refactor writing out filesFriedemann Kleint2020-11-241-0/+9
| | | | | | | | | Write the buffer directly to the file instead of reopening the text stream on it (which has unclear encoding semantics). Add error handling on this occasion. Change-Id: Ifd478f96a73dbc21e441fed8b8e543f07b6fa00b Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Fix some warning messagesFriedemann Kleint2020-11-181-3/+107
| | | | | | | | | Use standard messages where applicable. Move some messages over to messages.cpp and add a location. Remove some messages that cannot be triggered any more. Change-Id: I7fc821e4360b06af7ef6e5db7e30de0f1e8ed5ca Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Improve error messages when encountering forward-declared classesFriedemann Kleint2020-11-121-3/+17
| | | | | | | | | | | | Add an error string and return a message when a class can not be found (is only forward-declared) when looking for a minimal constructor expression and writing reference modifications. Remove debug code left over from a previous change. Pick-to: 5.15 Change-Id: I1e6f4f9f6d0611967cd77c4a3c1b8663366632fd Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Port AbstractMetaEnum/Value to use QSharedDataPointerFriedemann Kleint2020-11-111-2/+2
| | | | | | | | Change the client code to store it by value. For the various find() and traverseEnum() functions, use a std::optional to replace the pointer. Change-Id: Ie4e671bf95e569741fa3c9a399bfe239ceac0dec Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Port AbstractMetaField to use QSharedDataPointerFriedemann Kleint2020-11-101-2/+2
| | | | | | | | | | Fold AbstractMetaVariable into AbstractMetaField and use a QSharedDataPointer for it. Change the client code to store it by value. For the find() and traverseField() functions, use a std::optional to replace the pointer. Change-Id: Ibaa301b9aaae8851fcaa077327235cc5aaad7342 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Introduce a private class hierarchy for TypeEntryFriedemann Kleint2020-11-101-0/+1
| | | | | | | | | | | | | | | | | Move the data members of the TypeEntry classes to private classes, using convenience macros modeled after Qt's Q_D macro. The main motivation here is header hygiene and decoupling; typesystem.h was including a lot of classes. This requires moving some code around: - Move the debug formatting helpers of the TypeEntry classes from typedatabase.cpp to typesystem.cpp. - Move struct TypeRejection to typedatabase.h - Reorder typesystem.cpp in order of declaration. Change-Id: I24fe501d98940afd44caf75057cd6131cfbd6b6e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Replace AddedFunction::TypeInfo by TypeInfoFriedemann Kleint2020-11-091-5/+6
| | | | | | | | | | | | | | | | | | AddedFunction::TypeInfo was a stripped-down version of the code model's TypeInfo with its own, simplified parser. Replacing it by TypeInfo allows for removing the parser code and the entire AbstractMetaBuilderPrivate::translateType(AddedFunction::TypeInfo) branch. The more powerful TypeParser from the code model can then be used, allowing for more complex types in <add-function> or <declare-function>. As a drive by, replace the AddedFunction constructor by a static factory function, allowing to pass up parse errors. Change-Id: I33ad19e9b5ed30bd27898afe771401ddc98c8c73 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Split the abstractmetalang headers and sourcesFriedemann Kleint2020-11-061-0/+3
| | | | | | | | Split out enums, fields and functions. Only AbstractMetaClass remains in abstractmetalang.h. Change-Id: I49846f92fafc5969d83aa4a1767eb4ac23f39d1c Reviewed-by: Christian Tismer <tismer@stackless.com>
* Rename shiboken2 to shiboken6Friedemann Kleint2020-10-281-0/+692
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>