Cppcheck
Public Member Functions | Private Member Functions | Static Private Member Functions
CheckUnusedVar Class Reference

Various small checks. More...

#include <checkunusedvar.h>

Inheritance diagram for CheckUnusedVar:
Check

List of all members.

Public Member Functions

 CheckUnusedVar ()
 This constructor is used when registering the CheckClass.
 CheckUnusedVar (const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
 This constructor is used when running checks.
void runChecks (const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
 Run checks against the normal token list.
void runSimplifiedChecks (const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
 Run checks against the simplified token list.
void checkFunctionVariableUsage_iterateScopes (const Scope *const scope, Variables &variables, bool insideLoop)
 Check for unused function variables
void checkVariableUsage (const Scope *const scope, const Token *start, Variables &variables)
void checkFunctionVariableUsage ()
void checkStructMemberUsage ()
 Check that all struct members are used

Private Member Functions

void unusedStructMemberError (const Token *tok, const std::string &structname, const std::string &varname)
void unusedVariableError (const Token *tok, const std::string &varname)
void allocatedButUnusedVariableError (const Token *tok, const std::string &varname)
void unreadVariableError (const Token *tok, const std::string &varname)
void unassignedVariableError (const Token *tok, const std::string &varname)
void getErrorMessages (ErrorLogger *errorLogger, const Settings *settings) const
 get error messages
std::string classInfo () const
 get information about this class, used to generate documentation

Static Private Member Functions

static std::string myName ()

Detailed Description

Various small checks.

Definition at line 39 of file checkunusedvar.h.


Constructor & Destructor Documentation

This constructor is used when registering the CheckClass.

Definition at line 42 of file checkunusedvar.h.

CheckUnusedVar::CheckUnusedVar ( const Tokenizer tokenizer,
const Settings settings,
ErrorLogger errorLogger 
) [inline]

This constructor is used when running checks.

Definition at line 46 of file checkunusedvar.h.


Member Function Documentation

void CheckUnusedVar::allocatedButUnusedVariableError ( const Token tok,
const std::string &  varname 
) [private]

Definition at line 1130 of file checkunusedvar.cpp.

References Check::reportError(), and Severity::style.

Referenced by checkFunctionVariableUsage(), and getErrorMessages().

void CheckUnusedVar::checkFunctionVariableUsage_iterateScopes ( const Scope *const  scope,
Variables variables,
bool  insideLoop 
)
void CheckUnusedVar::checkVariableUsage ( const Scope *const  scope,
const Token start,
Variables variables 
)
std::string CheckUnusedVar::classInfo ( ) const [inline, private, virtual]

get information about this class, used to generate documentation

Implements Check.

Definition at line 97 of file checkunusedvar.h.

void CheckUnusedVar::getErrorMessages ( ErrorLogger errorLogger,
const Settings settings 
) const [inline, private, virtual]
static std::string CheckUnusedVar::myName ( ) [inline, static, private]

Definition at line 93 of file checkunusedvar.h.

void CheckUnusedVar::runChecks ( const Tokenizer tokenizer,
const Settings settings,
ErrorLogger errorLogger 
) [inline, virtual]

Run checks against the normal token list.

Reimplemented from Check.

Definition at line 51 of file checkunusedvar.h.

References checkFunctionVariableUsage(), and checkStructMemberUsage().

void CheckUnusedVar::runSimplifiedChecks ( const Tokenizer tokenizer,
const Settings settings,
ErrorLogger errorLogger 
) [inline, virtual]

Run checks against the simplified token list.

Implements Check.

Definition at line 60 of file checkunusedvar.h.

void CheckUnusedVar::unassignedVariableError ( const Token tok,
const std::string &  varname 
) [private]

Definition at line 1140 of file checkunusedvar.cpp.

References Check::reportError(), and Severity::style.

Referenced by checkFunctionVariableUsage(), and getErrorMessages().

void CheckUnusedVar::unreadVariableError ( const Token tok,
const std::string &  varname 
) [private]

Definition at line 1135 of file checkunusedvar.cpp.

References Check::reportError(), and Severity::style.

Referenced by checkFunctionVariableUsage(), and getErrorMessages().

void CheckUnusedVar::unusedStructMemberError ( const Token tok,
const std::string &  structname,
const std::string &  varname 
) [private]

Definition at line 1253 of file checkunusedvar.cpp.

References Check::reportError(), and Severity::style.

Referenced by checkStructMemberUsage(), and getErrorMessages().

void CheckUnusedVar::unusedVariableError ( const Token tok,
const std::string &  varname 
) [private]

Definition at line 1125 of file checkunusedvar.cpp.

References Check::reportError(), and Severity::style.

Referenced by checkFunctionVariableUsage(), and getErrorMessages().


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