aboutsummaryrefslogtreecommitdiffstats
path: root/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.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/clangparser/clangbuilder.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/clangparser/clangbuilder.cpp')
-rw-r--r--sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp
index 232a9ce40..d2ac713b9 100644
--- a/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp
+++ b/sources/shiboken6/ApiExtractor/clangparser/clangbuilder.cpp
@@ -971,6 +971,8 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor)
d->setFileName(cursor, d->m_currentEnum.data());
d->m_currentEnum->setScope(d->m_scope);
d->m_currentEnum->setEnumKind(kind);
+ if (clang_getCursorAvailability(cursor) == CXAvailability_Deprecated)
+ d->m_currentEnum->setDeprecated(true);
d->m_currentEnum->setSigned(isSigned(clang_getEnumDeclIntegerType(cursor).kind));
if (!qSharedPointerDynamicCast<_ClassModelItem>(d->m_scopeStack.back()).isNull())
d->m_currentEnum->setAccessPolicy(accessPolicy(clang_getCXXAccessSpecifier(cursor)));
@@ -992,6 +994,8 @@ BaseVisitor::StartTokenResult Builder::startToken(const CXCursor &cursor)
EnumeratorModelItem enumConstant(new _EnumeratorModelItem(d->m_model, name));
enumConstant->setStringValue(d->cursorValueExpression(this, cursor));
enumConstant->setValue(enumValue);
+ if (clang_getCursorAvailability(cursor) == CXAvailability_Deprecated)
+ enumConstant->setDeprecated(true);
d->m_currentEnum->addEnumerator(enumConstant);
}
break;