diff --git a/qt6-qttools-6.7.2-llvm-19.patch b/qt6-qttools-6.7.2-llvm-19.patch new file mode 100644 index 0000000..f8b73a0 --- /dev/null +++ b/qt6-qttools-6.7.2-llvm-19.patch @@ -0,0 +1,201 @@ +From 687fc1601863ae7a67897bc3590b33bd3bdcc3bc Mon Sep 17 00:00:00 2001 +From: Joerg Bornemann +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 +--- + src/linguist/lupdate/clangtoolastreader.cpp | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/src/linguist/lupdate/clangtoolastreader.cpp b/src/linguist/lupdate/clangtoolastreader.cpp +index 6b85c6ccb3..3db9e0d64a 100644 +--- a/src/linguist/lupdate/clangtoolastreader.cpp ++++ b/src/linguist/lupdate/clangtoolastreader.cpp +@@ -782,8 +782,14 @@ bool LupdateVisitor::VisitNamedDecl(clang::NamedDecl *namedDeclaration) + 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( +--- + +From a2f478b20f369132de1e67b30716d5f070d7bf80 Mon Sep 17 00:00:00 2001 +From: Paul Wicking +Date: Mon, 16 Sep 2024 11:30:02 +0200 +Subject: [PATCH] QDoc: Adapt clang/AST/QualTypeNames.h to upstream changes +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +For compatibility reasons, QDoc carries a custom implementation of +`llvm-project.git/clang/lib/AST/QualTypeNames.cpp`. When QDoc is built +against Clang libraries from LLVM 19, a segmentation fault occurs when +generating the documentation for the Qt 3D module as part of a qt5.git +super-module documentation build. + +The segmentation fault is the result of a `nullptr` being passed to +`clang::TypeName::getFullyQualifiedNestedNameSpecifier` for the +`Scope` parameter. + +Upon investigation, it became clear that two changes have been made +upstream to the implementation QDoc carries a customized version of, +one of which adds a `nullptr` check. Due to the small footprint of +both changes, this patch applies both of them to QDoc's +`clang/AST/QualTypeNames.h`: + +- The upstream change 16832eb58563f77d917198ad9f86db1c2ee162c9 adds a + `nullptr` check, see https://github.com/llvm/llvm-project/pull/94084 + for details. +- The upstream change 35bfbb3b21e9874d03b730e8ce4eb98b1dcd2d28 + replaces `dyn_cast_or_null(foo)` with `dyn_cast(foo)` for + never-null arguments. See + https://github.com/llvm/llvm-project/commit/35bfbb3b21e9874d03b730e8ce4eb98b1dcd2d28 + for details. + +The changes apply also when QDoc is built against Clang libraries from +LLVM 17 and 18, with both end-to-end tests passing. Given the nature of +the changes, this means these adaptations do not require being wrapped +in `#if LIBCLANG_VERSION_MAJOR` checks. + +Fixes: QTBUG-128926 +Pick-to: 6.8 +Change-Id: I5863ca213a35042ed325971b42de2bc1e86c6457 +Reviewed-by: Luca Di Sera +Reviewed-by: Topi Reiniƶ +--- + src/qdoc/qdoc/src/qdoc/clang/AST/QualTypeNames.h | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/src/qdoc/qdoc/src/qdoc/clang/AST/QualTypeNames.h b/src/qdoc/qdoc/src/qdoc/clang/AST/QualTypeNames.h +index c6d331ea86..29a9250dea 100644 +--- a/src/qdoc/qdoc/src/qdoc/clang/AST/QualTypeNames.h ++++ b/src/qdoc/qdoc/src/qdoc/clang/AST/QualTypeNames.h +@@ -84,8 +84,9 @@ static inline bool getFullyQualifiedTemplateName(const ASTContext &Ctx, + assert(ArgTDecl != nullptr); + QualifiedTemplateName *QTName = TName.getAsQualifiedTemplateName(); + +- if (QTName && !QTName->hasTemplateKeyword()) { +- NNS = QTName->getQualifier(); ++ if (QTName && ++ !QTName->hasTemplateKeyword() && ++ (NNS = QTName->getQualifier())) { + NestedNameSpecifier *QNNS = getFullyQualifiedNestedNameSpecifier( + Ctx, NNS, WithGlobalNsPrefix); + if (QNNS != NNS) { +@@ -288,8 +289,8 @@ static inline NestedNameSpecifier *createNestedNameSpecifierForScopeOf( + assert(Decl); + + const DeclContext *DC = Decl->getDeclContext()->getRedeclContext(); +- const auto *Outer = dyn_cast_or_null(DC); +- const auto *OuterNS = dyn_cast_or_null(DC); ++ const auto *Outer = dyn_cast(DC); ++ const auto *OuterNS = dyn_cast(DC); + if (Outer && !(OuterNS && OuterNS->isAnonymousNamespace())) { + if (OuterNS) { + return createNestedNameSpecifier(Ctx, OuterNS, WithGlobalNsPrefix); +--- + +From 4a368a06afa5929d8674d2e94c2d7cbd6ad85d4e Mon Sep 17 00:00:00 2001 +From: Paul Wicking +Date: Fri, 13 Sep 2024 14:37:38 +0200 +Subject: [PATCH] QDoc: Adapt to breaking changes in LLVM 19 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +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 +Fixes: QTBUG-128644 +Pick-to: 6.8 +Change-Id: I34fbb46cf28b5676b4adda5e563d6d59fc40f602 +Reviewed-by: Luca Di Sera +Reviewed-by: Topi Reiniƶ +--- + src/qdoc/qdoc/src/qdoc/clangcodeparser.cpp | 13 ++++++++++++- + 1 file changed, 12 insertions(+), 1 deletion(-) + +diff --git a/src/qdoc/qdoc/src/qdoc/clangcodeparser.cpp b/src/qdoc/qdoc/src/qdoc/clangcodeparser.cpp +index eb3a781bc..385d651ec 100644 +--- a/src/qdoc/qdoc/src/qdoc/clangcodeparser.cpp ++++ b/src/qdoc/qdoc/src/qdoc/clangcodeparser.cpp +@@ -207,9 +207,15 @@ static std::string get_expression_as_string(const clang::Expr* expression, const + * 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 + + } + +@@ -223,8 +229,13 @@ static std::string get_default_value_initializer_as_string(const clang::Template + * 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 + + } + +@@ -244,7 +255,7 @@ static std::string get_default_value_initializer_as_string(const clang::Template + 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; diff --git a/qt6-qttools.spec b/qt6-qttools.spec index 4648e33..bbe150e 100644 --- a/qt6-qttools.spec +++ b/qt6-qttools.spec @@ -2,7 +2,7 @@ Name: qt6-qttools Version: 6.7.2 -Release: 1mamba +Release: 3mamba Summary: Qt6 tools Group: Development/Tools Vendor: openmamba @@ -14,6 +14,7 @@ Source1: libqt6-designer.desktop Source2: libqt6-linguist.desktop Source3: libqt6-assistant.desktop Source4: libqt6-qdbusviewer.desktop +Patch0: qt6-qttools-6.7.2-llvm-19.patch License: GPL ## AUTOBUILDREQ-BEGIN BuildRequires: glibc-devel @@ -27,8 +28,8 @@ BuildRequires: libzstd-devel BuildRequires: qt6-qtbase-devel BuildRequires: qt6-qtdeclarative-devel ## AUTOBUILDREQ-END -BuildRequires: libclang-devel >= 17.0.3 -BuildRequires: libllvm-devel >= 17.0.3 +BuildRequires: libclang-devel >= 19.1.1 +BuildRequires: libllvm-devel >= 19.1.1 BuildRequires: qt6-qtdeclarative-devel = %{version} %description @@ -108,8 +109,12 @@ This package contains libraries and header files for developing applications tha %prep %setup -q -n qttools-everywhere-src-%{version} +#-D -T +#:<< _EOF +%patch 0 -p1 -F2 -b .llvm-19 %build +#:<< _EOF %cmake -d build \ -G Ninja @@ -124,6 +129,7 @@ install -d -m0755 %{buildroot}%{_bindir} for f in assistant designer lconvert linguist lrelease lupdate pixeltool \ qdbus qbusviewer qdoc qhelpgenerator qtdiag qtplugininfo qdistancefieldgenerator; do ln -s ../%{_lib}/qt6/bin/${f} %{buildroot}%{_bindir}/${f}-qt6 + ln -s ${f}-qt6 %{buildroot}%{_bindir}/${f} done # install desktop files @@ -148,32 +154,23 @@ done %clean [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" -%post -p /sbin/ldconfig -%postun -p /sbin/ldconfig - -%post -n libQt6Designer -p /sbin/ldconfig -%postun -n libQt6Designer -p /sbin/ldconfig - -%post -n libQt6Help -p /sbin/ldconfig -%postun -n libQt6Help -p /sbin/ldconfig - %files %defattr(-,root,root) -%{_bindir}/qdbus-qt6 +%{_bindir}/qdbus* %{_libdir}/qt6/bin/qdbus %{_libdir}/libQt6UiTools.so.* %doc LICENSES %files -n qt6-assistant %defattr(-,root,root) -%{_bindir}/assistant-qt6 +%{_bindir}/assistant* %{_libdir}/qt6/bin/assistant %{_datadir}/applications/assistant-qt6.desktop %{_datadir}/icons/hicolor/*/apps/assistant-qt6.png %files -n qt6-designer %defattr(-,root,root) -%{_bindir}/designer-qt6 +%{_bindir}/designer* %{_libdir}/qt6/bin/designer %{_datadir}/applications/designer-qt6.desktop %{_datadir}/icons/hicolor/*/apps/designer-qt6.png @@ -186,10 +183,10 @@ done %files -n qt6-linguist %defattr(-,root,root) -%{_bindir}/lconvert-qt6 -%{_bindir}/lrelease-qt6 -%{_bindir}/lupdate-qt6 -%{_bindir}/linguist-qt6 +%{_bindir}/lconvert* +%{_bindir}/lrelease* +%{_bindir}/lupdate* +%{_bindir}/linguist* %{_libdir}/qt6/bin/lconvert %{_libdir}/qt6/bin/lrelease %{_libdir}/qt6/bin/lupdate @@ -215,16 +212,16 @@ done %files -n qt6-qdbusviewer %defattr(-,root,root) -%{_bindir}/qbusviewer-qt6 +%{_bindir}/qbusviewer* %{_libdir}/qt6/bin/qdbusviewer %{_datadir}/applications/qdbusviewer-qt6.desktop %{_datadir}/icons/hicolor/*/apps/qdbusviewer-qt6.png %files -n qt6-doctools %defattr(-,root,root) -%{_bindir}/qdoc-qt6 -%{_bindir}/qdistancefieldgenerator-qt6 -%{_bindir}/qhelpgenerator-qt6 +%{_bindir}/qdoc* +%{_bindir}/qdistancefieldgenerator* +%{_bindir}/qhelpgenerator* %{_libdir}/qt6/bin/qdoc %{_libdir}/qt6/bin/qdistancefieldgenerator %{_libdir}/qt6/libexec/qhelpgenerator @@ -236,9 +233,9 @@ done %files devel %defattr(-,root,root) -%{_bindir}/pixeltool-qt6 -%{_bindir}/qtdiag-qt6 -%{_bindir}/qtplugininfo-qt6 +%{_bindir}/pixeltool* +%{_bindir}/qtdiag* +%{_bindir}/qtplugininfo* %{_libdir}/qt6/bin/pixeltool %{_libdir}/qt6/bin/qtdiag %{_libdir}/qt6/bin/qtdiag6 @@ -303,6 +300,12 @@ done %{_libdir}/pkgconfig/Qt6*.pc %changelog +* Sat Oct 05 2024 Silvan Calarco 6.7.2-3mamba +- rebuilt with clang 19.1.1 + +* Thu Sep 19 2024 Silvan Calarco 6.7.2-2mamba +- also provide bindir symlinks without -qt6 suffix (e.g. qdbus and qdbus-qt6) + * Fri Jun 21 2024 Automatic Build System 6.7.2-1mamba - automatic version update by autodist