summaryrefslogtreecommitdiff
path: root/dev-util/clazy
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-10-25 21:54:27 +0100
committerV3n3RiX <venerix@koprulu.sector>2022-10-25 21:54:27 +0100
commitc22e93ab35a8cb604c41623a7b2cda059c462b70 (patch)
treecf572f544af748369df154f1d61d4718e1ee780b /dev-util/clazy
parentb8c48743664466ac0f638f0949fd78bfb9f5eae6 (diff)
gentoo auto-resync : 25:10:2022 - 21:54:27
Diffstat (limited to 'dev-util/clazy')
-rw-r--r--dev-util/clazy/Manifest3
-rw-r--r--dev-util/clazy/clazy-1.11-r2.ebuild56
-rw-r--r--dev-util/clazy/files/clazy-1.11-fix-llvm-15.patch223
-rw-r--r--dev-util/clazy/files/clazy-1.11-fix-regex-detect.patch25
4 files changed, 307 insertions, 0 deletions
diff --git a/dev-util/clazy/Manifest b/dev-util/clazy/Manifest
index 50608c282a3b..f1a5bbad0cba 100644
--- a/dev-util/clazy/Manifest
+++ b/dev-util/clazy/Manifest
@@ -1,3 +1,6 @@
+AUX clazy-1.11-fix-llvm-15.patch 12053 BLAKE2B d329cb3a93a7b9cf6256590e281c6f13955eb8a83a9c0ef17a8d5fe719ff1f09164aec56ea8a31391adb5a9490ce6a4e8336a32dc22f872182e5491d81b89e70 SHA512 285e73848d9fc7bf8eada208660cb8d42c245617205be9bae708e6f9e0d8b06ba814a305b33d641589f8a0ee17a71156cea2450fd2e7d5a342389eada5421e34
+AUX clazy-1.11-fix-regex-detect.patch 859 BLAKE2B 6a953c3927dcc1a3aac5aab55c01eb1eaf977f40c96c26f57032608de8e0d709ae6bf67f5d04f991ee14ded80023a8faf19b9ea18f9a2e2dd9dc19b2831ff58c SHA512 8bd1ab72bf36620250a228f9cb45fe403853d16c5eec8704c6980405ffca71cfcea82f9587b3b3f748ab623ecee757cb8adc54c7a137c5070eb04e26d06fab36
DIST clazy-1.11.tar.xz 404088 BLAKE2B 1a69fe07ef81a0efe3c9db9129083247d60943592967f705d62d3859039cec250673eecc06184f70d134cbab85708d957b0a085beff8b3e46325a69547e005b7 SHA512 6a7c162392dd30aea29669275cea814d6daccf7931b8cdb20997f9bbff5619832d5461a6d0f854ecbc4726e52b6937c4f9cb8651087ffe73676c04239a38ca2b
EBUILD clazy-1.11-r1.ebuild 1169 BLAKE2B 941ab83e4ee06ec2da6b81f20299262124f120ce8196b0b81ceac6fdd0eb878492428cf29926b648399e5ef252831bbb2cb09cbe2c0b4b44220d554d51b02112 SHA512 e466bc654f1a3fca0ab13f1dcaf604350f7ab300e15d31ed6ade12efe3bbf41908242c00b8dffb3029173b59d74916b1432212f0b95e754625d9b7a48dc39eac
+EBUILD clazy-1.11-r2.ebuild 1265 BLAKE2B 13214e3943139d9945a6a238717edc9bc50e130f658ed1fd573b69b1b7c995f686d8fb6f81085709e283961bf2193bb68b8dd5497c3f563a198a6ef4c86ed3a4 SHA512 3f37a4009c65e348bd4e79ab9a8db6e13b7011c3688bf4cca6083579a3c79d20e7a1461f9b596a6ec393b6128aee803db8e53e7f5404ec923cf14fcf67c483ae
MISC metadata.xml 318 BLAKE2B 922a5e32e706b2976c5f359a14194d268d3f499398576c80ce5fad8c0fcea0fbf048de4480a80a6a1889c88b8b6c14147654a3ab4d5ffbcc258c2290da63f6d1 SHA512 614cb8dda7ad2088e5d6ef39b449bb4be0ac72cd0231c320188d76d1816dce6490c5114bb4798112c4b11d99d30a9e82ff8fcf08ffa8c049589682a5e38208f6
diff --git a/dev-util/clazy/clazy-1.11-r2.ebuild b/dev-util/clazy/clazy-1.11-r2.ebuild
new file mode 100644
index 000000000000..331c221f4408
--- /dev/null
+++ b/dev-util/clazy/clazy-1.11-r2.ebuild
@@ -0,0 +1,56 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+LLVM_MAX_SLOT=15
+PYTHON_COMPAT=( python3_{8..11} )
+inherit cmake llvm python-any-r1
+
+DESCRIPTION="Compiler plugin which allows clang to understand Qt semantics"
+HOMEPAGE="https://apps.kde.org/clazy"
+SRC_URI="mirror://kde/stable/${PN}/${PV}/src/${P}.tar.xz"
+
+LICENSE="LGPL-2+"
+SLOT="0"
+KEYWORDS="~amd64 ~arm64 ~x86"
+IUSE="test"
+RESTRICT="!test? ( test )"
+
+RDEPEND="<sys-devel/clang-$((${LLVM_MAX_SLOT} + 1)):="
+DEPEND="${RDEPEND}"
+BDEPEND="test? ( ${PYTHON_DEPS} )"
+
+PATCHES=(
+ "${FILESDIR}/${P}-fix-regex-detect.patch"
+ "${FILESDIR}/${P}-fix-llvm-15.patch"
+)
+
+llvm_check_deps() {
+ has_version "sys-devel/clang:${LLVM_SLOT}" && has_version "sys-devel/llvm:${LLVM_SLOT}"
+}
+
+pkg_setup() {
+ use test && python-any-r1_pkg_setup
+
+ llvm_pkg_setup
+}
+
+src_prepare() {
+ cmake_src_prepare
+
+ sed -e '/install(FILES README.md COPYING-LGPL2.txt checks.json DESTINATION/d' \
+ -i CMakeLists.txt || die
+}
+
+src_configure() {
+ export LLVM_ROOT="$(get_llvm_prefix -d ${LLVM_MAX_SLOT})"
+
+ cmake_src_configure
+}
+
+src_test() {
+ # Run tests against built copy, not installed
+ # bug #811723
+ PATH="${BUILD_DIR}/bin:${PATH}" LD_LIBRARY_PATH="${BUILD_DIR}/lib" cmake_src_test
+}
diff --git a/dev-util/clazy/files/clazy-1.11-fix-llvm-15.patch b/dev-util/clazy/files/clazy-1.11-fix-llvm-15.patch
new file mode 100644
index 000000000000..b98e4b1c2fee
--- /dev/null
+++ b/dev-util/clazy/files/clazy-1.11-fix-llvm-15.patch
@@ -0,0 +1,223 @@
+From 20fca52da739ebefa47e35f6b338bb99a0da3cfe Mon Sep 17 00:00:00 2001
+From: Cristian Adam <cristian.adam@qt.io>
+Date: Tue, 6 Sep 2022 16:30:02 +0200
+Subject: [PATCH] Build fixes for LLVM/Clang 15.0.0
+
+Change-Id: Icc39a0b1acffb5a6a4798b1259d8ad4e7dd47bc5
+---
+ CMakeLists.txt | 6 ++++++
+ src/PreProcessorVisitor.cpp | 2 +-
+ src/PreProcessorVisitor.h | 2 +-
+ src/SourceCompatibilityHelpers.h | 15 +++++++++++++++
+ src/Utils.cpp | 3 ++-
+ src/checkbase.cpp | 4 ++--
+ src/checkbase.h | 4 ++--
+ src/checks/manuallevel/qt6-fwd-fixes.cpp | 2 +-
+ src/checks/manuallevel/qt6-fwd-fixes.h | 2 +-
+ src/checks/manuallevel/qt6-header-fixes.cpp | 2 +-
+ src/checks/manuallevel/qt6-header-fixes.h | 2 +-
+ 11 files changed, 33 insertions(+), 11 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 3c780b0d..100135af 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -114,6 +114,10 @@ else()
+ set(clang_tooling_refactoring_lib clangToolingRefactor)
+ endif()
+
++if (${LLVM_VERSION} VERSION_GREATER_EQUAL "15.0.0")
++ set(clang_support_lib clangSupport)
++endif()
++
+ macro(link_to_llvm name is_standalone)
+ if (CLAZY_LINK_CLANG_DYLIB)
+ target_link_libraries(${name} clang-cpp)
+@@ -131,6 +135,7 @@ macro(link_to_llvm name is_standalone)
+
+ target_link_libraries(${name} ${clang_lib})
+ endforeach()
++ target_link_libraries(${name} ${clang_support_lib})
+ target_link_libraries(${name} clangTooling)
+ target_link_libraries(${name} clangToolingCore)
+ target_link_libraries(${name} ${clang_tooling_refactoring_lib})
+@@ -302,6 +307,7 @@ else()
+ clangFrontendTool
+ clangRewrite
+ clangSerialization
++ ${clang_support_lib}
+ clangTooling
+ clangStaticAnalyzerCheckers
+ clangStaticAnalyzerCore
+diff --git a/src/PreProcessorVisitor.cpp b/src/PreProcessorVisitor.cpp
+index 5e63a131..5fdfe5f3 100644
+--- a/src/PreProcessorVisitor.cpp
++++ b/src/PreProcessorVisitor.cpp
+@@ -185,7 +185,7 @@ void PreProcessorVisitor::MacroExpands(const Token &MacroNameTok, const MacroDef
+
+ void PreProcessorVisitor::InclusionDirective (clang::SourceLocation, const clang::Token &,
+ clang::StringRef FileName, bool IsAngled, clang::CharSourceRange FilenameRange,
+- const clang::FileEntry *, clang::StringRef, clang::StringRef,
++ clazy::OptionalFileEntryRef, clang::StringRef, clang::StringRef,
+ const clang::Module *, clang::SrcMgr::CharacteristicKind)
+ {
+ if (m_ci.getPreprocessor().isInPrimaryFile() && !clazy::endsWith(FileName.str(), ".moc")) {
+diff --git a/src/PreProcessorVisitor.h b/src/PreProcessorVisitor.h
+index dc80ff36..1bb17a5e 100644
+--- a/src/PreProcessorVisitor.h
++++ b/src/PreProcessorVisitor.h
+@@ -71,7 +71,7 @@ protected:
+ clang::SourceRange range, const clang::MacroArgs *) override;
+ void InclusionDirective (clang::SourceLocation HashLoc, const clang::Token &IncludeTok,
+ clang::StringRef FileName, bool IsAngled, clang::CharSourceRange FilenameRange,
+- const clang::FileEntry *File, clang::StringRef SearchPath, clang::StringRef RelativePath,
++ clazy::OptionalFileEntryRef File, clang::StringRef SearchPath, clang::StringRef RelativePath,
+ const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType) override;
+ private:
+ std::string getTokenSpelling(const clang::MacroDefinition &) const;
+diff --git a/src/SourceCompatibilityHelpers.h b/src/SourceCompatibilityHelpers.h
+index 4ea923a2..c1a23a4b 100644
+--- a/src/SourceCompatibilityHelpers.h
++++ b/src/SourceCompatibilityHelpers.h
+@@ -144,6 +144,21 @@ inline bool contains_lower(clang::StringRef haystack, clang::StringRef needle)
+ #endif
+ }
+
++#if LLVM_VERSION_MAJOR >= 15
++using OptionalFileEntryRef = clang::Optional<clang::FileEntryRef>;
++#else
++using OptionalFileEntryRef = const clang::FileEntry*;
++#endif
++
++inline bool isAscii(clang::StringLiteral *lt)
++{
++#if LLVM_VERSION_MAJOR >= 15
++ return lt->isOrdinary();
++#else
++ return lt->isAscii();
++#endif
++}
++
+ }
+
+ #endif
+diff --git a/src/Utils.cpp b/src/Utils.cpp
+index 3cdf7876..70e0577c 100644
+--- a/src/Utils.cpp
++++ b/src/Utils.cpp
+@@ -25,6 +25,7 @@
+ #include "Utils.h"
+ #include "StringUtils.h"
+ #include "HierarchyUtils.h"
++#include "SourceCompatibilityHelpers.h"
+ #include "StmtBodyRange.h"
+ #include "clazy_stl.h"
+
+@@ -670,7 +671,7 @@ const CXXRecordDecl *Utils::recordForMemberCall(CXXMemberCallExpr *call, string
+ bool Utils::isAscii(StringLiteral *lt)
+ {
+ // 'é' for some reason has isAscii() == true, so also call containsNonAsciiOrNull
+- return lt && lt->isAscii() && !lt->containsNonAsciiOrNull();
++ return lt && clazy::isAscii(lt) && !lt->containsNonAsciiOrNull();
+ }
+
+ bool Utils::isInDerefExpression(Stmt *s, ParentMap *map)
+diff --git a/src/checkbase.cpp b/src/checkbase.cpp
+index f5936dfd..dcc7c999 100644
+--- a/src/checkbase.cpp
++++ b/src/checkbase.cpp
+@@ -105,7 +105,7 @@ void ClazyPreprocessorCallbacks::MacroDefined(const Token &macroNameTok, const M
+ }
+
+ void ClazyPreprocessorCallbacks::InclusionDirective(clang::SourceLocation HashLoc, const clang::Token &IncludeTok, clang::StringRef FileName, bool IsAngled,
+- clang::CharSourceRange FilenameRange, const clang::FileEntry *File, clang::StringRef SearchPath,
++ clang::CharSourceRange FilenameRange, clazy::OptionalFileEntryRef File, clang::StringRef SearchPath,
+ clang::StringRef RelativePath, const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType)
+ {
+ check->VisitInclusionDirective(HashLoc, IncludeTok, FileName, IsAngled, FilenameRange, File, SearchPath, RelativePath, Imported, FileType);
+@@ -182,7 +182,7 @@ void CheckBase::VisitEndif(SourceLocation, SourceLocation)
+ }
+
+ void CheckBase::VisitInclusionDirective(clang::SourceLocation , const clang::Token &, clang::StringRef , bool ,
+- clang::CharSourceRange , const clang::FileEntry *, clang::StringRef ,
++ clang::CharSourceRange , clazy::OptionalFileEntryRef, clang::StringRef ,
+ clang::StringRef , const clang::Module *, clang::SrcMgr::CharacteristicKind )
+ {
+ // Overriden in derived classes
+diff --git a/src/checkbase.h b/src/checkbase.h
+index c5db2daf..02f6a6bf 100644
+--- a/src/checkbase.h
++++ b/src/checkbase.h
+@@ -91,7 +91,7 @@ public:
+ void Else(clang::SourceLocation loc, clang::SourceLocation ifLoc) override;
+ void Endif(clang::SourceLocation loc, clang::SourceLocation ifLoc) override;
+ void InclusionDirective(clang::SourceLocation HashLoc, const clang::Token &IncludeTok, clang::StringRef FileName, bool IsAngled,
+- clang::CharSourceRange FilenameRange, const clang::FileEntry *File, clang::StringRef SearchPath,
++ clang::CharSourceRange FilenameRange, clazy::OptionalFileEntryRef File, clang::StringRef SearchPath,
+ clang::StringRef RelativePath, const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType) override;
+ private:
+ CheckBase *const check;
+@@ -151,7 +151,7 @@ protected:
+ virtual void VisitElse(clang::SourceLocation loc, clang::SourceLocation ifLoc);
+ virtual void VisitEndif(clang::SourceLocation loc, clang::SourceLocation ifLoc);
+ virtual void VisitInclusionDirective(clang::SourceLocation HashLoc, const clang::Token &IncludeTok, clang::StringRef FileName, bool IsAngled,
+- clang::CharSourceRange FilenameRange, const clang::FileEntry *File, clang::StringRef SearchPath,
++ clang::CharSourceRange FilenameRange, clazy::OptionalFileEntryRef File, clang::StringRef SearchPath,
+ clang::StringRef RelativePath, const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType);
+
+ void enablePreProcessorCallbacks();
+diff --git a/src/checks/manuallevel/qt6-fwd-fixes.cpp b/src/checks/manuallevel/qt6-fwd-fixes.cpp
+index 83bf81ee..c87d9ca0 100644
+--- a/src/checks/manuallevel/qt6-fwd-fixes.cpp
++++ b/src/checks/manuallevel/qt6-fwd-fixes.cpp
+@@ -166,7 +166,7 @@ void Qt6FwdFixes::VisitDecl(clang::Decl *decl)
+ }
+
+ void Qt6FwdFixes::VisitInclusionDirective(clang::SourceLocation HashLoc, const clang::Token &IncludeTok, clang::StringRef FileName, bool IsAngled,
+- clang::CharSourceRange FilenameRange, const clang::FileEntry *File, clang::StringRef SearchPath,
++ clang::CharSourceRange FilenameRange, clazy::OptionalFileEntryRef File, clang::StringRef SearchPath,
+ clang::StringRef RelativePath, const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType)
+ {
+ auto current_file = m_sm.getFilename(HashLoc);
+diff --git a/src/checks/manuallevel/qt6-fwd-fixes.h b/src/checks/manuallevel/qt6-fwd-fixes.h
+index 37b59d95..bb928ba6 100644
+--- a/src/checks/manuallevel/qt6-fwd-fixes.h
++++ b/src/checks/manuallevel/qt6-fwd-fixes.h
+@@ -47,7 +47,7 @@ public:
+ explicit Qt6FwdFixes(const std::string &name, ClazyContext *context);
+ void VisitDecl(clang::Decl *decl) override;
+ void VisitInclusionDirective(clang::SourceLocation HashLoc, const clang::Token &IncludeTok, clang::StringRef FileName, bool IsAngled,
+- clang::CharSourceRange FilenameRange, const clang::FileEntry *File, clang::StringRef SearchPath,
++ clang::CharSourceRange FilenameRange, clazy::OptionalFileEntryRef File, clang::StringRef SearchPath,
+ clang::StringRef RelativePath, const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType) override;
+ bool m_including_qcontainerfwd = false;
+ std::set<clang::StringRef> m_qcontainerfwd_included_in_files;
+diff --git a/src/checks/manuallevel/qt6-header-fixes.cpp b/src/checks/manuallevel/qt6-header-fixes.cpp
+index d458b77c..aaa28093 100644
+--- a/src/checks/manuallevel/qt6-header-fixes.cpp
++++ b/src/checks/manuallevel/qt6-header-fixes.cpp
+@@ -270,7 +270,7 @@ Qt6HeaderFixes::Qt6HeaderFixes(const std::string &name, ClazyContext *context)
+ }
+
+ void Qt6HeaderFixes::VisitInclusionDirective(clang::SourceLocation HashLoc, const clang::Token &IncludeTok, clang::StringRef FileName, bool IsAngled,
+- clang::CharSourceRange FilenameRange, const clang::FileEntry *File, clang::StringRef SearchPath,
++ clang::CharSourceRange FilenameRange, clazy::OptionalFileEntryRef File, clang::StringRef SearchPath,
+ clang::StringRef RelativePath, const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType)
+ {
+ if (shouldIgnoreFile(HashLoc))
+diff --git a/src/checks/manuallevel/qt6-header-fixes.h b/src/checks/manuallevel/qt6-header-fixes.h
+index ae09f7ad..8ffbb100 100644
+--- a/src/checks/manuallevel/qt6-header-fixes.h
++++ b/src/checks/manuallevel/qt6-header-fixes.h
+@@ -46,7 +46,7 @@ class Qt6HeaderFixes
+ public:
+ explicit Qt6HeaderFixes(const std::string &name, ClazyContext *context);
+ void VisitInclusionDirective(clang::SourceLocation HashLoc, const clang::Token &IncludeTok, clang::StringRef FileName, bool IsAngled,
+- clang::CharSourceRange FilenameRange, const clang::FileEntry *File, clang::StringRef SearchPath,
++ clang::CharSourceRange FilenameRange, clazy::OptionalFileEntryRef File, clang::StringRef SearchPath,
+ clang::StringRef RelativePath, const clang::Module *Imported, clang::SrcMgr::CharacteristicKind FileType) override;
+
+ };
+--
+GitLab
+
diff --git a/dev-util/clazy/files/clazy-1.11-fix-regex-detect.patch b/dev-util/clazy/files/clazy-1.11-fix-regex-detect.patch
new file mode 100644
index 000000000000..a60206365ea1
--- /dev/null
+++ b/dev-util/clazy/files/clazy-1.11-fix-regex-detect.patch
@@ -0,0 +1,25 @@
+From 336b54f28250938cc2a8d7bb78e638e79b6467d5 Mon Sep 17 00:00:00 2001
+From: Hannah von Reth <vonreth@kde.org>
+Date: Fri, 8 Jul 2022 11:19:22 +0000
+Subject: [PATCH] Fix regex detection
+
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 434a57c9..3c780b0d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -81,7 +81,7 @@ endif()
+
+ # Look for std::regex support
+ message("Looking for std::regex support...")
+-try_run(REGEX_RUN_RESULT COMPILE_RESULT ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/.cmake_has_regex_test.cpp)
++try_run(REGEX_RUN_RESULT COMPILE_RESULT ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/.cmake_has_regex_test.cpp CXX_STANDARD 17 CXX_STANDARD_REQUIRED true)
+
+ if(NOT REGEX_RUN_RESULT EQUAL 0)
+ message("Using boost::regex instead of std::regex")
+--
+GitLab
+