From 4e63418195e6edd08cbba592d77d5a931260627d Mon Sep 17 00:00:00 2001 From: Theo von Arx Date: Tue, 21 Apr 2020 16:50:14 +0200 Subject: Rebuild libre/qtcreator for clang 10.0.0 Sucessfully built on x86_64, i686. Tested on x86_64. The build for armv7h fails on my machine, but could succeed on others. Signed-off-by: Andreas Grapentin --- libre/qtcreator/PKGBUILD | 16 +- libre/qtcreator/qtcreator-clang-10.patch | 277 +++++++++++++++++++++++++++++ libre/qtcreator/qtcreator-clang-libs.patch | 24 +++ 3 files changed, 313 insertions(+), 4 deletions(-) create mode 100644 libre/qtcreator/qtcreator-clang-10.patch create mode 100644 libre/qtcreator/qtcreator-clang-libs.patch (limited to 'libre') diff --git a/libre/qtcreator/PKGBUILD b/libre/qtcreator/PKGBUILD index 9963e5a5e..290601831 100644 --- a/libre/qtcreator/PKGBUILD +++ b/libre/qtcreator/PKGBUILD @@ -15,8 +15,8 @@ pkgname=qtcreator pkgver=4.11.2 -_clangver=9.0.1 -pkgrel=2 +_clangver=10.0.0 +pkgrel=4 pkgrel+=.parabola1 pkgdesc='Lightweight, cross-platform integrated development environment' pkgdesc+=', without nonfree qt5-webengine help viewer' @@ -39,10 +39,14 @@ optdepends=('qt5-doc: integrated Qt documentation' 'valgrind: analyze support' 'perf: performer analyzer') source=("https://download.qt.io/official_releases/qtcreator/${pkgver%.*}/$pkgver/qt-creator-opensource-src-$pkgver.tar.xz" - qtcreator-preload-plugins.patch) + qtcreator-preload-plugins.patch + qtcreator-clang-libs.patch + qtcreator-clang-10.patch::"https://code.qt.io/cgit/qt-creator/qt-creator.git/patch?id=44023c8f") source+=(libre.patch) sha256sums=('8d67e45b66944fdb0f879cbfae341af7e38d6a348cf18332b5cb9f07937aae02' - 'd6f979c820e2294653f4f1853af96942bf25ff9fe9450657d45ff1c7f02bbca7') + 'd6f979c820e2294653f4f1853af96942bf25ff9fe9450657d45ff1c7f02bbca7' + '0f6d0dc41a87aae9ef371b1950f5b9d823db8b5685c6ac04a7a7ac133eb19a3f' + 'cbbaa52f8daf40866c1c7157f168746cf7cb0231200feaeed05a0fb80e78c8ab') sha256sums+=('6aeac164075b7f3f3a2e9aa75865669beeeb7903b9cbb5b6a8700205b285fe64') prepare() { @@ -59,6 +63,10 @@ prepare() { # and https://bugs.archlinux.org/task/59492 patch -p1 -i ../qtcreator-preload-plugins.patch + # Fix build with clang 10 + patch -p1 -i ../qtcreator-clang-10.patch + patch -p1 -i ../qtcreator-clang-libs.patch + # remove qt5-webengine support patch -Np1 -i "$srcdir"/libre.patch rm -rv src/plugins/help/webenginehelpviewer.{cpp,h} diff --git a/libre/qtcreator/qtcreator-clang-10.patch b/libre/qtcreator/qtcreator-clang-10.patch new file mode 100644 index 000000000..553f5c004 --- /dev/null +++ b/libre/qtcreator/qtcreator-clang-10.patch @@ -0,0 +1,277 @@ +From 44023c8f43fd8daf8b7be305ea6d99b8b56fa551 Mon Sep 17 00:00:00 2001 +From: Orgad Shaneh +Date: Mon, 17 Feb 2020 23:21:17 +0200 +Subject: Clang: Fix build with Clang/LLVM 10 + +Change-Id: I740286c9dcfd325b1c31ab863fb5c91bf9c6ec70 +Reviewed-by: hjk +--- + src/plugins/clangformat/clangformatutils.cpp | 8 +++++++ + .../source/collectbuilddependencytoolaction.h | 17 ++++++++++++- + .../source/collectusedmacroactionfactory.h | 12 ++++++++++ + .../source/generatepchactionfactory.h | 7 ++++++ + .../clangrefactoringbackend/source/clangquery.cpp | 3 ++- + .../source/collectsymbolsaction.h | 6 ++++- + .../source/indexdataconsumer.cpp | 28 +++++++++++++++------- + .../source/indexdataconsumer.h | 28 +++++++++++++++------- + .../source/symbolscollector.cpp | 4 ++++ + 9 files changed, 92 insertions(+), 21 deletions(-) + +diff --git a/src/plugins/clangformat/clangformatutils.cpp b/src/plugins/clangformat/clangformatutils.cpp +index f087f77a94..0a32d3a929 100644 +--- a/src/plugins/clangformat/clangformatutils.cpp ++++ b/src/plugins/clangformat/clangformatutils.cpp +@@ -57,7 +57,11 @@ static clang::format::FormatStyle qtcStyle() + style.AlignOperands = true; + style.AlignTrailingComments = true; + style.AllowAllParametersOfDeclarationOnNextLine = true; ++#if LLVM_VERSION_MAJOR >= 10 ++ style.AllowShortBlocksOnASingleLine = FormatStyle::SBS_Never; ++#else + style.AllowShortBlocksOnASingleLine = false; ++#endif + style.AllowShortCaseLabelsOnASingleLine = false; + style.AllowShortFunctionsOnASingleLine = FormatStyle::SFS_Inline; + #if LLVM_VERSION_MAJOR >= 9 +@@ -72,7 +76,11 @@ static clang::format::FormatStyle qtcStyle() + style.BinPackArguments = false; + style.BinPackParameters = false; + style.BraceWrapping.AfterClass = true; ++#if LLVM_VERSION_MAJOR >= 10 ++ style.BraceWrapping.AfterControlStatement = FormatStyle::BWACS_Never; ++#else + style.BraceWrapping.AfterControlStatement = false; ++#endif + style.BraceWrapping.AfterEnum = false; + style.BraceWrapping.AfterFunction = true; + style.BraceWrapping.AfterNamespace = false; +diff --git a/src/tools/clangpchmanagerbackend/source/collectbuilddependencytoolaction.h b/src/tools/clangpchmanagerbackend/source/collectbuilddependencytoolaction.h +index 538f2c7d3f..88ed3d2344 100644 +--- a/src/tools/clangpchmanagerbackend/source/collectbuilddependencytoolaction.h ++++ b/src/tools/clangpchmanagerbackend/source/collectbuilddependencytoolaction.h +@@ -60,6 +60,16 @@ public: + diagnosticConsumer); + } + ++#if LLVM_VERSION_MAJOR >= 10 ++ std::unique_ptr create() override ++ { ++ return std::make_unique( ++ m_buildDependency, ++ m_filePathCache, ++ m_excludedIncludeUIDs, ++ m_alreadyIncludedFileUIDs); ++ } ++#else + clang::FrontendAction *create() override + { + return new CollectBuildDependencyAction(m_buildDependency, +@@ -67,6 +77,7 @@ public: + m_excludedIncludeUIDs, + m_alreadyIncludedFileUIDs); + } ++#endif + + std::vector generateExcludedIncludeFileUIDs(clang::FileManager &fileManager) const + { +@@ -77,7 +88,11 @@ public: + NativeFilePath nativeFilePath{filePath}; + const clang::FileEntry *file = fileManager.getFile({nativeFilePath.path().data(), + nativeFilePath.path().size()}, +- true); ++ true) ++#if LLVM_VERSION_MAJOR >= 10 ++ .get() ++#endif ++ ; + + if (file) + fileUIDs.push_back(file->getUID()); +diff --git a/src/tools/clangpchmanagerbackend/source/collectusedmacroactionfactory.h b/src/tools/clangpchmanagerbackend/source/collectusedmacroactionfactory.h +index 423d5f8876..473b8e7df8 100644 +--- a/src/tools/clangpchmanagerbackend/source/collectusedmacroactionfactory.h ++++ b/src/tools/clangpchmanagerbackend/source/collectusedmacroactionfactory.h +@@ -61,6 +61,17 @@ public: + diagnosticConsumer); + } + ++#if LLVM_VERSION_MAJOR >= 10 ++ std::unique_ptr create() override ++ { ++ return std::make_unique( ++ m_usedMacros, ++ m_filePathCache, ++ m_sourceDependencies, ++ m_sourceFiles, ++ m_fileStatuses); ++ } ++#else + clang::FrontendAction *create() override + { + return new CollectUsedMacrosAction(m_usedMacros, +@@ -69,6 +80,7 @@ public: + m_sourceFiles, + m_fileStatuses); + } ++#endif + + private: + UsedMacros &m_usedMacros; +diff --git a/src/tools/clangpchmanagerbackend/source/generatepchactionfactory.h b/src/tools/clangpchmanagerbackend/source/generatepchactionfactory.h +index c4a8cae028..f1e4c74457 100644 +--- a/src/tools/clangpchmanagerbackend/source/generatepchactionfactory.h ++++ b/src/tools/clangpchmanagerbackend/source/generatepchactionfactory.h +@@ -68,10 +68,17 @@ public: + , m_fileContent(fileContent) + {} + ++#if LLVM_VERSION_MAJOR >= 10 ++ std::unique_ptr create() override ++ { ++ return std::make_unique(m_filePath, m_fileContent); ++ } ++#else + clang::FrontendAction *create() override + { + return new GeneratePCHAction{m_filePath, m_fileContent}; + } ++#endif + + private: + llvm::StringRef m_filePath; +diff --git a/src/tools/clangrefactoringbackend/source/clangquery.cpp b/src/tools/clangrefactoringbackend/source/clangquery.cpp +index 21ebeb8367..78f2350d8d 100644 +--- a/src/tools/clangrefactoringbackend/source/clangquery.cpp ++++ b/src/tools/clangrefactoringbackend/source/clangquery.cpp +@@ -78,7 +78,8 @@ void ClangQuery::findLocations() + std::make_move_iterator(asts.end()), + [&] (std::unique_ptr &&ast) { + Diagnostics diagnostics; +- auto optionalMatcher = Parser::parseMatcherExpression({m_query.data(), m_query.size()}, ++ llvm::StringRef query{m_query.data(), m_query.size()}; ++ auto optionalMatcher = Parser::parseMatcherExpression(query, + nullptr, + &diagnostics); + parseDiagnostics(diagnostics); +diff --git a/src/tools/clangrefactoringbackend/source/collectsymbolsaction.h b/src/tools/clangrefactoringbackend/source/collectsymbolsaction.h +index a38f1c4f87..4f36adadf5 100644 +--- a/src/tools/clangrefactoringbackend/source/collectsymbolsaction.h ++++ b/src/tools/clangrefactoringbackend/source/collectsymbolsaction.h +@@ -48,7 +48,11 @@ class CollectSymbolsAction : public clang::WrapperFrontendAction + public: + CollectSymbolsAction(std::shared_ptr indexDataConsumer) + : clang::WrapperFrontendAction( +- clang::index::createIndexingAction(indexDataConsumer, createIndexingOptions(), nullptr)) ++ clang::index::createIndexingAction(indexDataConsumer, createIndexingOptions() ++#if LLVM_VERSION_MAJOR < 10 ++ , nullptr ++#endif ++ )) + , m_indexDataConsumer(indexDataConsumer) + {} + +diff --git a/src/tools/clangrefactoringbackend/source/indexdataconsumer.cpp b/src/tools/clangrefactoringbackend/source/indexdataconsumer.cpp +index e287144462..5d21b30b9c 100644 +--- a/src/tools/clangrefactoringbackend/source/indexdataconsumer.cpp ++++ b/src/tools/clangrefactoringbackend/source/indexdataconsumer.cpp +@@ -118,11 +118,16 @@ bool IndexDataConsumer::isAlreadyParsed(clang::FileID fileId, SourcesManager &so + return sourcesManager.alreadyParsed(filePathId(fileEntry), fileEntry->getModificationTime()); + } + +-bool IndexDataConsumer::handleDeclOccurence(const clang::Decl *declaration, +- clang::index::SymbolRoleSet symbolRoles, +- llvm::ArrayRef /*symbolRelations*/, +- clang::SourceLocation sourceLocation, +- IndexDataConsumer::ASTNodeInfo /*astNodeInfo*/) ++#if LLVM_VERSION_MAJOR >= 10 ++ bool IndexDataConsumer::handleDeclOccurrence( ++#else ++ bool IndexDataConsumer::handleDeclOccurence( ++#endif ++ const clang::Decl *declaration, ++ clang::index::SymbolRoleSet symbolRoles, ++ llvm::ArrayRef /*symbolRelations*/, ++ clang::SourceLocation sourceLocation, ++ IndexDataConsumer::ASTNodeInfo /*astNodeInfo*/) + { + const auto *namedDeclaration = clang::dyn_cast(declaration); + if (namedDeclaration) { +@@ -175,10 +180,15 @@ SourceLocationKind macroSymbolType(clang::index::SymbolRoleSet roles) + + } // namespace + +-bool IndexDataConsumer::handleMacroOccurence(const clang::IdentifierInfo *identifierInfo, +- const clang::MacroInfo *macroInfo, +- clang::index::SymbolRoleSet roles, +- clang::SourceLocation sourceLocation) ++#if LLVM_VERSION_MAJOR >= 10 ++bool IndexDataConsumer::handleMacroOccurrence( ++#else ++bool IndexDataConsumer::handleMacroOccurence( ++#endif ++ const clang::IdentifierInfo *identifierInfo, ++ const clang::MacroInfo *macroInfo, ++ clang::index::SymbolRoleSet roles, ++ clang::SourceLocation sourceLocation) + { + if (macroInfo && sourceLocation.isFileID() + && !isAlreadyParsed(m_sourceManager->getFileID(sourceLocation), m_macroSourcesManager) +diff --git a/src/tools/clangrefactoringbackend/source/indexdataconsumer.h b/src/tools/clangrefactoringbackend/source/indexdataconsumer.h +index c80e066b6c..e1d3529806 100644 +--- a/src/tools/clangrefactoringbackend/source/indexdataconsumer.h ++++ b/src/tools/clangrefactoringbackend/source/indexdataconsumer.h +@@ -57,16 +57,26 @@ public: + IndexDataConsumer(const IndexDataConsumer &) = delete; + IndexDataConsumer &operator=(const IndexDataConsumer &) = delete; + +- bool handleDeclOccurence(const clang::Decl *declaration, +- clang::index::SymbolRoleSet symbolRoles, +- llvm::ArrayRef symbolRelations, +- clang::SourceLocation sourceLocation, +- ASTNodeInfo astNodeInfo) override; ++#if LLVM_VERSION_MAJOR >= 10 ++ bool handleDeclOccurrence( ++#else ++ bool handleDeclOccurence( ++#endif ++ const clang::Decl *declaration, ++ clang::index::SymbolRoleSet symbolRoles, ++ llvm::ArrayRef symbolRelations, ++ clang::SourceLocation sourceLocation, ++ ASTNodeInfo astNodeInfo) override; + +- bool handleMacroOccurence(const clang::IdentifierInfo *identifierInfo, +- const clang::MacroInfo *macroInfo, +- clang::index::SymbolRoleSet roles, +- clang::SourceLocation sourceLocation) override; ++#if LLVM_VERSION_MAJOR >= 10 ++ bool handleMacroOccurrence( ++#else ++ bool handleMacroOccurence( ++#endif ++ const clang::IdentifierInfo *identifierInfo, ++ const clang::MacroInfo *macroInfo, ++ clang::index::SymbolRoleSet roles, ++ clang::SourceLocation sourceLocation) override; + + void finish() override; + +diff --git a/src/tools/clangrefactoringbackend/source/symbolscollector.cpp b/src/tools/clangrefactoringbackend/source/symbolscollector.cpp +index a233f6d8fe..dffd583894 100644 +--- a/src/tools/clangrefactoringbackend/source/symbolscollector.cpp ++++ b/src/tools/clangrefactoringbackend/source/symbolscollector.cpp +@@ -74,7 +74,11 @@ std::unique_ptr newFrontendActionFactory( + : m_action(consumerFactory) + {} + ++#if LLVM_VERSION_MAJOR >= 10 ++ std::unique_ptr create() override { return std::make_unique(m_action); } ++#else + clang::FrontendAction *create() override { return new AdaptorAction(m_action); } ++#endif + + private: + class AdaptorAction : public clang::ASTFrontendAction +-- +cgit v1.2.1 + diff --git a/libre/qtcreator/qtcreator-clang-libs.patch b/libre/qtcreator/qtcreator-clang-libs.patch new file mode 100644 index 000000000..a0cc8c547 --- /dev/null +++ b/libre/qtcreator/qtcreator-clang-libs.patch @@ -0,0 +1,24 @@ +diff --git a/src/shared/clang/clang_installation.pri b/src/shared/clang/clang_installation.pri +index 08838838bc..bee3779484 100644 +--- a/src/shared/clang/clang_installation.pri ++++ b/src/shared/clang/clang_installation.pri +@@ -131,9 +131,7 @@ defineReplace(extractWarnings) { + return($$result) + } + +-CLANGTOOLING_LIBS=-lclangTooling -lclangIndex -lclangFrontend -lclangParse -lclangSerialization \ +- -lclangSema -lclangEdit -lclangAnalysis -lclangDriver -lclangDynamicASTMatchers \ +- -lclangASTMatchers -lclangToolingCore -lclangAST -lclangLex -lclangBasic ++CLANGTOOLING_LIBS=-lclang-cpp + win32:CLANGTOOLING_LIBS += -lversion + + BIN_EXTENSION = +@@ -207,7 +205,7 @@ isEmpty(LLVM_VERSION) { + isEmpty(QTC_CLANG_BUILDMODE_MISMATCH)|!equals(QTC_CLANG_BUILDMODE_MISMATCH, 1) { + CLANGFORMAT_MAIN_HEADER = $$LLVM_INCLUDEPATH/clang/Format/Format.h + exists($$CLANGFORMAT_MAIN_HEADER) { +- CLANGFORMAT_LIBS=-lclangFormat -lclangToolingInclusions -lclangToolingCore -lclangRewrite -lclangLex -lclangBasic ++ CLANGFORMAT_LIBS=-lclang-cpp + ALL_CLANG_LIBS=-lclangFormat -lclangToolingInclusions -lclangTooling -lclangToolingCore \ + -lclangRewrite -lclangIndex -lclangFrontend -lclangParse -lclangSerialization \ + -lclangSema -lclangEdit -lclangAnalysis -lclangDriver -lclangDynamicASTMatchers \ -- cgit v1.2.3