shiboken2: Fix build with clang 16
authorFriedemann Kleint <Friedemann.Kleint@qt.io>
Tue, 11 Apr 2023 12:38:01 +0000 (14:38 +0200)
committerDmitry Shachnev <mitya57@debian.org>
Thu, 8 Feb 2024 08:13:11 +0000 (11:13 +0300)
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 <adrian.herrmann@qt.io>
Reviewed-by: Shyamnath Premnadh <Shyamnath.Premnadh@qt.io>
(cherry picked from commit e20e1ea0f5f9f9a0fe1c309a60cb5297f1276efc)

Gbp-Pq: Name shiboken2-Fix-build-with-clang-16.patch

sources/shiboken2/ApiExtractor/clangparser/clangbuilder.cpp

index ebe3b995a8c822b2ab8cdcde9e0636273f30ec9d..e8e5bcfde3025c7208dc8de442edb57bf7e322f3 100644 (file)
@@ -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.