Cppcheck
Public Member Functions | Public Attributes | List of all members
Variables::VariableUsage Class Reference

Store information about variable usage. More...

Public Member Functions

 VariableUsage (const Variable *var=nullptr, VariableType type=standard, bool read=false, bool write=false, bool modified=false, bool allocateMemory=false)
 
void use ()
 variable is used. More...
 
bool unused () const
 is variable unused? More...
 

Public Attributes

std::set< nonneg int > _aliases
 
std::set< const Scope * > _assignments
 
const Variable_var
 
const Token_lastAccess
 
VariableType mType
 
bool _read
 
bool _write
 
bool _modified
 
bool _allocateMemory
 

Detailed Description

Store information about variable usage.

Definition at line 107 of file checkunusedvar.cpp.

Constructor & Destructor Documentation

◆ VariableUsage()

Variables::VariableUsage::VariableUsage ( const Variable var = nullptr,
VariableType  type = standard,
bool  read = false,
bool  write = false,
bool  modified = false,
bool  allocateMemory = false 
)
inlineexplicit

Definition at line 109 of file checkunusedvar.cpp.

Member Function Documentation

◆ unused()

bool Variables::VariableUsage::unused ( ) const
inline

is variable unused?

Definition at line 130 of file checkunusedvar.cpp.

References _read, and _write.

Referenced by CheckUnusedVar::checkFunctionVariableUsage().

◆ use()

void Variables::VariableUsage::use ( )
inline

variable is used.

. set both read+write

Definition at line 124 of file checkunusedvar.cpp.

References _read, and _write.

Referenced by Variables::alias(), and Variables::use().

Member Data Documentation

◆ _aliases

std::set<nonneg int> Variables::VariableUsage::_aliases

◆ _allocateMemory

bool Variables::VariableUsage::_allocateMemory

◆ _assignments

std::set<const Scope*> Variables::VariableUsage::_assignments

Definition at line 135 of file checkunusedvar.cpp.

Referenced by doAssignment().

◆ _lastAccess

const Token* Variables::VariableUsage::_lastAccess

◆ _modified

bool Variables::VariableUsage::_modified

◆ _read

bool Variables::VariableUsage::_read

◆ _var

const Variable* Variables::VariableUsage::_var

◆ _write

bool Variables::VariableUsage::_write

◆ mType

VariableType Variables::VariableUsage::mType

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