From cbf16457aa223154a8e2956a09bca393d5c95242 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 6 Dec 2017 14:47:01 +0100 Subject: shiboken: Stop using the FinalInCpp attribute for classes Besides its use for functions, the FinalInCpp attribute was used for classes meaning something like neither the class nor its derived classes can be constructed due to presence of private destructors and absence of non-private constructors. Since 'final' is now a reserved word in C++ 11, this becomes confusing. Remove the usage of the attribute for classes, add a bit field indicating presence of a private constructors and a new function isConstructible() instead. Change-Id: Ieb2f9943c21511e4f59d228885361e3ad66fb266 Reviewed-by: Alexandru Croitor Reviewed-by: Christian Tismer --- sources/shiboken2/ApiExtractor/abstractmetalang.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'sources/shiboken2/ApiExtractor/abstractmetalang.cpp') diff --git a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp index f442da5ec..ae71597bd 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetalang.cpp +++ b/sources/shiboken2/ApiExtractor/abstractmetalang.cpp @@ -1330,6 +1330,7 @@ AbstractMetaClass::AbstractMetaClass() m_hasNonpublic(false), m_hasVirtualSlots(false), m_hasNonPrivateConstructor(false), + m_hasPrivateConstructor(false), m_functionsFixed(false), m_hasPrivateDestructor(false), m_hasProtectedDestructor(false), @@ -1801,10 +1802,8 @@ bool AbstractMetaClass::hasProtectedMembers() const bool AbstractMetaClass::generateShellClass() const { return m_forceShellClass || - (!isFinal() - && (hasVirtualFunctions() - || hasProtectedFunctions() - || hasFieldAccessors())); + (isConstructible() + && (m_hasVirtuals || hasProtectedFunctions() || hasFieldAccessors())); } QPropertySpec *AbstractMetaClass::propertySpecForRead(const QString &name) const @@ -2595,7 +2594,7 @@ void AbstractMetaClass::fixFunctions() // Make sure class is abstract if one of the functions is if (func->isAbstract()) { (*this) += AbstractMetaAttributes::Abstract; - (*this) -= AbstractMetaAttributes::Final; + (*this) -= AbstractMetaAttributes::FinalInTargetLang; } if (func->isConstructor()) { @@ -2615,7 +2614,7 @@ void AbstractMetaClass::fixFunctions() if (hasPrivateConstructors && !hasPublicConstructors) { (*this) += AbstractMetaAttributes::Abstract; - (*this) -= AbstractMetaAttributes::Final; + (*this) -= AbstractMetaAttributes::FinalInTargetLang; } setFunctions(funcs); -- cgit v1.2.3