Cppcheck
|
This class is used create a list of variables within a function. More...
Classes | |
class | VariableUsage |
Store information about variable usage. More... | |
Public Types | |
enum | VariableType { standard , array , pointer , reference , pointerArray , referenceArray , pointerPointer , none } |
Public Member Functions | |
void | clear () |
const std::map< nonneg int, VariableUsage > & | varUsage () const |
void | addVar (const Variable *var, VariableType type, bool write_) |
void | allocateMemory (nonneg int varid, const Token *tok) |
void | read (nonneg int varid, const Token *tok) |
void | readAliases (nonneg int varid, const Token *tok) |
void | readAll (nonneg int varid, const Token *tok) |
void | write (nonneg int varid, const Token *tok) |
void | writeAliases (nonneg int varid, const Token *tok) |
void | writeAll (nonneg int varid, const Token *tok) |
void | use (nonneg int varid, const Token *tok) |
void | modified (nonneg int varid, const Token *tok) |
VariableUsage * | find (nonneg int varid) |
void | alias (nonneg int varid1, nonneg int varid2, bool replace) |
Alias the 2 given variables. More... | |
void | erase (nonneg int varid) |
void | eraseAliases (nonneg int varid) |
void | eraseAll (nonneg int varid) |
void | clearAliases (nonneg int varid) |
Private Attributes | |
std::map< nonneg int, VariableUsage > | mVarUsage |
This class is used create a list of variables within a function.
Definition at line 102 of file checkunusedvar.cpp.
Enumerator | |
---|---|
standard | |
array | |
pointer | |
reference | |
pointerArray | |
referenceArray | |
pointerPointer | |
none |
Definition at line 104 of file checkunusedvar.cpp.
void Variables::addVar | ( | const Variable * | var, |
VariableType | type, | ||
bool | write_ | ||
) |
Definition at line 260 of file checkunusedvar.cpp.
References Variable::declarationId(), and mVarUsage.
Referenced by CheckUnusedVar::checkFunctionVariableUsage_iterateScopes().
Alias the 2 given variables.
Either replace the existing aliases if they exist or merge them. You would replace an existing alias when this assignment is in the same scope as the previous assignment. You might merge the aliases when this assignment is in a different scope from the previous assignment depending on the relationship of the 2 scopes.
Definition at line 184 of file checkunusedvar.cpp.
References Variables::VariableUsage::_aliases, Variables::VariableUsage::_read, Variables::VariableUsage::_var, Variable::declarationId(), find(), Variables::VariableUsage::mType, pointer, replace(), and Variables::VariableUsage::use().
Referenced by doAssignment().
Definition at line 269 of file checkunusedvar.cpp.
References Variables::VariableUsage::_allocateMemory, Variables::VariableUsage::_lastAccess, and find().
Referenced by CheckUnusedVar::checkFunctionVariableUsage_iterateScopes().
|
inline |
Definition at line 146 of file checkunusedvar.cpp.
References mVarUsage.
Referenced by CheckUnusedVar::checkFunctionVariableUsage_iterateScopes().
void Variables::clearAliases | ( | nonneg int | varid | ) |
Definition at line 226 of file checkunusedvar.cpp.
References Variables::VariableUsage::_aliases, Variables::VariableUsage::_var, Variable::declarationId(), and find().
Referenced by doAssignment().
|
inline |
Definition at line 164 of file checkunusedvar.cpp.
References mVarUsage.
Referenced by CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), eraseAliases(), and eraseAll().
void Variables::eraseAliases | ( | nonneg int | varid | ) |
Definition at line 244 of file checkunusedvar.cpp.
References Variables::VariableUsage::_aliases, erase(), and find().
Referenced by eraseAll().
void Variables::eraseAll | ( | nonneg int | varid | ) |
Definition at line 254 of file checkunusedvar.cpp.
References erase(), and eraseAliases().
Referenced by CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), and doAssignment().
Variables::VariableUsage * Variables::find | ( | nonneg int | varid | ) |
Definition at line 386 of file checkunusedvar.cpp.
References mVarUsage.
Referenced by alias(), allocateMemory(), CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), clearAliases(), doAssignment(), eraseAliases(), modified(), read(), readAliases(), use(), write(), and writeAliases().
Definition at line 365 of file checkunusedvar.cpp.
References Variables::VariableUsage::_aliases, Variables::VariableUsage::_lastAccess, Variables::VariableUsage::_modified, Variables::VariableUsage::_read, Variables::VariableUsage::_var, find(), and Variable::isStatic().
Referenced by CheckUnusedVar::checkFunctionVariableUsage_iterateScopes().
Definition at line 279 of file checkunusedvar.cpp.
References Variables::VariableUsage::_lastAccess, Variables::VariableUsage::_read, and find().
Referenced by CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), doAssignment(), and readAll().
Definition at line 290 of file checkunusedvar.cpp.
References Variables::VariableUsage::_aliases, Variables::VariableUsage::_lastAccess, Variables::VariableUsage::_read, find(), and nonneg.
Referenced by doAssignment(), and readAll().
Definition at line 306 of file checkunusedvar.cpp.
References read(), and readAliases().
Referenced by CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), and doAssignment().
Definition at line 346 of file checkunusedvar.cpp.
References Variables::VariableUsage::_aliases, Variables::VariableUsage::_lastAccess, find(), and Variables::VariableUsage::use().
Referenced by CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), doAssignment(), and useFunctionArgs().
|
inline |
Definition at line 149 of file checkunusedvar.cpp.
References mVarUsage.
Referenced by CheckUnusedVar::checkFunctionVariableUsage().
Definition at line 312 of file checkunusedvar.cpp.
References Variables::VariableUsage::_lastAccess, Variables::VariableUsage::_read, Variables::VariableUsage::_var, Variables::VariableUsage::_write, find(), Variable::isStatic(), Token::next(), and Token::simpleMatch().
Referenced by CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), and writeAll().
Definition at line 324 of file checkunusedvar.cpp.
References Variables::VariableUsage::_aliases, Variables::VariableUsage::_lastAccess, Variables::VariableUsage::_write, and find().
Referenced by CheckUnusedVar::checkFunctionVariableUsage_iterateScopes(), and writeAll().
Definition at line 340 of file checkunusedvar.cpp.
References write(), and writeAliases().
Referenced by CheckUnusedVar::checkFunctionVariableUsage_iterateScopes().
|
private |
Definition at line 173 of file checkunusedvar.cpp.
Referenced by addVar(), clear(), erase(), find(), and varUsage().