mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 12:10:06 +02:00
clazy, bump version (#10357)
This commit is contained in:
@@ -8,55 +8,62 @@ COPYRIGHT="2016-2019 Sérgio Martins"
|
||||
LICENSE="GNU LGPL v2"
|
||||
REVISION="1"
|
||||
SOURCE_URI="https://download.kde.org/stable/clazy/$portVersion/src/clazy-$portVersion.tar.xz"
|
||||
CHECKSUM_SHA256="806d1befaddba82316f4ea34f1cba38bcc7545d0981007e3527c1ff1576dd0de"
|
||||
CHECKSUM_SHA256="66165df33be8785218720c8947aa9099bae6d06c90b1501953d9f95fdfa0120a"
|
||||
# upstream patches
|
||||
PATCHES="clazy-$portVersion.patchset"
|
||||
|
||||
ARCHITECTURES="all !x86_gcc2 ?x86"
|
||||
ARCHITECTURES="all !x86_gcc2"
|
||||
SECONDARY_ARCHITECTURES="x86"
|
||||
|
||||
commandBinDir=$binDir
|
||||
commandSuffix=$secondaryArchSuffix
|
||||
if [ "$targetArchitecture" = x86_gcc2 ]; then
|
||||
commandSuffix=
|
||||
commandBinDir=$prefix/bin
|
||||
fi
|
||||
|
||||
PROVIDES="
|
||||
clazy$secondaryArchSuffix = $portVersion
|
||||
cmd:clazy
|
||||
cmd:clazy_standalone
|
||||
lib:ClangLazy = $portVersion
|
||||
cmd:clazy$commandSuffix = $portVersion
|
||||
cmd:clazy_standalone$commandSuffix = $portVersion
|
||||
lib:ClazyPlugin$secondaryArchSuffix = $portVersion
|
||||
"
|
||||
REQUIRES="
|
||||
haiku$secondaryArchSuffix
|
||||
lib:libLLVM_9$secondaryArchSuffix
|
||||
lib:libclang_cpp$secondaryArchSuffix
|
||||
lib:libLLVM_17$secondaryArchSuffix
|
||||
"
|
||||
|
||||
BUILD_REQUIRES="
|
||||
haiku${secondaryArchSuffix}_devel
|
||||
devel:libLLVM_9$secondaryArchSuffix
|
||||
devel:libLLVM_17$secondaryArchSuffix
|
||||
"
|
||||
BUILD_PREREQUIRES="
|
||||
cmd:clang_9
|
||||
cmd:clang_17
|
||||
cmd:cmake
|
||||
cmd:gcc$secondaryArchSuffix
|
||||
cmd:make
|
||||
cmd:pkg_config$secondaryArchSuffix
|
||||
cmd:pod2man$secondaryArchSuffix
|
||||
cmd:readlink
|
||||
"
|
||||
|
||||
BUILD()
|
||||
{
|
||||
mkdir -p build
|
||||
cd build
|
||||
cmake -DCMAKE_INSTALL_PREFIX=$prefix \
|
||||
-DSHARE_INSTALL_DIR:STRING=$docDir \
|
||||
-DCMAKE_BUILD_TYPE=Release ..
|
||||
|
||||
make $jobArgs
|
||||
cmake -Bbuild -S. -DCMAKE_BUILD_TYPE=Release \
|
||||
$cmakeDirArgs \
|
||||
-DCMAKE_INSTALL_BINDIR=$commandBinDir
|
||||
make -Cbuild $jobArgs
|
||||
}
|
||||
|
||||
INSTALL()
|
||||
{
|
||||
cd build
|
||||
make install
|
||||
make -Cbuild install
|
||||
|
||||
rm -rf $prefix/share
|
||||
}
|
||||
|
||||
TEST()
|
||||
{
|
||||
cd build
|
||||
make check
|
||||
make -Cbuild test
|
||||
}
|
||||
321
dev-util/clazy/patches/clazy-1.11.patchset
Normal file
321
dev-util/clazy/patches/clazy-1.11.patchset
Normal file
@@ -0,0 +1,321 @@
|
||||
From 25069b81e93503e892ff6157ee99e8d3f75f18a4 Mon Sep 17 00:00:00 2001
|
||||
From: Cristian Adam <cristian.adam@qt.io>
|
||||
Date: Tue, 6 Sep 2022 16:30:02 +0200
|
||||
Subject: Build fixes for LLVM/Clang 15.0.0
|
||||
|
||||
Change-Id: Icc39a0b1acffb5a6a4798b1259d8ad4e7dd47bc5
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index f8459c5..d89325e 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 5e63a13..5fdfe5f 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 dc80ff3..1bb17a5 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 4ea923a..c1a23a4 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 3cdf787..70e0577 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 f5936df..dcc7c99 100644
|
||||
--- a/src/checkbase.cpp
|
||||
+++ b/src/checkbase.cpp
|
||||
@@ -105,7 +105,7 @@ void ClazyPreprocessorCallbacks::MacroDefined(const Token ¯oNameTok, 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 c5db2da..02f6a6b 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 83bf81e..c87d9ca 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 37b59d9..bb928ba 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 d458b77..aaa2809 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 ae09f7a..8ffbb10 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;
|
||||
|
||||
};
|
||||
--
|
||||
2.43.2
|
||||
|
||||
|
||||
From f657b80d8052f8ac49ee0ca08a1c3f58785ce933 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ivan=20=C4=8Cuki=C4=87?= <ivan.cukic@kdab.com>
|
||||
Date: Tue, 7 Feb 2023 11:06:19 +0100
|
||||
Subject: Adapt to API changes in clang/llvm 16
|
||||
|
||||
|
||||
diff --git a/src/SourceCompatibilityHelpers.h b/src/SourceCompatibilityHelpers.h
|
||||
index c1a23a4..5e2dc60 100644
|
||||
--- a/src/SourceCompatibilityHelpers.h
|
||||
+++ b/src/SourceCompatibilityHelpers.h
|
||||
@@ -107,7 +107,11 @@ inline clang::tooling::Replacements& DiagnosticFix(clang::tooling::Diagnostic &d
|
||||
|
||||
inline auto getBuffer(const clang::SourceManager &sm, clang::FileID id, bool *invalid)
|
||||
{
|
||||
-#if LLVM_VERSION_MAJOR >= 12
|
||||
+#if LLVM_VERSION_MAJOR >= 16
|
||||
+ auto buffer = sm.getBufferOrNone(id);
|
||||
+ *invalid = !buffer.has_value();
|
||||
+ return buffer;
|
||||
+#elif LLVM_VERSION_MAJOR >= 12
|
||||
auto buffer = sm.getBufferOrNone(id);
|
||||
*invalid = !buffer.hasValue();
|
||||
return buffer;
|
||||
@@ -116,11 +120,12 @@ inline auto getBuffer(const clang::SourceManager &sm, clang::FileID id, bool *in
|
||||
#endif
|
||||
}
|
||||
|
||||
-#if LLVM_VERSION_MAJOR >= 12
|
||||
-
|
||||
+#if LLVM_VERSION_MAJOR >= 16
|
||||
+#define GET_LEXER(id, inputFile, sm, lo) \
|
||||
+clang::Lexer(id, inputFile.value(), sm, lo)
|
||||
+#elif LLVM_VERSION_MAJOR >= 12
|
||||
#define GET_LEXER(id, inputFile, sm, lo) \
|
||||
clang::Lexer(id, inputFile.getValue(), sm, lo)
|
||||
-
|
||||
#else
|
||||
#define GET_LEXER(id, inputFile, sm, lo) \
|
||||
clang::Lexer(id, inputFile, sm, lo)
|
||||
@@ -144,7 +149,9 @@ inline bool contains_lower(clang::StringRef haystack, clang::StringRef needle)
|
||||
#endif
|
||||
}
|
||||
|
||||
-#if LLVM_VERSION_MAJOR >= 15
|
||||
+#if LLVM_VERSION_MAJOR >= 16
|
||||
+using OptionalFileEntryRef = clang::CustomizableOptional<clang::FileEntryRef>;
|
||||
+#elif LLVM_VERSION_MAJOR >= 15
|
||||
using OptionalFileEntryRef = clang::Optional<clang::FileEntryRef>;
|
||||
#else
|
||||
using OptionalFileEntryRef = const clang::FileEntry*;
|
||||
diff --git a/src/checkbase.h b/src/checkbase.h
|
||||
index 02f6a6b..6a8c634 100644
|
||||
--- a/src/checkbase.h
|
||||
+++ b/src/checkbase.h
|
||||
@@ -93,6 +93,7 @@ public:
|
||||
void InclusionDirective(clang::SourceLocation HashLoc, const clang::Token &IncludeTok, clang::StringRef FileName, bool IsAngled,
|
||||
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;
|
||||
};
|
||||
diff --git a/src/checks/level0/lambda-in-connect.cpp b/src/checks/level0/lambda-in-connect.cpp
|
||||
index b0da926..1ba1126 100644
|
||||
--- a/src/checks/level0/lambda-in-connect.cpp
|
||||
+++ b/src/checks/level0/lambda-in-connect.cpp
|
||||
@@ -71,7 +71,7 @@ void LambdaInConnect::VisitStmt(clang::Stmt *stmt)
|
||||
|
||||
for (auto capture : captures) {
|
||||
if (capture.getCaptureKind() == clang::LCK_ByRef) {
|
||||
- VarDecl *declForCapture = capture.getCapturedVar();
|
||||
+ auto *declForCapture = capture.getCapturedVar();
|
||||
if (declForCapture && declForCapture != receiverDecl && clazy::isValueDeclInFunctionContext(declForCapture))
|
||||
emitWarning(capture.getLocation(), "captured local variable by reference might go out of scope before lambda is called");
|
||||
}
|
||||
--
|
||||
2.43.2
|
||||
|
||||
|
||||
From 536a9c871686bb97f4ec8c2d341923e15a069ab3 Mon Sep 17 00:00:00 2001
|
||||
From: Schrijvers Luc <begasus@gmail.com>
|
||||
Date: Fri, 19 Apr 2024 18:42:40 +0200
|
||||
Subject: Fix build with LLVM 17 (Arch fix)
|
||||
|
||||
|
||||
diff --git a/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp b/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp
|
||||
index ae1e607..813fc71 100644
|
||||
--- a/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp
|
||||
+++ b/src/checks/manuallevel/unexpected-flag-enumerator-value.cpp
|
||||
@@ -61,7 +61,7 @@ static bool isIntentionallyNotPowerOf2(EnumConstantDecl *en) {
|
||||
if (val.isMask() && val.countTrailingOnes() >= MinOnesToQualifyAsMask)
|
||||
return true;
|
||||
|
||||
- if (val.isShiftedMask() && val.countPopulation() >= MinOnesToQualifyAsMask)
|
||||
+ if (val.isShiftedMask() && val.popcount() >= MinOnesToQualifyAsMask)
|
||||
return true;
|
||||
|
||||
if (clazy::contains_lower(en->getName(), "mask"))
|
||||
@@ -158,7 +158,7 @@ void UnexpectedFlagEnumeratorValue::VisitDecl(clang::Decl *decl)
|
||||
|
||||
for (EnumConstantDecl* enumerator : enumerators) {
|
||||
const auto &initVal = enumerator->getInitVal();
|
||||
- if (!initVal.isPowerOf2() && !initVal.isNullValue() && !initVal.isNegative()) {
|
||||
+ if (!initVal.isPowerOf2() && !initVal.isZero() && !initVal.isNegative()) {
|
||||
if (isIntentionallyNotPowerOf2(enumerator))
|
||||
continue;
|
||||
const auto value = enumerator->getInitVal().getLimitedValue();
|
||||
--
|
||||
2.43.2
|
||||
|
||||
Reference in New Issue
Block a user