diff options
author | Stephen Kelly <steveire@gmail.com> | 2017-01-15 00:56:24 +0000 |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2017-01-15 11:19:31 +0000 |
commit | dec469837d646351bd4288fa3390682f96b3e37c (patch) | |
tree | da4ceedf2a4d2ea6f61ac1043fdad48d37536654 | |
parent | c81d97caa5be62041c67265fffe78ab227150661 (diff) | |
download | extra-cmake-modules-dec469837d646351bd4288fa3390682f96b3e37c.tar.gz extra-cmake-modules-dec469837d646351bd4288fa3390682f96b3e37c.tar.bz2 |
Bindings: Skip implementations of inline methods while parsing
Don't process the same function name twice.
-rw-r--r-- | find-modules/sip_generator.py | 6 | ||||
-rw-r--r-- | tests/GenerateSipBindings/cpplib.h | 15 |
2 files changed, 21 insertions, 0 deletions
diff --git a/find-modules/sip_generator.py b/find-modules/sip_generator.py index 7df9de3d..8845c81e 100644 --- a/find-modules/sip_generator.py +++ b/find-modules/sip_generator.py @@ -434,6 +434,12 @@ class SipGenerator(object): :param level: Recursion level controls indentation. :return: A string. """ + if container.kind == CursorKind.TRANSLATION_UNIT and \ + (function.semantic_parent.kind == CursorKind.CLASS_DECL or + function.semantic_parent.kind == CursorKind.STRUCT_DECL) and \ + function.is_definition(): + # Skip inline methods + return def skippable_attribute(member, text): """ diff --git a/tests/GenerateSipBindings/cpplib.h b/tests/GenerateSipBindings/cpplib.h index 3ae9448a..dd797a9c 100644 --- a/tests/GenerateSipBindings/cpplib.h +++ b/tests/GenerateSipBindings/cpplib.h @@ -21,6 +21,8 @@ class MyObject : public QObject public: MyObject(QObject* parent = nullptr); + inline MyObject(const QString& inlineCtor, QObject* parent = nullptr); + enum LocalEnum { Val1 = 1, Val2 @@ -44,6 +46,8 @@ public: int qtEnumTest(QFlags<Qt::MatchFlag> flags); int localEnumTest(QFlags<MyObject::LocalEnum> flags); + inline int inlineMethod(int arg); + int functionParam(std::function<int()> fn); int groups(unsigned int maxCount = std::numeric_limits<uint>::max()) const; @@ -86,6 +90,17 @@ private Q_SLOTS: void privateSlot2(); }; +inline MyObject::MyObject(const QString& inlineCtor, QObject* parent) + : MyObject(parent) +{ + +} + +inline int MyObject::inlineMethod(int arg) +{ + return arg; +} + class LocalFwdDecl { public: |