[packages/qt6] upstream patches to fix build with llvm >= 19

atler atler at pld-linux.org
Sat Oct 19 14:47:54 CEST 2024


commit 91ef5e9fb24c9570b2ae5f0d2cdc83bbd944ccf8
Author: Jan Palus <atler at pld-linux.org>
Date:   Sat Oct 19 14:01:31 2024 +0200

    upstream patches to fix build with llvm >= 19

 qt6.spec             |   2 +
 qttools-llvm19.patch | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 118 insertions(+)
---
diff --git a/qt6.spec b/qt6.spec
index 8de6b52..87dc368 100644
--- a/qt6.spec
+++ b/qt6.spec
@@ -116,6 +116,7 @@ Patch3:		no-implicit-sse2.patch
 Patch4:		x32.patch
 Patch5:		qtwebengine-cmake-build-type.patch
 Patch6:		qtquick3d-6.6.2-gcc14.patch
+Patch7:		qttools-llvm19.patch
 URL:		https://www.qt.io/
 %{?with_directfb:BuildRequires:	DirectFB-devel}
 BuildRequires:	EGL-devel
@@ -3751,6 +3752,7 @@ narzędzia.
 %patch4 -p1
 %patch5 -p1
 %patch6 -p1 -d qtquick3d
+%patch7 -p1 -d qttools
 
 %{__sed} -i -e 's,usr/X11R6/,usr/,g' qtbase/mkspecs/linux-g++-64/qmake.conf
 
