aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken2/generator/main.cpp
Commit message (Collapse)AuthorAgeFilesLines
* shiboken: Replace 'typedef' by 'using'Friedemann Kleint2019-06-251-2/+2
| | | | | | | | 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>
* Cleanup pointer whitespace everywhereChristian Tismer2019-06-241-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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: Refactor progress message output handlingFriedemann Kleint2019-04-301-1/+4
| | | | | | | | | | | | In class ReportHandler, replace the step counting by a simple pair of startProgress()/endProgress() functions that check for warnings and print the appropriate terminator. Module name and timestamp are now also printed. Add a few more messages and give proper names to the generators. Change-Id: I92b4ef2854b824fbba3d371417edc1f88561a2cb Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Output module name in "done" messageFriedemann Kleint2019-04-251-9/+2
| | | | | | | | Move the formatting of the "done" message to the report handler and add the prefix, which is the module name. Change-Id: I63aa1f48f02709d6e89d9a9a684d56a218e65fd3 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Allow for include paths with relative directoriesFriedemann Kleint2019-04-041-2/+4
| | | | | | | | | | Resolve the absolute file paths of the code model items against the include paths of shiboken to reconstruct the relative paths. Change-Id: Id0f793315b01c0fc65a4cfb26b3372f9c6688872 Fixes: PYSIDE-975 Reviewed-by: Volker Aßmann <volker.assmann@gmail.com> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
* shiboken: Replace unused typedef referencing QLinkedListFriedemann Kleint2019-04-021-3/+0
| | | | | Change-Id: I350bfb27d5f7403edbe3062895df3812728e2290 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* Replace QString::null/isNull() by QString()/isEmpty()Friedemann Kleint2019-02-061-1/+1
| | | | | | | | | | | | | | Fix warnings appearing in Qt 5.13: sources/shiboken2/generator/shiboken2/shibokengenerator.cpp:873:25: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/shibokengenerator.cpp:873:25: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/shibokengenerator.cpp:880:25: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/shibokengenerator.cpp:880:25: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/cppgenerator.cpp:5060:34: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations] sources/shiboken2/generator/shiboken2/cppgenerator.cpp:5060:34: warning: ‘QString::null’ is deprecated: use QString() [-Wdeprecated-declarations] Change-Id: I7c938df64babf824b58bf5c785b281a88d5111db Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Add option to skip deprecated functionsFriedemann Kleint2019-01-311-0/+8
| | | | | | | | | | | | | Pass the "deprecated" annotation from Clang into the meta language and reject functions based on it when the the command line option --skip-deprecated is set. By default, have Python output a deprecation warning when a deprecated function is called (which is visible when passing -Wd). Task-number: PYSIDE-487 Change-Id: Ic28d82963fde11f258b2559b562d3f24017fe98d Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Centralize most msg* functions in a separate fileFriedemann Kleint2018-09-101-20/+1
| | | | | | | | | This makes it easier to maintain a consistent style, unclutters the source and allows for re-using formatting helpers. Change-Id: I4f29637a22afb457f629272e2d86f14bedb36008 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Replace some character #defines by char constantsFriedemann Kleint2018-09-041-10/+12
| | | | | | | | | | | | | | | Change defines to variables where possible (not used in string literal concatenations). Remove constants only used in one file from the header. Change regular expressions to raw string literals for clarity. Replace static instance of the CONVERTTOCPP regular expressions by an accessor of ShibokenGenerator. Change PATH_SPLITTER in main.cpp define to a QChar constant. Change-Id: If6766e0467ca2c635788240414c984d60feef875 Reviewed-by: Christian Tismer <tismer@stackless.com>
* Merge remote-tracking branch 'origin/5.11' into devFriedemann Kleint2018-08-021-0/+3
|\ | | | | | | Change-Id: Id7cf17491d2bc97f90ccd1db44837b6b66e90eb8
| * shiboken: Work around non-deterministic buildsFriedemann Kleint2018-07-261-0/+3
| | | | | | | | | | | | | | | | Request deterministic ordering of QHash. Task-number: PYSIDE-757 Change-Id: Ifec8f9d39cb183cffeb58440156204f2ccb56a2c Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken: Output type database in debug modeFriedemann Kleint2018-07-241-1/+3
| | | | | | | | | | Change-Id: Id481aa5593c02c32656b141eaab6af800f978ebe Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | Fix some clang-tidy warnings in shibokenFriedemann Kleint2018-07-231-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - '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 options for diff and dry-runFriedemann Kleint2018-07-231-0/+20
| | | | | | | | | | | | | | | | | | Refactor and breathe life back into the existing diff/dry-run functionality of class FileOut and make it available via command line options. Change-Id: I32e1e262c0c2e8f107776923477fe9714ad295cf Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* | shiboken: Fix command line helpFriedemann Kleint2018-07-191-4/+4
| | | | | | | | | | | | | | | | | | The one-character path options only take one path argument. Add parameter to the doc generator options. Task-number: PYSIDE-363 Change-Id: Ia1a0c1552a5d1e3ec86609e9899e985628874545 Reviewed-by: Christian Tismer <tismer@stackless.com>
* | shiboken: Refactor command line arguments handlingFriedemann Kleint2018-07-161-148/+115
|/ | | | | | | | | | | 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: No longer hard-code the C++ language levelFriedemann Kleint2018-06-271-0/+30
| | | | | | | | | | | | | | | | | | | The C++ language level was previously hard-coded in the default options. This is potentially problematic for projects using shiboken and also fell apart with Qt 5.12, where the experimental level "c++1z" used for MSVC2017/Clang 4 no longer works due to not being able to handle enumerator value deprecation attributes. Introduce an enumeration to represent the level and add functions to convert back to and forth to the respective Clang option. Add an option to shiboken. Add a function returning a default value for the emulated compiler, returning C++ 14 or C++1Z for the CMSVC2017/Clang 4 case. Task-number: PYSIDE-724 Change-Id: Ie7e19bf7f099a34e6cdaad4b462157a9a3ee8797 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: Add command line options for system include pathsFriedemann Kleint2018-06-221-18/+32
| | | | | | | | | Refactor class HeaderPath to contain an enumeration for the type instead of the boolean framework flag and add handling. Task-number: PYSIDE-693 Change-Id: I60a62b831ddd5ce7519a066135854ff723db2fc6 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: Accept relative file name as C++ headerFriedemann Kleint2018-04-271-1/+7
| | | | | | | | | | | Relative file names cause Clang not to find them since they are included by a temporary header file. Check and convert to an absolute path via QFileInfo. Change-Id: Ie87b4d2a6fcf5d98062a8a40a3eccbbb9513c62e Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Reformat helpFriedemann Kleint2018-04-191-8/+15
| | | | | | | | | Print option descriptions indented by 8 below the option instead of beside the option at column 38 and add some newlines to avoid wrapping. Change-Id: I63295a40aaac588f761c5964b68dbaff8d013c95 Reviewed-by: Christian Tismer <tismer@stackless.com>
* shiboken: replace first()/last() by constFirst/constLast()Friedemann Kleint2018-01-171-4/+3
| | | | | | | | Fix clazy warnings about possibly detaching containers. Change-Id: I3c3a229de5e0c71f17c1f26273e1b0be3b0d7e81 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Prefix all warning messages by base prefix of typesystem fileFriedemann Kleint2017-08-231-0/+4
| | | | | | | | shiboken is run in parallel when building PySide2, so it is sometimes hard to tell where warnings come from. Change-Id: Iaccd91543e14e6e9c38ebfa2b0c285417f924d03 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken: Further refactor command line arguments and helpFriedemann Kleint2017-06-091-44/+58
| | | | | | | | | | | | | | Replace the QMap of options returned by the generators by a vector of pairs to allow for specifying the order. This allows for better formatting -I/-F/-T in multiple lines. Add -h for help. Move the missing typelib file handling into main and print a help hint there. Change-Id: I5a95bd8d193be012aaa7ce3934945b25e21d3f79 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
* shiboken2: Refactor path argument handlingFriedemann Kleint2017-06-071-21/+60
| | | | | | | | | | | | | | | | Previously, shiboken2 accepted path arguments of the format --option=path1;path2 using the native OS separator character. This poses a problem when writing cross-platform .pro files for applications. Refactor the code to allow for the options to occur multiple times on the command line and introduce short-hand options -I, -F, -T for includes, framework includes and type system paths to reduce command line length. Task-number: PYSIDE-526 Change-Id: Ice540cbffeb01841988a99fdeb84bb7ba969ed79 Reviewed-by: Christian Tismer <tismer@stackless.com>
* move everying into sources/shiboken2 (5.9 edition)Oswald Buddenhagen2017-05-221-0/+552
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.