#include "FunctionCognitiveComplexityCheck.h"
#include "../ClangTidyDiagnosticConsumer.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclBase.h"
#include "clang/AST/Expr.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/AST/Stmt.h"
#include "clang/ASTMatchers/ASTMatchFinder.h"
#include "clang/ASTMatchers/ASTMatchers.h"
#include "clang/ASTMatchers/ASTMatchersInternal.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticIDs.h"
#include "clang/Basic/LLVM.h"
#include "clang/Basic/SourceLocation.h"
#include "llvm/ADT/STLForwardCompat.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include <array>
#include <cassert>
#include <optional>
#include <stack>
#include <tuple>
#include <type_traits>
#include <utility>
usingnamespaceclang::ast_matchers;
namespace clang::tidy::readability {
namespace {
struct CognitiveComplexity final { … };
static const std::array<const StringRef, 4> Msgs = …;
CognitiveComplexity::Criteria operator|(CognitiveComplexity::Criteria LHS,
CognitiveComplexity::Criteria RHS) { … }
CognitiveComplexity::Criteria operator&(CognitiveComplexity::Criteria LHS,
CognitiveComplexity::Criteria RHS) { … }
CognitiveComplexity::Criteria &operator|=(CognitiveComplexity::Criteria &LHS,
CognitiveComplexity::Criteria RHS) { … }
CognitiveComplexity::Criteria &operator&=(CognitiveComplexity::Criteria &LHS,
CognitiveComplexity::Criteria RHS) { … }
void CognitiveComplexity::account(SourceLocation Loc, unsigned short Nesting,
Criteria C) { … }
class FunctionASTVisitor final
: public RecursiveASTVisitor<FunctionASTVisitor> { … };
}
FunctionCognitiveComplexityCheck::FunctionCognitiveComplexityCheck(
StringRef Name, ClangTidyContext *Context)
: … { … }
void FunctionCognitiveComplexityCheck::storeOptions(
ClangTidyOptions::OptionMap &Opts) { … }
void FunctionCognitiveComplexityCheck::registerMatchers(MatchFinder *Finder) { … }
void FunctionCognitiveComplexityCheck::check(
const MatchFinder::MatchResult &Result) { … }
}