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/abstractmetabuilder.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/abstractmetabuilder.cpp')
-rw-r--r-- | sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp index fc990deb7..b7b99bb0a 100644 --- a/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp +++ b/sources/shiboken2/ApiExtractor/abstractmetabuilder.cpp @@ -593,7 +593,8 @@ void AbstractMetaBuilderPrivate::traverseDom(const FileModelItem &dom) << QStringLiteral("class '%1' does not have an entry in the type system") .arg(cls->name()); } else { - const bool couldAddDefaultCtors = !cls->isFinalInCpp() && !cls->isInterface() && !cls->isNamespace() + const bool couldAddDefaultCtors = cls->isConstructible() + && !cls->isInterface() && !cls->isNamespace() && (cls->attributes() & AbstractMetaAttributes::HasRejectedConstructor) == 0; if (couldAddDefaultCtors) { if (!cls->hasConstructors()) @@ -1735,8 +1736,10 @@ void AbstractMetaBuilderPrivate::traverseFunctions(ScopeModelItem scopeItem, } const bool isInvalidDestructor = metaFunction->isDestructor() && metaFunction->isPrivate(); - const bool isInvalidConstructor = metaFunction->isConstructor() - && (metaFunction->isPrivate() && metaFunction->functionType() == AbstractMetaFunction::ConstructorFunction); + const bool isInvalidConstructor = metaFunction->functionType() == AbstractMetaFunction::ConstructorFunction + && metaFunction->isPrivate(); + if (isInvalidConstructor) + metaClass->setHasPrivateConstructor(true); if ((isInvalidDestructor || isInvalidConstructor) && !metaClass->hasNonPrivateConstructor()) { *metaClass += AbstractMetaAttributes::Final; |