Cppcheck
Classes | Public Member Functions | Static Public Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
CheckUnusedFunctions Class Reference

Check for functions never called. More...

#include <checkunusedfunctions.h>

Classes

class  FunctionDecl
 
struct  FunctionUsage
 

Public Member Functions

 CheckUnusedFunctions ()=default
 
void parseTokens (const Tokenizer &tokenizer, const Settings &settings)
 
std::string analyzerInfo () const
 
bool check (const Settings &settings, ErrorLogger &errorLogger) const
 
void updateFunctionData (const CheckUnusedFunctions &check)
 

Static Public Member Functions

static void analyseWholeProgram (const Settings &settings, ErrorLogger &errorLogger, const std::string &buildDir)
 
static void getErrorMessages (ErrorLogger &errorLogger)
 

Static Private Member Functions

static void unusedFunctionError (ErrorLogger &errorLogger, const std::string &filename, unsigned int fileIndex, unsigned int lineNumber, const std::string &funcname)
 

Private Attributes

std::unordered_map< std::string, FunctionUsagemFunctions
 
std::list< FunctionDeclmFunctionDecl
 
std::set< std::string > mFunctionCalls
 

Friends

class TestSuppressions
 
class TestSingleExecutorBase
 
class TestProcessExecutorBase
 
class TestThreadExecutorBase
 
class TestUnusedFunctions
 

Detailed Description

Check for functions never called.

Definition at line 40 of file checkunusedfunctions.h.

Constructor & Destructor Documentation

◆ CheckUnusedFunctions()

CheckUnusedFunctions::CheckUnusedFunctions ( )
default

Member Function Documentation

◆ analyseWholeProgram()

void CheckUnusedFunctions::analyseWholeProgram ( const Settings settings,
ErrorLogger errorLogger,
const std::string &  buildDir 
)
static

◆ analyzerInfo()

std::string CheckUnusedFunctions::analyzerInfo ( ) const

◆ check()

bool CheckUnusedFunctions::check ( const Settings settings,
ErrorLogger errorLogger 
) const

◆ getErrorMessages()

static void CheckUnusedFunctions::getErrorMessages ( ErrorLogger errorLogger)
inlinestatic

Definition at line 59 of file checkunusedfunctions.h.

References emptyString.

Referenced by CppCheck::getErrorMessages().

◆ parseTokens()

void CheckUnusedFunctions::parseTokens ( const Tokenizer tokenizer,
const Settings settings 
)

◆ unusedFunctionError()

void CheckUnusedFunctions::unusedFunctionError ( ErrorLogger errorLogger,
const std::string &  filename,
unsigned int  fileIndex,
unsigned int  lineNumber,
const std::string &  funcname 
)
staticprivate

Definition at line 352 of file checkunusedfunctions.cpp.

References CWE561, emptyString, normal, ErrorLogger::reportErr(), and style.

Referenced by analyseWholeProgram(), and check().

◆ updateFunctionData()

void CheckUnusedFunctions::updateFunctionData ( const CheckUnusedFunctions check)

Friends And Related Function Documentation

◆ TestProcessExecutorBase

friend class TestProcessExecutorBase
friend

Definition at line 43 of file checkunusedfunctions.h.

◆ TestSingleExecutorBase

friend class TestSingleExecutorBase
friend

Definition at line 42 of file checkunusedfunctions.h.

◆ TestSuppressions

friend class TestSuppressions
friend

Definition at line 41 of file checkunusedfunctions.h.

◆ TestThreadExecutorBase

friend class TestThreadExecutorBase
friend

Definition at line 44 of file checkunusedfunctions.h.

◆ TestUnusedFunctions

friend class TestUnusedFunctions
friend

Definition at line 45 of file checkunusedfunctions.h.

Member Data Documentation

◆ mFunctionCalls

std::set<std::string> CheckUnusedFunctions::mFunctionCalls
private

Definition at line 90 of file checkunusedfunctions.h.

Referenced by analyzerInfo(), parseTokens(), and updateFunctionData().

◆ mFunctionDecl

std::list<FunctionDecl> CheckUnusedFunctions::mFunctionDecl
private

Definition at line 89 of file checkunusedfunctions.h.

Referenced by analyzerInfo(), parseTokens(), and updateFunctionData().

◆ mFunctions

std::unordered_map<std::string, FunctionUsage> CheckUnusedFunctions::mFunctions
private

Definition at line 81 of file checkunusedfunctions.h.

Referenced by check(), parseTokens(), and updateFunctionData().


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