clang-tools 22.0.0git
clang::tidy::readability::FunctionSizeCheck Class Reference

Checks for large functions based on various metrics. More...

#include <FunctionSizeCheck.h>

Inheritance diagram for clang::tidy::readability::FunctionSizeCheck:
[legend]

Public Member Functions

 FunctionSizeCheck (StringRef Name, ClangTidyContext *Context)
void storeOptions (ClangTidyOptions::OptionMap &Opts) override
void registerMatchers (ast_matchers::MatchFinder *Finder) override
void check (const ast_matchers::MatchFinder::MatchResult &Result) override

Detailed Description

Checks for large functions based on various metrics.

These options are supported:

  • LineThreshold - flag functions exceeding this number of lines. The default is -1 (ignore the number of lines).
  • StatementThreshold - flag functions exceeding this number of statements. This may differ significantly from the number of lines for macro-heavy code. The default is 800.
  • BranchThreshold - flag functions exceeding this number of control statements. The default is -1 (ignore the number of branches).
  • ParameterThreshold - flag functions having a high number of parameters. The default is -1 (ignore the number of parameters).
  • NestingThreshold - flag compound statements which create next nesting level after NestingThreshold. This may differ significantly from the expected value for macro-heavy code. The default is -1 (ignore the nesting level).
  • VariableThreshold - flag functions having a high number of variable declarations. The default is -1 (ignore the number of variables).

Definition at line 35 of file FunctionSizeCheck.h.

Constructor & Destructor Documentation

◆ FunctionSizeCheck()

clang::tidy::readability::FunctionSizeCheck::FunctionSizeCheck ( StringRef Name,
ClangTidyContext * Context )

Definition at line 136 of file FunctionSizeCheck.cpp.

Member Function Documentation

◆ check()

void clang::tidy::readability::FunctionSizeCheck::check ( const ast_matchers::MatchFinder::MatchResult & Result)
override

Definition at line 170 of file FunctionSizeCheck.cpp.

◆ registerMatchers()

void clang::tidy::readability::FunctionSizeCheck::registerMatchers ( ast_matchers::MatchFinder * Finder)
override

Definition at line 161 of file FunctionSizeCheck.cpp.

◆ storeOptions()

void clang::tidy::readability::FunctionSizeCheck::storeOptions ( ClangTidyOptions::OptionMap & Opts)
override

Definition at line 151 of file FunctionSizeCheck.cpp.


The documentation for this class was generated from the following files: