aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/parser/codemodel.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-08-22 13:51:25 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2022-08-22 16:04:17 +0200
commitc6158c851304fb6d154f37ade7fe7beab11771f2 (patch)
tree87ec41ca3917aec376545649c71629bd6262e3f8 /sources/shiboken6/ApiExtractor/parser/codemodel.cpp
parentc9269fc4e55b467773d80cfb05739b3b11a0b35d (diff)
shiboken6: Propagate C++ enum deprecation
Add AbstractMetaEnum::isDeprecated() and AbstractMetaEnumValue::isDeprecated() which are set by the clang parser for deprecated enums and values (for example, QVariant::Type). As a drive-by, streamline the debug output of the enums, removing the repretitive EnumValue type name. Task-number: PYSIDE-1735 Change-Id: I4c98965ca4a948f5f084f781914194e5bf4d4ea2 Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'sources/shiboken6/ApiExtractor/parser/codemodel.cpp')
-rw-r--r--sources/shiboken6/ApiExtractor/parser/codemodel.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/sources/shiboken6/ApiExtractor/parser/codemodel.cpp b/sources/shiboken6/ApiExtractor/parser/codemodel.cpp
index 4099caa2c..4e8d2efc1 100644
--- a/sources/shiboken6/ApiExtractor/parser/codemodel.cpp
+++ b/sources/shiboken6/ApiExtractor/parser/codemodel.cpp
@@ -1305,6 +1305,16 @@ void _EnumModelItem::setSigned(bool s)
m_signed = s;
}
+bool _EnumModelItem::isDeprecated() const
+{
+ return m_deprecated;
+}
+
+void _EnumModelItem::setDeprecated(bool d)
+{
+ m_deprecated = d;
+}
+
#ifndef QT_NO_DEBUG_STREAM
void _EnumModelItem::formatDebug(QDebug &d) const
{
@@ -1319,6 +1329,8 @@ void _EnumModelItem::formatDebug(QDebug &d) const
d << " (class)";
break;
}
+ if (m_deprecated)
+ d << " (deprecated)";
if (!m_signed)
d << " (unsigned)";
formatModelItemList(d, ", enumerators=", m_enumerators);
@@ -1338,11 +1350,23 @@ void _EnumeratorModelItem::setStringValue(const QString &value)
m_stringValue = value;
}
+bool _EnumeratorModelItem::isDeprecated() const
+{
+ return m_deprecated;
+}
+
+void _EnumeratorModelItem::setDeprecated(bool d)
+{
+ m_deprecated = d;
+}
+
#ifndef QT_NO_DEBUG_STREAM
void _EnumeratorModelItem::formatDebug(QDebug &d) const
{
_CodeModelItem::formatDebug(d);
d << ", value=" << m_value << ", stringValue=\"" << m_stringValue << '"';
+ if (m_deprecated)
+ d << " (deprecated)";
}
#endif // !QT_NO_DEBUG_STREAM