Fix build against Clang 15

This commit is contained in:
Jan Grulich 2022-11-01 09:00:54 +01:00
parent 0f658eb149
commit feb19cb1ee
2 changed files with 72 additions and 2 deletions

67
lupdate-clang-15.patch Normal file
View File

@ -0,0 +1,67 @@
From 01cae372619369d1a5a04f4d0f87817011029b78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Sch=C3=A4pers?= <bjoern@hazardy.de>
Date: Sat, 1 Oct 2022 07:19:52 +0200
Subject: [PATCH] lupdate: Fix build with clang 15+
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The signature of InclusionDirective changed for clang 15.
Change-Id: Ic259b3508088671b40f6f615524137ce8837c487
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
(cherry picked from commit 6495329e6de803025e6e4e8291b648f94893551c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
---
src/linguist/lupdate/lupdatepreprocessoraction.cpp | 13 +++++++++++--
src/linguist/lupdate/lupdatepreprocessoraction.h | 7 ++++++-
2 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/src/linguist/lupdate/lupdatepreprocessoraction.cpp b/src/linguist/lupdate/lupdatepreprocessoraction.cpp
index d7446c364..9733f20d2 100644
--- a/src/linguist/lupdate/lupdatepreprocessoraction.cpp
+++ b/src/linguist/lupdate/lupdatepreprocessoraction.cpp
@@ -156,14 +156,23 @@ void LupdatePPCallbacks::SourceRangeSkipped(clang::SourceRange sourceRange,
// To list the included files
void LupdatePPCallbacks::InclusionDirective(clang::SourceLocation /*hashLoc*/,
const clang::Token & /*includeTok*/, clang::StringRef /*fileName*/, bool /*isAngled*/,
- clang::CharSourceRange /*filenameRange*/, const clang::FileEntry *file,
+ clang::CharSourceRange /*filenameRange*/,
+#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(15,0,0))
+ const clang::Optional<clang::FileEntryRef> file,
+#else
+ const clang::FileEntry *file,
+#endif
clang::StringRef /*searchPath*/, clang::StringRef /*relativePath*/,
const clang::Module */*imported*/, clang::SrcMgr::CharacteristicKind /*fileType*/)
{
if (!file)
return;
- clang::StringRef fileNameRealPath = file->tryGetRealPathName();
+ clang::StringRef fileNameRealPath = file->
+#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(15,0,0))
+ getFileEntry().
+#endif
+ tryGetRealPathName();
if (!LupdatePrivate::isFileSignificant(fileNameRealPath.str()))
return;
diff --git a/src/linguist/lupdate/lupdatepreprocessoraction.h b/src/linguist/lupdate/lupdatepreprocessoraction.h
index b1ee468d4..3e44cee83 100644
--- a/src/linguist/lupdate/lupdatepreprocessoraction.h
+++ b/src/linguist/lupdate/lupdatepreprocessoraction.h
@@ -51,7 +51,12 @@ class LupdatePPCallbacks : public clang::PPCallbacks
void SourceRangeSkipped(clang::SourceRange sourceRange, clang::SourceLocation endifLoc) override;
void InclusionDirective(clang::SourceLocation /*hashLoc*/, const clang::Token &/*includeTok*/,
clang::StringRef /*fileName*/, bool /*isAngled*/,
- clang::CharSourceRange /*filenameRange*/, const clang::FileEntry *file,
+ clang::CharSourceRange /*filenameRange*/,
+#if (LUPDATE_CLANG_VERSION >= LUPDATE_CLANG_VERSION_CHECK(15,0,0))
+ const clang::Optional<clang::FileEntryRef> file,
+#else
+ const clang::FileEntry *file,
+#endif
clang::StringRef /*searchPath*/, clang::StringRef /*relativePath*/,
const clang::Module */*imported*/,
clang::SrcMgr::CharacteristicKind /*fileType*/) override;

View File

@ -32,6 +32,7 @@ Patch1: qttools-run-qttools-with-qt6-suffix.patch
Patch2: qttools-add-libatomic.patch
## upstream patches
Patch50: lupdate-clang-15.patch
Source20: assistant.desktop
Source21: designer.desktop
@ -49,6 +50,9 @@ BuildRequires: qt6-qtbase-static >= %{version}
BuildRequires: qt6-qtdeclarative-static >= %{version}
BuildRequires: qt6-qtdeclarative >= %{version}
%{?_qt6:Requires: %{_qt6}%{?_isa} = %{_qt6_version}}
BuildRequires: qt6-qtbase-mysql >= %{version}
BuildRequires: qt6-qtbase-odbc >= %{version}
BuildRequires: qt6-qtbase-postgresql >= %{version}
BuildRequires: clang-devel llvm-devel
@ -145,8 +149,6 @@ Summary: Qt6 doc tools package
%if 0%{?examples}
%package examples
Summary: Programming examples for %{name}
# BuildRequires: qt6-qttools-devel >= %{version}
# BuildRequires: qt6-qttools-static >= %{version}
Requires: %{name}-common = %{version}-%{release}
%description examples
%{summary}.
@ -160,6 +162,7 @@ Requires: %{name}-common = %{version}-%{release}
%patch2 -p1 -b .libatomic
%endif
%patch50 -p1 -b .lupdate-clang-15
%build
%cmake_qt6 -DQT_BUILD_EXAMPLES:BOOL=%{?examples:ON}%{!?examples:OFF}