From c6b1010757a7c16a7ff9979d1f3dca97d17d00e1 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 11 Apr 2023 14:38:01 +0200 Subject: [PATCH] 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 --- sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp | 2 ++ 1 file changed, 2 insertions(+) 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. -- 2.30.2