diff options
Diffstat (limited to 'dev-util/clazy/files/clazy-1.11-fix-llvm-17.patch')
-rw-r--r-- | dev-util/clazy/files/clazy-1.11-fix-llvm-17.patch | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/dev-util/clazy/files/clazy-1.11-fix-llvm-17.patch b/dev-util/clazy/files/clazy-1.11-fix-llvm-17.patch new file mode 100644 index 000000000000..6550b63a3506 --- /dev/null +++ b/dev-util/clazy/files/clazy-1.11-fix-llvm-17.patch @@ -0,0 +1,38 @@ +From a9aabd821d8be7932c954e1cdd8d4e10f38f8785 Mon Sep 17 00:00:00 2001 +From: Cristian Adam <cristian.adam@gmail.com> +Date: Mon, 14 Aug 2023 18:16:01 +0200 +Subject: [PATCH] Fix compilation with LLVM 17.0.0 (rc2) + +Change-Id: I9d3fc86185c1e7c86145da043e1982d2979b36e9 +--- + .../manuallevel/unexpected-flag-enumerator-value.cpp | 10 ++++++++++ + 1 file changed, 10 insertions(+) + +--- a/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp ++++ b/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp +@@ -61,8 +61,13 @@ static bool isIntentionallyNotPowerOf2(E + if (val.isMask() && val.countTrailingOnes() >= MinOnesToQualifyAsMask) + return true; + ++#if LLVM_VERSION_MAJOR >= 17 ++ if (val.isShiftedMask() && val.popcount() >= MinOnesToQualifyAsMask) ++ return true; ++#else + if (val.isShiftedMask() && val.countPopulation() >= MinOnesToQualifyAsMask) + return true; ++#endif + + if (clazy::contains_lower(en->getName(), "mask")) + return true; +@@ -158,7 +163,11 @@ void UnexpectedFlagEnumeratorValue::Visi + + for (EnumConstantDecl* enumerator : enumerators) { + const auto &initVal = enumerator->getInitVal(); ++#if LLVM_VERSION_MAJOR >= 17 ++ if (!initVal.isPowerOf2() && !initVal.isZero() && !initVal.isNegative()) { ++#else + if (!initVal.isPowerOf2() && !initVal.isNullValue() && !initVal.isNegative()) { ++#endif + if (isIntentionallyNotPowerOf2(enumerator)) + continue; + const auto value = enumerator->getInitVal().getLimitedValue(); |