llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang-tools-extra Author: Victor Chernyakin (localspook) <details> <summary>Changes</summary> --- Full diff: https://github.com/llvm/llvm-project/pull/173116.diff 1 Files Affected: - (modified) clang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp (+3-27) ``````````diff diff --git a/clang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp b/clang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp index a966f1f6e24c5..f1216e0a39f0b 100644 --- a/clang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp +++ b/clang-tools-extra/clang-tidy/readability/FunctionCognitiveComplexityCheck.cpp @@ -20,7 +20,7 @@ #include "clang/Basic/DiagnosticIDs.h" #include "clang/Basic/LLVM.h" #include "clang/Basic/SourceLocation.h" -#include "llvm/ADT/STLForwardCompat.h" +#include "llvm/ADT/BitmaskEnum.h" #include "llvm/Support/ErrorHandling.h" #include <array> #include <cassert> @@ -79,6 +79,8 @@ struct CognitiveComplexity final { PenalizeNesting = 1U << 2, All = Increment | PenalizeNesting | IncrementNesting, + + LLVM_MARK_AS_BITMASK_ENUM(PenalizeNesting), }; // The helper struct used to record one increment occurrence, with all the @@ -164,32 +166,6 @@ static const std::array<const StringRef, 4> Msgs = {{ "nesting level increased to %2", }}; -// Criteria is a bitset, thus a few helpers are needed. -static CognitiveComplexity::Criteria -operator|(CognitiveComplexity::Criteria LHS, - CognitiveComplexity::Criteria RHS) { - return static_cast<CognitiveComplexity::Criteria>(llvm::to_underlying(LHS) | - llvm::to_underlying(RHS)); -} -static CognitiveComplexity::Criteria -operator&(CognitiveComplexity::Criteria LHS, - CognitiveComplexity::Criteria RHS) { - return static_cast<CognitiveComplexity::Criteria>(llvm::to_underlying(LHS) & - llvm::to_underlying(RHS)); -} -static CognitiveComplexity::Criteria & -operator|=(CognitiveComplexity::Criteria &LHS, - CognitiveComplexity::Criteria RHS) { - LHS = operator|(LHS, RHS); - return LHS; -} -static CognitiveComplexity::Criteria & -operator&=(CognitiveComplexity::Criteria &LHS, - CognitiveComplexity::Criteria RHS) { - LHS = operator&(LHS, RHS); - return LHS; -} - void CognitiveComplexity::account(SourceLocation Loc, unsigned short Nesting, Criteria C) { C &= Criteria::All; `````````` </details> https://github.com/llvm/llvm-project/pull/173116 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
