git: 44e78a276ae8 - main - devel/clazy: unbreak with LLVM >= 17
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 29 Dec 2023 22:54:09 UTC
The branch main has been updated by fluffy:
URL: https://cgit.FreeBSD.org/ports/commit/?id=44e78a276ae8efd41b238740eabf53ac168938ff
commit 44e78a276ae8efd41b238740eabf53ac168938ff
Author: Dima Panov <fluffy@FreeBSD.org>
AuthorDate: 2023-12-29 22:53:25 +0000
Commit: Dima Panov <fluffy@FreeBSD.org>
CommitDate: 2023-12-29 22:53:25 +0000
devel/clazy: unbreak with LLVM >= 17
Reported by: poudriere failure
---
...anuallevel_unexpected-flag-enumerator-value.cpp | 28 ++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/devel/clazy/files/patch-src_checks_manuallevel_unexpected-flag-enumerator-value.cpp b/devel/clazy/files/patch-src_checks_manuallevel_unexpected-flag-enumerator-value.cpp
new file mode 100644
index 000000000000..cc4cbd6944e8
--- /dev/null
+++ b/devel/clazy/files/patch-src_checks_manuallevel_unexpected-flag-enumerator-value.cpp
@@ -0,0 +1,28 @@
+--- src/checks/manuallevel/unexpected-flag-enumerator-value.cpp.orig 2022-01-20 23:18:47 UTC
++++ src/checks/manuallevel/unexpected-flag-enumerator-value.cpp
+@@ -61,8 +61,13 @@ static bool isIntentionallyNotPowerOf2(EnumConstantDec
+ if (val.isMask() && val.countTrailingOnes() >= MinOnesToQualifyAsMask)
+ return true;
+
++#if LLVM_VERSION_MAJOR >= 17
++ if (val.isMask() && 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::VisitDecl(clang::D
+
+ 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();