diff --git a/qttools-llvm19.patch b/qttools-llvm19.patch
new file mode 100644
index 0000000..53d2a02
--- /dev/null
+++ b/qttools-llvm19.patch
@@ -0,0 +1,116 @@
+From 0afa5a31cf5b3411c558e7063417789a6acd0b06 Mon Sep 17 00:00:00 2001
+From: Paul Wicking <paul.wicking at qt.io>
+Date: Fri, 13 Sep 2024 14:37:38 +0200
+Subject: [PATCH] QDoc: Adapt to breaking changes in LLVM 19
+
+Due to upstream changes in LLVM 19, QDoc fails to compile when linked
+against Clang libraries from this version of LLVM. Three issues arise;
+
+- Two cases of passing an argument of wrong type to a function.
+- One case of accessing a non-existing member of an enumeration.
+
+One upstream change (see [0]) is responsible for two of the issues:
+
+- `get_expression_as_string()` is modified such that it correctly
+  obtains the parameter type when calling
+  `get_fully_qualified_type_name()`, by appending
+  `.getArgument().getAsType()` to the call to `getDefaultArgument()`.
+- `get_default_value_initializer_as_string()` is modified such that it
+  correctly passes the source expression to
+  `get_expression_as_string()`, by appending `.getSourceExpression()`
+  to the call to `getDefaultArgument()`.
+
+Both of these changes are is incompatible with QDoc built against
+Clang libraries from earlier versions of LLVM, and are therefore
+wrapped in #if-ery.
+
+Finally, LLVM 19 drops a value used in QDoc from the enumeration
+`clang::TemplateName::Qualified`, see [1]. The enum value `Fully` is
+removed without replacement. The enum is left with two values,
+`AsWritten` and `None`. QDoc is modified such that it relies on the
+former of the two. This change doesn't cause any change in output from
+QDoc when built against Clang libraries from LLVM 17 and 18, and the
+change is therefore not wrapped in #if-ery.
+
+[0] - https://github.com/llvm/llvm-project/commit/e42b799bb28815431f2c5a95f7e13fde3f1b36a1
+[1] - https://github.com/llvm/llvm-project/commit/9c4a716c12920
+
+Done-with: Khem Raj <raj.khem at gmail.com>
+Fixes: QTBUG-128644
+Change-Id: I34fbb46cf28b5676b4adda5e563d6d59fc40f602
+Reviewed-by: Topi Reiniö <topi.reinio at qt.io>
+---
+
+diff --git a/src/qdoc/qdoc/src/qdoc/clangcodeparser.cpp b/src/qdoc/qdoc/src/qdoc/clangcodeparser.cpp
+index 2e3b1ce..359158c 100644
+--- a/src/qdoc/qdoc/src/qdoc/clangcodeparser.cpp
++++ b/src/qdoc/qdoc/src/qdoc/clangcodeparser.cpp
+@@ -208,9 +208,15 @@
+  * If the parameter has no default value the empty string will be returned.
+  */
+ static std::string get_default_value_initializer_as_string(const clang::TemplateTypeParmDecl* parameter) {
++#if LIBCLANG_VERSION_MAJOR >= 19
++    return (parameter && parameter->hasDefaultArgument()) ?
++                get_fully_qualified_type_name(parameter->getDefaultArgument().getArgument().getAsType(), parameter->getASTContext()) :
++                "";
++#else
+     return (parameter && parameter->hasDefaultArgument()) ?
+                 get_fully_qualified_type_name(parameter->getDefaultArgument(), parameter->getASTContext()) :
+                 "";
++#endif
+ 
+ }
+ 
+@@ -224,8 +230,13 @@
+  * If the parameter as no default value the empty string will be returned.
+  */
+ static std::string get_default_value_initializer_as_string(const clang::NonTypeTemplateParmDecl* parameter) {
++#if LIBCLANG_VERSION_MAJOR >= 19
++    return (parameter && parameter->hasDefaultArgument()) ?
++        get_expression_as_string(parameter->getDefaultArgument().getSourceExpression(), parameter->getASTContext()) : "";
++#else
+     return (parameter && parameter->hasDefaultArgument()) ?
+         get_expression_as_string(parameter->getDefaultArgument(), parameter->getASTContext()) : "";
++#endif
+ 
+ }
+ 
+@@ -245,7 +256,7 @@
+         const clang::TemplateName template_name = parameter->getDefaultArgument().getArgument().getAsTemplate();
+ 
+         llvm::raw_string_ostream ss{default_value};
+-        template_name.print(ss, parameter->getASTContext().getPrintingPolicy(), clang::TemplateName::Qualified::Fully);
++        template_name.print(ss, parameter->getASTContext().getPrintingPolicy(), clang::TemplateName::Qualified::AsWritten);
+     }
+ 
+     return default_value;
+From 7ba0d4064bf6395c6e58d34c9876a8596449a345 Mon Sep 17 00:00:00 2001
+From: Joerg Bornemann <joerg.bornemann at qt.io>
+Date: Mon, 15 Jul 2024 15:17:04 +0200
+Subject: [PATCH] lupdate/clang: Fix deprecation warning with llvm 18
+
+Change-Id: Ib22dda34bfdf7a1cd0e9932eec0f6f13a912a688
+Reviewed-by: Lucie Gerard <lucie.gerard at qt.io>
+(cherry picked from commit 687fc1601863ae7a67897bc3590b33bd3bdcc3bc)
+(cherry picked from commit 3dbf7c36054dc7d6e17b5f8704e562e47051d304)
+---
+
+diff --git a/src/linguist/lupdate/clangtoolastreader.cpp b/src/linguist/lupdate/clangtoolastreader.cpp
+index 6b85c6c..3db9e0d 100644
+--- a/src/linguist/lupdate/clangtoolastreader.cpp
++++ b/src/linguist/lupdate/clangtoolastreader.cpp
+@@ -782,8 +782,14 @@
+     if (!fullLocation.isValid() || !fullLocation.getFileEntry())
+         return true;
+ 
++#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(18,0,0))
++    auto fileEntry = fullLocation.getFileEntryRef();
++    if (fileEntry && !LupdatePrivate::isFileSignificant(fileEntry->getName().str()))
++        return true;
++#else
+     if (!LupdatePrivate::isFileSignificant(fullLocation.getFileEntry()->getName().str()))
+         return true;
++#endif
+ 
+     qCDebug(lcClang) << "NamedDecl Name:   " << QString::fromStdString(namedDeclaration->getQualifiedNameAsString());
+     qCDebug(lcClang) << "NamedDecl source: " << QString::fromStdString(namedDeclaration->getSourceRange().printToString(
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/qt6.git/commitdiff/91ef5e9fb24c9570b2ae5f0d2cdc83bbd944ccf8



More information about the pld-cvs-commit mailing list