diff options
Diffstat (limited to 'dev-util/clazy')
-rw-r--r-- | dev-util/clazy/Manifest | 6 | ||||
-rw-r--r-- | dev-util/clazy/clazy-1.12.ebuild | 57 | ||||
-rw-r--r-- | dev-util/clazy/files/clazy-1.12-clang-16-no-src-root.patch | 60 | ||||
-rw-r--r-- | dev-util/clazy/files/clazy-1.12-fix-tests-Qt-detect-1.patch | 78 | ||||
-rw-r--r-- | dev-util/clazy/files/clazy-1.12-fix-tests-Qt-detect-2.patch | 115 | ||||
-rw-r--r-- | dev-util/clazy/files/clazy-1.12-llvm-18.patch | 36 |
6 files changed, 352 insertions, 0 deletions
diff --git a/dev-util/clazy/Manifest b/dev-util/clazy/Manifest index 868b3ad68670..2cf6afaa8f8e 100644 --- a/dev-util/clazy/Manifest +++ b/dev-util/clazy/Manifest @@ -3,6 +3,12 @@ AUX clazy-1.11-fix-llvm-16.patch 3418 BLAKE2B bee024e761008e6d1bf14f4ac285fecab7 AUX clazy-1.11-fix-llvm-17.patch 1546 BLAKE2B fdc8a1387c6db82c993ec935bcbbe1e58f6e754f90efb65f9f8da2ab00e2240a9a7dcc287f3055a3a86e91f7dd8b6ddb8c1df9e7c4bfc9831f401fea14055c4f SHA512 90c60cc4d6b589ddba1a5b6b9bc077dd79a48894bcdce0cb99d51e768ee325b21cc83e56e57f1cfd1d4bb2c7e443d663c2dec55aca5e07df8db0ce19f0fa99c8 AUX clazy-1.11-fix-regex-detect.patch 859 BLAKE2B 6a953c3927dcc1a3aac5aab55c01eb1eaf977f40c96c26f57032608de8e0d709ae6bf67f5d04f991ee14ded80023a8faf19b9ea18f9a2e2dd9dc19b2831ff58c SHA512 8bd1ab72bf36620250a228f9cb45fe403853d16c5eec8704c6980405ffca71cfcea82f9587b3b3f748ab623ecee757cb8adc54c7a137c5070eb04e26d06fab36 AUX clazy-1.11-jobs-for-tests.patch 1626 BLAKE2B 58d8c059fa631c2c534e6ec2c33268af88ef95e5ed7b1b3bb37d189d61bd998143a7fa5d38d40a925c6dd59592e0df30c22d42c04cb3f1bb5d915afad2b879e9 SHA512 1fd25f986d8ecf092fe3dcf73a61609f183e1d90d4926676cd8c4de34326a8ed7610a05dee5eafe91d4a5b830f4423c5b66be3f049a26b632e1e094f3f2ac446 +AUX clazy-1.12-clang-16-no-src-root.patch 2167 BLAKE2B 84f2cd26abea61998f4e78cb325126bd61b539924bbb1140793b888db8c80b891afb21700472a8d44d0c37e6da613350be570802ceffcd342463854bcd45af6f SHA512 da93e8320184f832c20f390d9b77a9829972cb9d95ca801d072efc41fc88fd584fc423a000c40621f86040fe5a9d3468382f390a7b525b4677a1e7163004d466 +AUX clazy-1.12-fix-tests-Qt-detect-1.patch 3388 BLAKE2B 4aace0f453e84a3e00651eda4a30dc1b84032789d22a7cedd1eee7338d5f52f49f03e0e92a1220de187ad90e9a3cf9ab14c8f5e1f57559d8a385f3bd705a771b SHA512 926a8fbfd7134b9e1b553273e39817cb35d5e6b5d29ed43b77b5eedef9faa6d9cde7441923d5bf6eaf2b19b2d7c7a97b23ae866ff1b8b5e3a02754a2234183f6 +AUX clazy-1.12-fix-tests-Qt-detect-2.patch 5164 BLAKE2B 7ce4d58f5ca52df4ce229c7892cec13754e557000e755f7f3954b7810aacad3e5d001e0ea90422191c5869b954387cb22baff2e485666e9f0ef2803819587a4c SHA512 3b84aa5f407402a4abef33090f2efc60cc8dca47f0f2324c61f825b674023080ec9c4d693aed451642c80dd38759ef8bca942faff6dad7d6bc79aa1be4515a14 +AUX clazy-1.12-llvm-18.patch 1532 BLAKE2B 6527759799a8e99db6c996177f2f4ed9b1fd5f2327b2a950db6138c2bc4dd6c0b8f2d06bc45668836b8a6fc406df0973f9b3f5218361f2d401b7180cb824e308 SHA512 b0666907bb4d023e605b2b8ce4fd9addaa477e87a811d38bdb68c03bdf4a45d52fabb191e300cf3f877eb32189e23b23046c702c11e50527b474d79e4695c2de DIST clazy-1.11.tar.xz 404088 BLAKE2B 1a69fe07ef81a0efe3c9db9129083247d60943592967f705d62d3859039cec250673eecc06184f70d134cbab85708d957b0a085beff8b3e46325a69547e005b7 SHA512 6a7c162392dd30aea29669275cea814d6daccf7931b8cdb20997f9bbff5619832d5461a6d0f854ecbc4726e52b6937c4f9cb8651087ffe73676c04239a38ca2b +DIST clazy-1.12.tar.xz 427740 BLAKE2B ad2c78a506132b5fd6b3c22a7e9794c38ddd71242cde6f760e48d0250f6215629007d45303f4b35fdc7717865b8221ab1c2f3c6889a44ea1809e112845f16463 SHA512 7a2b4a753098f15936a4731c82c660c1cd4d81949279435e87f00f7f72bef3e32cb574c8991c0707798581278e9fbcae34d354c1e6b77a15a5e26166d658fa9e EBUILD clazy-1.11-r4.ebuild 1312 BLAKE2B 5ff282ba38629cdd15ea65c1837d798563ac6ef396f771c6d91058c3e0f82ffab4e69b2ca7842afc96514b89b49c23f4aac291d6c186bdc285510500e87e063f SHA512 7c6e9aee3960b00e778455fd9832b41d845beaff25e1fb9c0959168598c3162a93c3592164533ea9183d782b5ebcfa54a4ffbab28544e69318628d0e62cd460f +EBUILD clazy-1.12.ebuild 1339 BLAKE2B 5722f7d78da41318a8623c6a8252718ed8d9419e254a28e6ee1bb5ce0a5c8e2ffbf5ce20446be29a85f0f4b6ba03ba80c3536a7e28e2a43ab1bc7fb9806a3821 SHA512 726222bfc835c0ada17db5f8f7a1df0aeb59bf4b3f3a6c009e14f62e0ddb50ba02fc2b0782baabf332fd43d7c01c4c73e9c9758b3287abc1f329f3e11ad00973 MISC metadata.xml 318 BLAKE2B 922a5e32e706b2976c5f359a14194d268d3f499398576c80ce5fad8c0fcea0fbf048de4480a80a6a1889c88b8b6c14147654a3ab4d5ffbcc258c2290da63f6d1 SHA512 614cb8dda7ad2088e5d6ef39b449bb4be0ac72cd0231c320188d76d1816dce6490c5114bb4798112c4b11d99d30a9e82ff8fcf08ffa8c049589682a5e38208f6 diff --git a/dev-util/clazy/clazy-1.12.ebuild b/dev-util/clazy/clazy-1.12.ebuild new file mode 100644 index 000000000000..b5e819706f76 --- /dev/null +++ b/dev-util/clazy/clazy-1.12.ebuild @@ -0,0 +1,57 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +LLVM_COMPAT=( 15 16 17 18 ) +PYTHON_COMPAT=( python3_{10..13} ) +inherit cmake llvm-r1 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=" + $(llvm_gen_dep 'sys-devel/clang:${LLVM_SLOT}') + $(llvm_gen_dep 'sys-devel/llvm:${LLVM_SLOT}') +" +DEPEND="${RDEPEND}" +BDEPEND="test? ( ${PYTHON_DEPS} )" + +PATCHES=( + # git master + "${FILESDIR}"/${P}-fix-tests-Qt-detect-{1,2}.patch + "${FILESDIR}"/${P}-llvm-18.patch + # Pending: https://invent.kde.org/sdk/clazy/-/merge_requests/131 + "${FILESDIR}"/${P}-clang-16-no-src-root.patch +) + +pkg_setup() { + use test && python-any-r1_pkg_setup + llvm-r1_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)" + + 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.12-clang-16-no-src-root.patch b/dev-util/clazy/files/clazy-1.12-clang-16-no-src-root.patch new file mode 100644 index 000000000000..ca88efeaf6cd --- /dev/null +++ b/dev-util/clazy/files/clazy-1.12-clang-16-no-src-root.patch @@ -0,0 +1,60 @@ +From 4fa1ded456626f9c13f1f77212754d6349d12a8a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Christoph=20Gr=C3=BCninger?= <foss@grueninger.de> +Date: Tue, 27 Feb 2024 21:14:19 +0100 +Subject: [PATCH] [cmake] Adjust for non-installed LLVM + +In LLVM 16 llvm-config got --src-root removed. +Adjust include path for Clang include +--- + cmake/FindClang.cmake | 8 ++++++-- + cmake/FindLLVM.cmake | 6 +++++- + 2 files changed, 11 insertions(+), 3 deletions(-) + +diff --git a/cmake/FindClang.cmake b/cmake/FindClang.cmake +index e438ea5c..b4f0b0a1 100644 +--- a/cmake/FindClang.cmake ++++ b/cmake/FindClang.cmake +@@ -86,8 +86,12 @@ if(CLANG_FOUND) + set(CLANG_INCLUDE_DIRS ${LLVM_INCLUDE_DIRS}) + + # check whether llvm-config comes from an install prefix ++ set(LLVM_CONFIG_INCLUDE_FLAG "--src-root") ++ if (${LLVM_VERSION} VERSION_GREATER_EQUAL 16) ++ set(LLVM_CONFIG_INCLUDE_FLAG "--includedir") ++ endif() + execute_process( +- COMMAND ${LLVM_CONFIG_EXECUTABLE} --src-root ++ COMMAND ${LLVM_CONFIG_EXECUTABLE} ${LLVM_CONFIG_INCLUDE_FLAG} + OUTPUT_VARIABLE _llvmSourceRoot + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +@@ -96,7 +100,7 @@ if(CLANG_FOUND) + message(STATUS "Detected that llvm-config comes from a build-tree, adding more include directories for Clang") + list(APPEND CLANG_INCLUDE_DIRS + "${LLVM_INSTALL_PREFIX}/tools/clang/include" # build dir +- "${_llvmSourceRoot}/tools/clang/include" # source dir ++ "${_llvmSourceRoot}/../../clang/include" # source dir + ) + endif() + +diff --git a/cmake/FindLLVM.cmake b/cmake/FindLLVM.cmake +index da02e006..c625eeb5 100644 +--- a/cmake/FindLLVM.cmake ++++ b/cmake/FindLLVM.cmake +@@ -131,8 +131,12 @@ if (LLVM_FOUND) + endif() + + # potentially add include dir from binary dir for non-installed LLVM ++ set(LLVM_CONFIG_INCLUDE_FLAG "--src-root") ++ if (${LLVM_VERSION} VERSION_GREATER_EQUAL 16) ++ set(LLVM_CONFIG_INCLUDE_FLAG "--includedir") ++ endif() + execute_process( +- COMMAND ${LLVM_CONFIG_EXECUTABLE} --src-root ++ COMMAND ${LLVM_CONFIG_EXECUTABLE} ${LLVM_CONFIG_INCLUDE_FLAG} + OUTPUT_VARIABLE _llvmSourceRoot + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +-- +GitLab + diff --git a/dev-util/clazy/files/clazy-1.12-fix-tests-Qt-detect-1.patch b/dev-util/clazy/files/clazy-1.12-fix-tests-Qt-detect-1.patch new file mode 100644 index 000000000000..bca03b24dff4 --- /dev/null +++ b/dev-util/clazy/files/clazy-1.12-fix-tests-Qt-detect-1.patch @@ -0,0 +1,78 @@ +From 61b03a0d9cb319173766383216deee74fd6d800e Mon Sep 17 00:00:00 2001 +From: Alexander Lohnau <alexander.lohnau@gmx.de> +Date: Sat, 7 Sep 2024 11:31:22 +0200 +Subject: [PATCH] Make tests work when clang library is different from system + default + +If we have found the clang folder, we can resolve the executable from there. +In my case, I was compiling against clang16, but my system default was clang 14. +The stacktrace is really confusing and hard to understand. Using the +absolute path makes the log also better to understand and to reproduce +the test results. +--- + ClazyTests.generated.cmake | 5 ++++- + cmake/FindLLVM.cmake | 13 +++++++++++++ + dev-scripts/generate.py | 5 ++++- + 3 files changed, 21 insertions(+), 2 deletions(-) + +diff --git a/ClazyTests.generated.cmake b/ClazyTests.generated.cmake +index 204f0e5b..49b0f69e 100644 +--- a/ClazyTests.generated.cmake ++++ b/ClazyTests.generated.cmake +@@ -2,8 +2,11 @@ + + macro(add_clazy_test name) + add_test(NAME ${name} COMMAND python3 run_tests.py ${name} --verbose WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests/) ++ if (CLANG_EXECUTABLE_PATH) ++ set(CLANG_CXX_TEST "CLANGXX=${CLANG_EXECUTABLE_PATH};") ++ endif() + set_property(TEST ${name} PROPERTY +- ENVIRONMENT "CLAZYPLUGIN_CXX=$<TARGET_FILE:ClazyPlugin>;CLAZYSTANDALONE_CXX=$<TARGET_FILE:clazy-standalone>;$<$<BOOL:${HAS_STD_FILESYSTEM}>:CLAZY_HAS_FILESYSTEM=>" ++ ENVIRONMENT "${CLANG_CXX_TEST}CLAZYPLUGIN_CXX=$<TARGET_FILE:ClazyPlugin>;CLAZYSTANDALONE_CXX=$<TARGET_FILE:clazy-standalone>;$<$<BOOL:${HAS_STD_FILESYSTEM}>:CLAZY_HAS_FILESYSTEM=>" + ) + endmacro() + +diff --git a/cmake/FindLLVM.cmake b/cmake/FindLLVM.cmake +index a1fd9e3f..da02e006 100644 +--- a/cmake/FindLLVM.cmake ++++ b/cmake/FindLLVM.cmake +@@ -117,6 +117,19 @@ if (LLVM_FOUND) + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + ++ execute_process( ++ COMMAND ${LLVM_CONFIG_EXECUTABLE} --bindir ++ OUTPUT_VARIABLE LLVM_BIN_DIR ++ OUTPUT_STRIP_TRAILING_WHITESPACE ++ ) ++ set(CLANG_EXECUTABLE_PATH "${LLVM_BIN_DIR}/clang") ++ if(EXISTS ${CLANG_EXECUTABLE_PATH}) ++ message(STATUS "Clang found: ${CLANG_EXECUTABLE_PATH}") ++ set(CLANG_EXECUTABLE ${CLANG_EXECUTABLE_PATH}) ++ else() ++ message(WARNING "Clang not found in LLVM bin directory: ${LLVM_BIN_DIR}") ++ endif() ++ + # potentially add include dir from binary dir for non-installed LLVM + execute_process( + COMMAND ${LLVM_CONFIG_EXECUTABLE} --src-root +diff --git a/dev-scripts/generate.py b/dev-scripts/generate.py +index 2678aaba..11fc5bfc 100755 +--- a/dev-scripts/generate.py ++++ b/dev-scripts/generate.py +@@ -468,8 +468,11 @@ def generate_ctest(checks): + contents = """# This file was autogenerated by running: ./dev-scripts/generate.py --generate\n + macro(add_clazy_test name) + add_test(NAME ${name} COMMAND python3 run_tests.py ${name} --verbose WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests/) ++ if (CLANG_EXECUTABLE_PATH) ++ set(CLANG_CXX_TEST "CLANGXX=${CLANG_EXECUTABLE_PATH};") ++ endif() + set_property(TEST ${name} PROPERTY +- ENVIRONMENT "CLAZYPLUGIN_CXX=$<TARGET_FILE:ClazyPlugin>;CLAZYSTANDALONE_CXX=$<TARGET_FILE:clazy-standalone>;$<$<BOOL:${HAS_STD_FILESYSTEM}>:CLAZY_HAS_FILESYSTEM=>" ++ ENVIRONMENT "${CLANG_CXX_TEST}CLAZYPLUGIN_CXX=$<TARGET_FILE:ClazyPlugin>;CLAZYSTANDALONE_CXX=$<TARGET_FILE:clazy-standalone>;$<$<BOOL:${HAS_STD_FILESYSTEM}>:CLAZY_HAS_FILESYSTEM=>" + ) + endmacro()\n + """ +-- +GitLab + diff --git a/dev-util/clazy/files/clazy-1.12-fix-tests-Qt-detect-2.patch b/dev-util/clazy/files/clazy-1.12-fix-tests-Qt-detect-2.patch new file mode 100644 index 000000000000..9e5276644ad7 --- /dev/null +++ b/dev-util/clazy/files/clazy-1.12-fix-tests-Qt-detect-2.patch @@ -0,0 +1,115 @@ +From fc058479b1d0ab8498b23a68dcbb56be1b38c793 Mon Sep 17 00:00:00 2001 +From: Alexander Lohnau <alexander.lohnau@gmx.de> +Date: Sat, 7 Sep 2024 14:25:45 +0200 +Subject: [PATCH] Only look for Qt5/Qt6 installs if respective CI job is + running + +We may have a qt6 installation even on a Qt5 image + +But in any case, we should only run them on the dedicated im age and not waste CI time otherwise +--- + ClazyTests.generated.cmake | 8 +++++++- + dev-scripts/generate.py | 8 +++++++- + tests/run_tests.py | 22 ++++++++++++++-------- + 3 files changed, 28 insertions(+), 10 deletions(-) + +diff --git a/ClazyTests.generated.cmake b/ClazyTests.generated.cmake +index 49b0f69e..9babc7c5 100644 +--- a/ClazyTests.generated.cmake ++++ b/ClazyTests.generated.cmake +@@ -1,7 +1,13 @@ + # This file was autogenerated by running: ./dev-scripts/generate.py --generate + ++if ($ENV{CI_JOB_NAME_SLUG} MATCHES "qt5") ++ set(TEST_VERSION_OPTION "--qt-versions=5") ++elseif($ENV{CI_JOB_NAME_SLUG} MATCHES "qt6") ++ set(TEST_VERSION_OPTION "--qt-versions=6") ++endif() ++ + macro(add_clazy_test name) +- add_test(NAME ${name} COMMAND python3 run_tests.py ${name} --verbose WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests/) ++ add_test(NAME ${name} COMMAND python3 run_tests.py ${name} --verbose ${TEST_VERSION_OPTION} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests/) + if (CLANG_EXECUTABLE_PATH) + set(CLANG_CXX_TEST "CLANGXX=${CLANG_EXECUTABLE_PATH};") + endif() +diff --git a/dev-scripts/generate.py b/dev-scripts/generate.py +index 11fc5bfc..a1233698 100755 +--- a/dev-scripts/generate.py ++++ b/dev-scripts/generate.py +@@ -466,8 +466,14 @@ def generate_ctest(checks): + filename = clazy_source_path() + 'ClazyTests.generated.cmake' + + contents = """# This file was autogenerated by running: ./dev-scripts/generate.py --generate\n ++if ($ENV{CI_JOB_NAME_SLUG} MATCHES "qt5") ++ set(TEST_VERSION_OPTION "--qt-versions=5") ++elseif($ENV{CI_JOB_NAME_SLUG} MATCHES "qt6") ++ set(TEST_VERSION_OPTION "--qt-versions=6") ++endif() ++ + macro(add_clazy_test name) +- add_test(NAME ${name} COMMAND python3 run_tests.py ${name} --verbose WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests/) ++ add_test(NAME ${name} COMMAND python3 run_tests.py ${name} --verbose ${TEST_VERSION_OPTION} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/tests/) + if (CLANG_EXECUTABLE_PATH) + set(CLANG_CXX_TEST "CLANGXX=${CLANG_EXECUTABLE_PATH};") + endif() +diff --git a/tests/run_tests.py b/tests/run_tests.py +index 9fb9d5dc..da54e45a 100755 +--- a/tests/run_tests.py ++++ b/tests/run_tests.py +@@ -457,6 +457,8 @@ parser.add_argument("--only-standalone", action='store_true', + help='Only run clazy-standalone') + parser.add_argument("--dump-ast", action='store_true', + help='Dump a unit-test AST to file') ++parser.add_argument("--qt-versions", type=int, choices=[5, 6], nargs='+', default=[5, 6], ++ help='Specify one or more Qt versions to use (default: 5 and 6)') + parser.add_argument( + "--exclude", help='Comma separated list of checks to ignore') + parser.add_argument("-j", "--jobs", type=int, default=multiprocessing.cpu_count(), +@@ -481,10 +483,14 @@ _only_standalone = args.only_standalone + _num_threads = args.jobs + _lock = threading.Lock() + _was_successful = True +-_qt6_installation = find_qt_installation( +- 6, ["QT_SELECT=6 qmake", "qmake-qt6", "qmake", "qmake6"]) +-_qt5_installation = find_qt_installation( +- 5, ["QT_SELECT=5 qmake", "qmake-qt5", "qmake", "qmake5"]) ++if 6 in args.qt_versions: ++ _qt6_installation = find_qt_installation(6, ["QT_SELECT=6 qmake", "qmake-qt6", "qmake", "qmake6"]) ++else: ++ _qt6_installation = None ++if 5 in args.qt_versions: ++ _qt5_installation = find_qt_installation(5, ["QT_SELECT=5 qmake", "qmake-qt5", "qmake", "qmake5"]) ++else: ++ _qt5_installation = None + _excluded_checks = args.exclude.split(',') if args.exclude is not None else [] + + # ------------------------------------------------------------------------------- +@@ -697,6 +703,8 @@ def run_unit_test(test, is_standalone, cppStandard, qt_major_version): + return True + + qt = qt_installation(qt_major_version) ++ if qt == None: ++ return True # silently skip + + if _verbose: + print("Qt major versions required by the test: " + str(test.qt_major_versions)) +@@ -709,14 +717,12 @@ def run_unit_test(test, is_standalone, cppStandard, qt_major_version): + + if qt.int_version < test.minimum_qt_version or qt.int_version > test.maximum_qt_version or CLANG_VERSION < test.minimum_clang_version: + if (_verbose): +- print("Skipping " + printableName + +- " because required version is not available") ++ print("Skipping " + printableName + " because required version is not available") + return True + + if test.requires_std_filesystem and not _hasStdFileSystem: + if (_verbose): +- print("Skipping " + printableName + +- " because it requires std::filesystem") ++ print("Skipping " + printableName + " because it requires std::filesystem") + return True + + if _platform in test.blacklist_platforms: +-- +GitLab + diff --git a/dev-util/clazy/files/clazy-1.12-llvm-18.patch b/dev-util/clazy/files/clazy-1.12-llvm-18.patch new file mode 100644 index 000000000000..d1f2bea9ffbf --- /dev/null +++ b/dev-util/clazy/files/clazy-1.12-llvm-18.patch @@ -0,0 +1,36 @@ +From 0d87de91457c3bf2338b997555694953d45e17a4 Mon Sep 17 00:00:00 2001 +From: Alexander Lohnau <alexander.lohnau@gmx.de> +Date: Tue, 10 Sep 2024 13:50:56 +0200 +Subject: [PATCH] rule-of-three: Fix destructor not being found and thus + causing false positive + +This works fine in clang 14, but apparently not in later versions + +The false positive caused a CI failure in https://invent.kde.org/libraries/qca/-/merge_requests/116 +--- + src/checks/level2/rule-of-three.cpp | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/src/checks/level2/rule-of-three.cpp b/src/checks/level2/rule-of-three.cpp +index 6996ee1e..f18ff999 100644 +--- a/src/checks/level2/rule-of-three.cpp ++++ b/src/checks/level2/rule-of-three.cpp +@@ -56,7 +56,14 @@ void RuleOfThree::VisitDecl(clang::Decl *decl) + + CXXConstructorDecl *copyCtor = Utils::copyCtor(record); + CXXMethodDecl *copyAssign = Utils::copyAssign(record); +- CXXDestructorDecl *destructor = record->getDestructor(); ++ CXXDestructorDecl *destructor = nullptr; ++ // Getting the destructor using record->getDestructor() does not work for later clang versions, e.g. clang 16 ++ for (auto *decl : record->decls()) { ++ if (auto *destructorDecl = dyn_cast<CXXDestructorDecl>(decl)) { ++ destructor = destructorDecl; ++ break; ++ } ++ } + const bool dtorDefaultedByUser = destructor && destructor->isDefaulted() && !destructor->isImplicit(); + + const bool hasUserCopyCtor = copyCtor && copyCtor->isUserProvided(); +-- +GitLab + |