aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/generator/main.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Move the shiboken-generator source aroundFriedemann Kleint2025-11-241-474/+0
| | | | | | | | | THIS COMMIT WAS GENERATED BY A SCRIPT Task-number: PYSIDE-962 Task-number: PYSIDE-1587 Change-Id: I58b05c3d05606efb6303193f2d7f907a0ab5741b Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
* shiboken6: Add platform version optionFriedemann Kleint2025-07-221-0/+10
| | | | | | | | | | As observed for iOS, libclang falls back to a too-old OS version. Make it possible to override using a command line option. Task-number: PYSIDE-3105 Task-number: PYSIDE-2352 Change-Id: I251dca3e45e9bbc1737e54e0e9799595ab680ff9 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Ensure mjb_shiboken.log is always writtenFriedemann Kleint2025-07-081-2/+6
| | | | | | | | | | Use a QScopeGuard to make sure it is written also in case of ApiExtractor failing. Task-number: PYSIDE-3105 Pick-to: 6.9 Change-Id: I25fbca24633f1468c674422919405bdb11fc2811 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Add architecture optionFriedemann Kleint2025-06-251-1/+12
| | | | | | | | | As opposed to Platform/Compiler, it has an "Other" option since host builds should run on any architecture. Task-number: PYSIDE-3105 Change-Id: I170bbba422ca862a980d0e5efee2d9978fdcdb0f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Add arguments for compiler-pathFriedemann Kleint2025-06-251-0/+7
| | | | | | | | | For cross-building, arguments like --target might be required when determining the include paths by running the compiler. Task-number: PYSIDE-3105 Change-Id: Ida8bf08e1d5c566f915400d46c9cfb80bf706a72 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Dump general log on failure in COINFriedemann Kleint2025-06-251-0/+2
| | | | | | | Task-number: PYSIDE-3105 Change-Id: Ie80e05bb4c2adc4585222d06fee18b93f92010ad Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Ece Cinucen <ece.cinucen@qt.io>
* shiboken6: Enable using CMAKE_CXX_COMPILER_ID for --compilerFriedemann Kleint2025-06-181-3/+5
| | | | | | | | Relax the checks and make it non-fatal. Task-number: PYSIDE-3105 Change-Id: Iea3a8d26a2d3fa1de51bdf7a93a433a253ce8560 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Extend the platforms enumerationFriedemann Kleint2025-06-131-2/+4
| | | | | | | | | | | | | | | - Add a distinct value for Linux. - Add iOS/Android. - Relax the parsing of command line values so that CMAKE_SYSTEM_NAME can be passed to the --platform option. - Warn only if unknown names are encountered on the command line. - Define the type system keywords depending on it instead of hardcoding to the host value. Task-number: PYSIDE-3105 Change-Id: I32650181fb4bd43223e351610f4fc8a0a3e0100b Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Port to Qt include styleFriedemann Kleint2025-03-271-4/+4
| | | | | | | | | Replace the Qt forwarding headers by the .h files. This brings down the dependency list by approx 6%. Pick-to: 6.9 Change-Id: Iaa57400fd20600b940119a6016041b885a68d207 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Log the command line arguments into mjb_shiboken.logFriedemann Kleint2025-03-141-2/+1
| | | | | | | Complements 91d0ec1e864c5c657e351c32af1f8d78a26c543d. Change-Id: I7f86d6723680b582011549d7fb30b6d17c6a10f4 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Add a log file for general messagesFriedemann Kleint2025-02-281-0/+2
| | | | | | | | | | | | Add a new log file mjb_shiboken.log for informational messages to reduce clutter and make warnings stand out. [ChangeLog][shiboken6] An additional log file, mjb_shiboken.log has been introduced which contains informational messages about the types encountered. Change-Id: I042fdfee7bae174d5b214d171a32e3e3cca7a3d7 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Fix some clang-tidy warningsFriedemann Kleint2025-02-031-2/+2
| | | | | | | | | | | | - Fix invocation of static functions - Use std::any, range-based for where applicable - Use std::make_shared instead of new - Replace QByteArrayLiteral() by literal - Use const-ref to avoid copies Pick-to: 6.8 Change-Id: Iec864bd6eee8fb06f5afd122084a9e0f551ff8f1 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Fix static analysis warningsFriedemann Kleint2024-06-241-5/+5
| | | | | | | | | | | | | | | | | | - Initialize variables - Use auto * - Use const references to prevent copies - Remove const from function returns - Remove repeated return types - Fix else after return/throw - Make functions const/static where appropriate - Add missing override - Fix some invocations of static methods - Fix some int types (qsizetype) to avoid lossy conversions - Minor cleanups - Remove some macros Change-Id: I414b8451703b136f135383289de49e743e84fb3a Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Add an options parser for common optionsFriedemann Kleint2023-09-201-346/+182
| | | | | | | | | Remove the old option handling completely. Pick-to: 6.6 Change-Id: I00661b530527cd072c346b983c33b789240ce722 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* shiboken6: Move options parsing into API extractorFriedemann Kleint2023-09-201-129/+11
| | | | | | | | | | | Similar to the previous change for the TypeDatabase, add an OptionsParser for ApiExtractor and let it handle the its options directly instead of passing them from main. via ApiExtractor. Many ApiExtractor setters can then be removed. Pick-to: 6.6 Change-Id: I3fe37e2903edcc4f6e4a91181917d008df1e5ca8 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Move options parsing into type databaseFriedemann Kleint2023-09-201-68/+3
| | | | | | | | | | Add TypeDatabaseOptionsParser and let it handle the TypeDatabase options directly instead of passing them from main via ApiExtractor. Many ApiExtractor setters can then be removed. Pick-to: 6.6 Change-Id: Iad6cf1b85b8619540f9282236524ed1c42ef8bf2 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Introduce simple option structFriedemann Kleint2023-09-201-14/+6
| | | | | | | | | | | Add a struct Options to replace the struct CommandLineArguments from main.cpp with built-in handling of the project file. Port the generators over. Pick-to: 6.6 Change-Id: I3012d211761e7a43c709f2754e6846f008ff2b0d Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Move OptionsParser out of the generatorFriedemann Kleint2023-09-191-5/+12
| | | | | | | | | | | | | | | | Move the interface out to a separate class in ApiExtractor so that it can be used for options handling of ApiExtractor and type database as well. Add a class OptionsParserList that aggregates option parser instances. Replace it by static functions creating OptionsParser instances. Pick-to: 6.6 Change-Id: Ic1b3a2020af6d18f682f7026a7e9c2c7ba704d6e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Extract options parser from the generatorsFriedemann Kleint2023-09-191-41/+23
| | | | | | | | | | | | | | | | | | | | This is the beginning of a series of patches simplifying the command line/project file options handling of shiboken. Extract an options parser base class and move helper functions there. Move utility functions into the class. Introduce an enumeration for the source which will be used to discriminate project file path options (single values in repeated lines) from command line path options (delimiter-separated lists) later on. Make the functions returning the OptionDescriptions static per generator. Pick-to: 6.6 Change-Id: Ic49e4c0d440dbda6e3dd119615e70eea5a25651c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Avoid losing warnings with ninjaFriedemann Kleint2023-08-011-1/+1
| | | | | | | | | | | | | | ninja mixes stdout and stderr, causing stderr messages to be lost in shiboken progress messages on stdout. Change the progress messages to be output at the end of the step with a time stamp in past tense. [ChangeLog][shiboken6] The progress messages have been changed to avoid losing warnings with ninja Pick-to: 6.5 Change-Id: Ia33bd5a3af55d268f25d324f3ae496aebef8f7bb Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Log unused rejections and suppressed warningsFriedemann Kleint2023-08-011-0/+9
| | | | | Change-Id: I7e0fd60227d667f35d898ba82a6e151d99e262ea Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* Remove remaining usage of QCoreApplicationFriedemann Kleint2023-07-241-1/+1
| | | | | | | | | Pass arguments to the error message. Amends 0f0f732d91f8cf717283dbfbe67c8875bf191902. Pick-to: 6.5 Change-Id: Ie40c272732468ff3d7b6b0636120710f26309347 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Remove usage of QCoreApplicationFriedemann Kleint2023-05-101-36/+49
| | | | | | | | It was historically needed by QtXmlPatterns, but is no longer needed. Pick-to: 6.5 Change-Id: I4c8fb74138e47d7966c49bb0579b377c3f61898f Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Improve exception messagesFriedemann Kleint2023-05-091-3/+4
| | | | | | | | | Print application name and error prefix in exception handler, so that it is easier to spot them in log files. Pick-to: 6.5 Change-Id: I6a14b2f5ee1e5e60e64b473d622dc3cec74473f3 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Introduce QHashSeedFriedemann Kleint2023-03-221-1/+1
| | | | | | | | | | | | | Qt 6.6 deprecates qSetGlobalQHashSeed() in favor of the class QHashSeed introduced in 6.2 (qtbase/4ef99b8fbb3ba32df5591ac306fe8a7baa31c92c, 7ac0621ad1a649254e7d6175205e7ea22290b4d0). [ChangeLog][PySide6] Class QHashSeed has been added. Pick-to: 6.2 Change-Id: Ie87a945c217e5717b4068ef50303ef96319bb8e1 Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
* shiboken6: Port some loop variables to qsizetypeFriedemann Kleint2022-10-131-1/+1
| | | | | | | | Where possible, used range-based for. Otherwise, use qsizetype for loop variables. Change-Id: I4773bee8468ce73722656ec73845369b7d40d4cd Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Port from qAsConst() to std::as_const()Friedemann Kleint2022-10-131-4/+4
| | | | | | | | qAsConst() will be deprecated in Qt 6.5. Task-number: QTBUG-99313 Change-Id: Ibc7c2e26b0e52cec905a406ef081e0b99bcce50f Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Add an option to print primitive type entriesFriedemann Kleint2022-10-051-0/+11
| | | | | | | | | | This is useful for checking type resolution. Complements 92943cbb530edb4fd8b7292b3b0ea964d7a6fdde. Task-number: PYSIDE-2065 Change-Id: Ia1427787221ac90cf7f923b3eac4972ee206677e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Add command line options for compiler, path and platformFriedemann Kleint2022-09-161-1/+39
| | | | | | | Task-number: PYSIDE-2057 Task-number: PYSIDE-1812 Change-Id: I3b43e7f747df87174c7feec0b29c292d3bddb23c Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Simplify project file and arguments parsingFriedemann Kleint2022-09-151-66/+72
| | | | | | | | | | | Change the project file parsing to use QString instead of QByteArray which allows for splitting out helper functions for the common options of the command line and the project file. Task-number: PYSIDE-2057 Task-number: PYSIDE-1812 Change-Id: Icda57d3b84c3acdb2a98eb4cb6e75ddf7747ff74 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-271-27/+2
| | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: I065150015bdb84a3096b5b39c061cf0a20ab637d Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Remove deprecated QLatin1StringFriedemann Kleint2022-04-251-68/+72
| | | | | | | | | | Introduce a compatibility header to provide the 6.4 API to 6.3 to reduce merge conflicts. Task-number: QTBUG-98434 Pick-to: 6.3 6.2 Change-Id: Iab3f9f894019b4135afa96b930325966348210d0 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Migrate from QLatin1String to UTF-16 string literalsFriedemann Kleint2022-04-251-8/+8
| | | | | | | | | | Use the QStringView overloads of the comparison functions in order to minimize merge conflicts after the deprecation of QLatin1String in 6.4. Task-number: QTBUG-98434 Pick-to: 6.3 6.2 Change-Id: Ia0df398ab8f3e61a0b629971ccbec2273a78499b Reviewed-by: Christian Tismer <tismer@stackless.com>
* Migrate from QLatin1Char to UTF-16 char literalsFriedemann Kleint2022-04-251-14/+14
| | | | | | | | | Preparing for the deprecation of QLatin1Char in 6.4. Task-number: QTBUG-98434 Pick-to: 6.3 6.2 Change-Id: I8bc92aa9f4e6dbfcb12d2025c5a1e760ab4f0d7f Reviewed-by: Christian Tismer <tismer@stackless.com>
* Fix include conventionsFriedemann Kleint2022-04-221-12/+14
| | | | | | | | | Reorder includes such that local includes are first, followed by Qt and C/C++ system includes. Pick-to: 6.3 6.2 Change-Id: Ib801d34de7242befce4be429bfb099ccabe1f987 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Port code to use size() instead of count() of Qt containersFriedemann Kleint2022-03-171-1/+1
| | | | | | | | | | | count() will be deprecated. Fix some integer types in loops and modernize code in changed lines. Pick-to: 6.2 Change-Id: Idf21927661ea6c8866ee36e7c623043271e21620 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Pass more generator options to the api extractorFriedemann Kleint2022-01-171-3/+6
| | | | | | | | | | | Introduce flags representing generator options and pass AvoidProtectedHack besides UsePySideExtensions. Move AvoidProtectedHack to the Generator base class for this purpose. Pick-to: 6.2 Change-Id: I170b5ace30057c4074d73afce3f88d086eb54775 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* Documentation: Fix missing signal/slot lists in class documentationFriedemann Kleint2021-10-011-2/+1
| | | | | | | | | | | | | | | | | | shiboken needs to run with pyside extensions to parse the Qt annoations correctly. Change 62c21af778b7bff6c86e7f89ef03a87efa6c51cb moved the compiler defines from the pyside global header into shiboken. This caused the function type detection to fail in the doc generator since it did not pyside extensions and thus signals/slots were listed as normal functions. To fix this, move the --enable-pyside-extensions option to the base class Generator and add it to documentation's CMakeLists.txt. Pick-to: 6.2 5.15 Change-Id: I70142367ee01839d8e44cbf31e894991cf941197 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Introduce conditional processing instructions to typesystem XMLFriedemann Kleint2021-06-091-0/+15
| | | | | | | | | | | Add ConditionalStreamReader as replacement for QXmlStreamReader, handling Processing Instructions to exclude/include sections depending on keywords. Task-number: PYSIDE-802 Task-number: PYSIDE-1568 Change-Id: I1e2151849e79189943f49313137879bbf6ba3665 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Make command line errors easier to detectFriedemann Kleint2021-06-021-2/+3
| | | | | | | | Output the arguments line by line to show CMake quoting errors. Pick-to: 6.1 Change-Id: I80958f10fa90b6adc5719653f93b4e28771ce261 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Add option to use global headersFriedemann Kleint2021-05-101-0/+9
| | | | | | | | | | | | | shiboken6 historically expected a global header consisting of #include directives for the desired headers which was excluded from the generated code. Make it possible to use class headers directly with a command line option. Pick-to: 6.1 6.1.0 Task-number: PYSIDE-1338 Change-Id: I4543be888136736deb2612abc27dfc04e177e469 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Brush up class FileOutFriedemann Kleint2021-03-111-2/+2
| | | | | | | | Rename member variables according to m_ convention, add setters and getters. Remove unused API and inheritance of QObject. Change-Id: I9fbde5c17c2ad38c672620fb4a6525c6f1a13c2a Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: No longer crash on fatal errorsFriedemann Kleint2021-03-101-1/+15
| | | | | | | | | | | | | shiboken has some fatal errors which are too deeply nested to catch with return values. Introduce exception handling to handle this. Add an exception class and replace the existing qFatal() calls by a exceptions. Wrap a try/catch around main() and the tester helper. Change-Id: I03243849dc299f7696ef73d9d4123480ac5cbd66 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Enable setting clang optionsFriedemann Kleint2021-01-201-0/+22
| | | | | | | | | | | Add command line options --clang-option, --clang-options to be able to pass options. Allow for a complete replacement of the built-in compiler support options by specifying '-' as the first option. Task-number: PYSIDE-1477 Change-Id: Ibcb107e5d0c4dedb56ab07e83af4203f0f682850 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Refactor options parsingFriedemann Kleint2021-01-201-76/+102
| | | | | | | | | | | | 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: Refactor parsing project filesFriedemann Kleint2021-01-201-22/+26
| | | | | | | | | | | Use a std::optional<CommandLineArguments> as return value. An error can then be distinguished from an empty map. Add error handling for failing to open a project file which was previously ignored. Task-number: PYSIDE-1477 Change-Id: I69fa5e149818c8186755810c013232aa40d03dd9 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken6: Fix parsing of project filesFriedemann Kleint2021-01-201-1/+1
| | | | | | | | | | For key/value pairs specified without space after '=', the key would be truncated. Pick-to: 6.0 Pick-to: 5.15 Change-Id: I154b1685ca8aab2f13fb916290cde17bc972afea Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Use initializer lists for option descriptionsFriedemann Kleint2021-01-201-48/+45
| | | | | | | Task-number: PYSIDE-1477 Change-Id: I9d5734c96824ff40360d6a4197ed8bb69c09cb0b Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken6: Introduce class ApiExtractorResultFriedemann Kleint2020-12-221-3/+6
| | | | | | | | | | | | | | Separate the generators from ApiExtractor by introducing a class ApiExtractorResult storing the results of an ApiExtractor run. Move some query functions there. With that, some generator functions can already be made static by passing the ApiExtractorResult and OverloadData can be decoupled from the generator. Pick-to: 6.0 Change-Id: Iaba3ebff4aecb722eec4a606423738260983d905 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Rename shiboken2 to shiboken6Friedemann Kleint2020-10-281-0/+649
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>