aboutsummaryrefslogtreecommitdiff
path: root/find-modules/sip_generator.py
AgeCommit message (Collapse)Author
2021-10-05Fix ECM on systems without PyQt5 on Python 2Nyan Pasu
2021-07-13Fix typos found by codespellChristophe Giboudeaux
GIT_SILENT
2020-12-13Fix errors in python code, found by pylama in a strict CIDavid Faure
2020-06-14extra-cmake-modules: Convert to SPDX license statementsAndreas Cord-Landwehr
2019-12-05EBN extra-cmake-modules comments spelling cleanupJohn Hayes
Summary: Correct spelling in extra-cmake-modules comments. Reviewers: apol Reviewed By: apol Subscribers: kde-frameworks-devel, kde-buildsystem Tags: #frameworks, #build_system Differential Revision: https://phabricator.kde.org/D25752
2019-01-18Fix python binding generation for classes with deleted copy constructorsAlbert Astals Cid
Test Plan: kcoreaddons compiles again Reviewers: lbeltrame Reviewed By: lbeltrame Subscribers: cgiboudeaux, skelly, kde-frameworks-devel, kde-buildsystem Tags: #frameworks, #build_system Differential Revision: https://phabricator.kde.org/D18345
2018-09-14Bindings: Correct handling of sources containing utf-8Stefan Brüns
Summary: Depending on the locale, python3 may try to decode the source as ASCII when the file is opened in text mode. This will fail as soon as the code contains utf-8, e.g. (c) symbols. While it is possible to specify the encoding when reading the file, this is bad for several reasons: - only a very small part of the source is processed via _read_source, no need to decode the complete source and store it as string objects - the clang Cursor.extent.{start,end}.column refers to bytes, not multibyte characters. While python2 processes utf-8 containing sources without error messages, wrong extent borders are also an issue. The practical impact is low, as the issue only manifests if there is a multibyte character in front of *and* on the same line as the read token. Test Plan: Python3: Build any bindings which contains sources with non-ASCII codepoints, e.g. kcoreaddons. Unpatched version fails when using e.g. LANG=C. Python2: Both versions generate sources successfully. Bytes vs characters test: ``` #define Q_SLOTS class foo { /* a */ public Q_SLOTS: /* ä */ public Q_SLOTS: }; ``` `sip_generator.py --flags "" /usr/lib64/libclang.so Qt5Ruleset.py test.h out.sip` Obviously, both lines should result in the same code, the unfixed version generates `public Q_SLOTS:` vs `public:`. Reviewers: #frameworks, lbeltrame Reviewed By: lbeltrame Subscribers: lbeltrame, bcooksley, jtamate, kde-frameworks-devel, kde-buildsystem Tags: #frameworks, #build_system Differential Revision: https://phabricator.kde.org/D15068
2018-08-25Bindings: Add support for scoped enumsStefan Brüns
Summary: Keep the enum intact by emitting the class keyword in case the enum is scoped. Use the complete enum scope for parameter values, the enclosing scope is only correct to use for unscoped enums. The python Cursor.is_scoped_enum() method has been added with LLVM/Clang version 5.0. BUG: 397154 Test Plan: build kcoreaddons Reviewers: #frameworks, mpyne Reviewed By: mpyne Subscribers: mpyne, kde-frameworks-devel, kde-buildsystem Tags: #frameworks, #build_system Differential Revision: https://phabricator.kde.org/D14908
2017-02-05Revert "Automatically mark classes with pure virtual functions as /Abstract/."Stephen Kelly
With some combination of PyQt/compiler this breaks the build of kcoreaddons. This reverts commit 2e20aeab6e86670a66ff99a7b79120c4004b4d22.
2017-02-04Bindings: Remove unused memberv5.31.0-rc1v5.31.0Stephen Kelly
This should have been removed in a prior commit.
2017-02-04Automatically mark classes with pure virtual functions as /Abstract/.Shaheed Haque
2017-02-04Bindings: Take account of visibility of classesShaheed Haque
2017-02-04Bindings: Take account of visibility attribute on APIsShaheed Haque
Don't export API which has visibility "hidden". Visibility attributes on variables are ignored, but call the generic method anyway. Remove checks for macros which obscure the attributes. Processing the attribute directly means that is not needed.
2017-02-04Bindings: Generalize the skippable_attribute methodStephen Kelly
De-duplicate it between variables and functions. The callers already handle reporting the removal.
2017-02-04Bindings: Remove unused methodStephen Kelly
2017-01-31Bindings: Remove unused importStephen Kelly
2017-01-31Remove delimiters from licence headerStephen Kelly
2017-01-18Bindings: Fix default param handlingStephen Kelly
Clang API is odd.
2017-01-18Bindings: Handle const-ref of non-record parameter defaultsStephen Kelly
2017-01-18Bindings: Handle const-ref parameters with {} initializerStephen Kelly
2017-01-18Bindings: Handle parameter initializers using {} gracefullyStephen Kelly
2017-01-18Bindings: Add explicit handling of nullptr as a parameter defaultStephen Kelly
Don't prepend a namespace to it as we do otherwise with enum/flags.
2017-01-15Bindings: Make it possible for rules to modify the typedef typeStephen Kelly
Allow modifying the name also.
2017-01-15Bindings: Skip implementations of inline methods while parsingStephen Kelly
Don't process the same function name twice.
2017-01-15Bindings: Fix handling of forward declarationsStephen Kelly
It is not appropriate to decorate each forward declaration with the SIP attribute /External/. That is only needed for forward declarations of types which are defined in a different module. Local forward declarations can be omitted from the sip code. In sip code, a forward declaration followed later by a full class definition is an error. Omit forward declarations unless they are decorated with the external attribute. Introduce a rules database for consumers to decorate them with the attribute as required.
2017-01-15Bindings: Use lists in function API instead of stringsStephen Kelly
Custom rules should be able to deal with lists in these cases. This is already the case for function parameters.
2017-01-13Bindings: Add rules engine for typedefsStephen Kelly
Currently this is rather simple, allowing only matching typedefs by name. If we need more later, we can extend the interface. This will make it possible to add bindings for the K18n framework.
2017-01-13Bindings: Implement ModuleCode and MethodCode databasesStephen Kelly
2017-01-11Bindings: Use diagnostic level specific text when reportingStephen Kelly
Don't use the text 'Parse error' for warnings, which might confuse IDEs.
2017-01-11Bindings: Fix logging output severity for parsing messagesStephen Kelly
The Python logging module uses logging severities with numerical values which form a sequence in steps of 10. The Clang cindex.Diagnostic numerical values use a step size of 1, so the two are incompatible. Introduce a mapping function so that appropriate errors get issued when attempting to build the bindings. The logging module has one surplus diagnostic level, but we simply never use it. BUG: 374801
2017-01-10Bindings: Correctly handle access specifiers within macrosStephen Kelly
The Q_DECLARE_TR_FUNCTIONS macro contains a `public:` access specifier, but the sip_generator just pastes the entire macro name. Adjust the generator to extract the correct access specifier.
2017-01-05Bindings: Improve diagnostics for the rules engineShaheed Haque
Note which rule has a modification effect.
2017-01-05Skip attributes on enums when generating bindingsShaheed Haque
2016-10-31Add the rules_engine and sip_generatorShaheed Haque
These files process C++ headers with libclang and python-clang bindings, using the AST to generate SIP files for PyQt binding library generation. The design allows for further extensions which can process other artifacts found in headers. This iteration of the design is a simple minimum which suffices to generate headers for KItemModels and some other libraries.