aboutsummaryrefslogtreecommitdiff
path: root/find-modules/sip_generator.py
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2019-01-18 19:16:55 +0100
committerAlbert Astals Cid <aacid@kde.org>2019-01-18 19:17:17 +0100
commita2a404f9f9247a2b442073a744386dae69665b6a (patch)
tree6be8970fb411b3020968a7d01ab1abc2fb56b3ae /find-modules/sip_generator.py
parent79bf23008f666b358b03a70068bf6ae27a9b1967 (diff)
downloadextra-cmake-modules-a2a404f9f9247a2b442073a744386dae69665b6a.tar.gz
extra-cmake-modules-a2a404f9f9247a2b442073a744386dae69665b6a.tar.bz2
Fix python binding generation for classes with deleted copy constructors
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
Diffstat (limited to 'find-modules/sip_generator.py')
-rw-r--r--find-modules/sip_generator.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/find-modules/sip_generator.py b/find-modules/sip_generator.py
index 8dcab566..20e55ce8 100644
--- a/find-modules/sip_generator.py
+++ b/find-modules/sip_generator.py
@@ -39,7 +39,7 @@ import re
import sys
import traceback
from clang import cindex
-from clang.cindex import AccessSpecifier, CursorKind, SourceRange, StorageClass, TokenKind, TypeKind, TranslationUnit
+from clang.cindex import AccessSpecifier, AvailabilityKind, CursorKind, SourceRange, StorageClass, TokenKind, TypeKind, TranslationUnit
import rules_engine
@@ -210,6 +210,7 @@ class SipGenerator(object):
base_specifiers = []
template_type_parameters = []
had_copy_constructor = False
+ had_deleted_copy_constructor = False;
had_const_member = False
for member in container.get_children():
#
@@ -291,7 +292,13 @@ class SipGenerator(object):
numParams += 1
return numParams == 0
- had_copy_constructor = had_copy_constructor or is_copy_constructor(member)
+ if is_copy_constructor(member):
+ had_copy_constructor = True
+ # We need to generate a fake private copy constructor for deleted constructors
+ if member.availability == AvailabilityKind.NOT_AVAILABLE and member.access_specifier != AccessSpecifier.PRIVATE:
+ had_deleted_copy_constructor = True
+ continue
+
#
# Discard almost anything which is private.
#
@@ -364,7 +371,7 @@ class SipGenerator(object):
#
# Generate private copy constructor for non-copyable types.
#
- if had_const_member and not had_copy_constructor:
+ if (had_deleted_copy_constructor) or (had_const_member and not had_copy_constructor):
body += " private:\n {}(const {} &); // Generated\n".format(name, container.type.get_canonical().spelling)
#
# Flesh out the SIP context for the rules engine.