From: Friedemann Kleint Date: Tue, 11 Apr 2023 12:38:01 +0000 (+0200) Subject: shiboken2: Fix build with clang 16 X-Git-Tag: archive/raspbian/5.15.14-1+rpi1^2^2~10 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c6b1010757a7c16a7ff9979d1f3dca97d17d00e1;p=pyside2.git shiboken2: Fix build with clang 16 getCursorSpelling() reports a name for unnamed enums. Pick-to: 6.5 6.2 5.15 Task-number: PYSIDE-2288 Change-Id: Iaeb6409c8825dc0fb2720b450fb14e64bbf5d303 Reviewed-by: Adrian Herrmann Reviewed-by: Shyamnath Premnadh (cherry picked from commit e20e1ea0f5f9f9a0fe1c309a60cb5297f1276efc) Gbp-Pq: Name shiboken2-Fix-build-with-clang-16.patch --- diff --git a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp index ebe3b99..e8e5bcf 100644 --- a/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp +++ b/sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp @@ -895,6 +895,8 @@ static NamespaceType namespaceType(const CXCursor &cursor) static QString enumType(const CXCursor &cursor) { QString name = getCursorSpelling(cursor); // "enum Foo { v1, v2 };" + if (name.contains(u"unnamed enum")) // Clang 16.0 + return {}; if (name.isEmpty()) { // PYSIDE-1228: For "typedef enum { v1, v2 } Foo;", type will return // "Foo" as expected. Care must be taken to exclude real anonymous enums.