diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-12-06 14:47:01 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-12-09 12:37:01 +0000 |
commit | cbf16457aa223154a8e2956a09bca393d5c95242 (patch) | |
tree | 85591388b2c7ffb20cd9802d9ef8593e6bc9955b /sources/shiboken2/ApiExtractor/abstractmetalang.cpp | |
parent | 58720761d8b3c22d65d2bee1d064ce55cee62b0f (diff) |
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 <alexandru.croitor@qt.io>
Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken2/ApiExtractor/abstractmetalang.cpp')
-rw-r--r-- | sources/shiboken2/ApiExtractor/abstractmetalang.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
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); |