diff options
| author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-07-25 12:54:21 +0200 |
|---|---|---|
| committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-07-25 16:04:28 +0200 |
| commit | c06f7743b9a35f90cade1b653a4842c6fab70c06 (patch) | |
| tree | 27d0b68e1d8abc21337912a8c5d3ddf421c474bb /sources/shiboken6/ApiExtractor/abstractmetafunction.cpp | |
| parent | c8ad350819b8c5134cfb86239b8f447a18245e44 (diff) | |
shiboken6: Make it possible to override a C++ deprecation attribute
Pick-to: 6.5
Task-number: PYSIDE-2394
Change-Id: Ib5af48820eafdd9767a30317bea6526f9cb799ea
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
Diffstat (limited to 'sources/shiboken6/ApiExtractor/abstractmetafunction.cpp')
| -rw-r--r-- | sources/shiboken6/ApiExtractor/abstractmetafunction.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp b/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp index 4dc9b3611..7b4d27b8b 100644 --- a/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp +++ b/sources/shiboken6/ApiExtractor/abstractmetafunction.cpp @@ -28,6 +28,8 @@ #include <QtCore/QDebug> #include <QtCore/QRegularExpression> +#include <algorithm> + using namespace Qt::StringLiterals; // Cache FunctionModificationList in a flat list per class (0 for global @@ -701,15 +703,22 @@ void AbstractMetaFunction::addArgument(const AbstractMetaArgument &argument) d->m_arguments << argument; } +static bool modifiedDeprecated(const FunctionModification &mod) +{ + return mod.modifiers().testFlag(FunctionModification::Deprecated); +} + +static bool modifiedUndeprecated(const FunctionModification &mod) +{ + return mod.modifiers().testFlag(FunctionModification::Undeprecated); +} + bool AbstractMetaFunction::isDeprecated() const { - if (d->m_attributes.testFlag(Attribute::Deprecated)) - return true; - for (const auto &modification : modifications(declaringClass())) { - if (modification.isDeprecated()) - return true; - } - return false; + const auto &mods = modifications(declaringClass()); + return d->m_attributes.testFlag(Attribute::Deprecated) + ? std::none_of(mods.cbegin(), mods.cend(), modifiedUndeprecated) + : std::any_of(mods.cbegin(), mods.cend(), modifiedDeprecated); } bool AbstractMetaFunction::isConstructor() const |
