Cppcheck
Namespaces | Functions | Variables
checkuninitvar.cpp File Reference
#include "checkuninitvar.h"
#include "astutils.h"
#include "ctu.h"
#include "errorlogger.h"
#include "library.h"
#include "mathlib.h"
#include "settings.h"
#include "symboldatabase.h"
#include "token.h"
#include "tokenize.h"
#include "checknullpointer.h"
#include <algorithm>
#include <cassert>
#include <functional>
#include <initializer_list>
#include <list>
#include <map>
#include <unordered_set>
#include <vector>

Go to the source code of this file.

Namespaces

 tinyxml2
 

Functions

static const TokengetAstParentSkipPossibleCastAndAddressOf (const Token *vartok, bool *unknown)
 
static std::map< nonneg int, VariableValuegetVariableValues (const Token *tok)
 
static VariableValue operator! (VariableValue v)
 
static bool operator== (const VariableValue &v, MathLib::bigint i)
 
static bool operator!= (const VariableValue &v, MathLib::bigint i)
 
static void conditionAlwaysTrueOrFalse (const Token *tok, const std::map< nonneg int, VariableValue > &variableValue, bool *alwaysTrue, bool *alwaysFalse)
 
static bool isVariableUsed (const Token *tok, const Variable &var)
 
static bool astIsLhs (const Token *tok)
 
static bool astIsRhs (const Token *tok)
 
static bool isVoidCast (const Token *tok)
 
static bool isVariableUsage (const Settings &settings, const Token *vartok, MathLib::bigint *value)
 

Variables

static const CWE CWE_USE_OF_UNINITIALIZED_VARIABLE (457U)
 

Function Documentation

◆ astIsLhs()

static bool astIsLhs ( const Token tok)
static

Definition at line 1121 of file checkuninitvar.cpp.

References Token::astParent().

Referenced by CheckUninitVar::isVariableUsage().

◆ astIsRhs()

static bool astIsRhs ( const Token tok)
static

Definition at line 1126 of file checkuninitvar.cpp.

References Token::astParent().

Referenced by CheckUninitVar::isVariableUsage().

◆ conditionAlwaysTrueOrFalse()

static void conditionAlwaysTrueOrFalse ( const Token tok,
const std::map< nonneg int, VariableValue > &  variableValue,
bool *  alwaysTrue,
bool *  alwaysFalse 
)
static

◆ getAstParentSkipPossibleCastAndAddressOf()

static const Token* getAstParentSkipPossibleCastAndAddressOf ( const Token vartok,
bool *  unknown 
)
static

◆ getVariableValues()

static std::map<nonneg int, VariableValue> getVariableValues ( const Token tok)
static

◆ isVariableUsage()

static bool isVariableUsage ( const Settings settings,
const Token vartok,
MathLib::bigint value 
)
static

Definition at line 1673 of file checkuninitvar.cpp.

References CheckUninitVar::isVariableUsage(), and Settings::library.

◆ isVariableUsed()

static bool isVariableUsed ( const Token tok,
const Variable var 
)
static

◆ isVoidCast()

static bool isVoidCast ( const Token tok)
static

◆ operator!()

static VariableValue operator! ( VariableValue  v)
static

Definition at line 278 of file checkuninitvar.cpp.

References VariableValue::notEqual.

◆ operator!=()

static bool operator!= ( const VariableValue v,
MathLib::bigint  i 
)
static

Definition at line 287 of file checkuninitvar.cpp.

References VariableValue::notEqual, and VariableValue::value.

◆ operator==()

static bool operator== ( const VariableValue v,
MathLib::bigint  i 
)
static

Definition at line 283 of file checkuninitvar.cpp.

References VariableValue::notEqual, and VariableValue::value.

Variable Documentation

◆ CWE_USE_OF_UNINITIALIZED_VARIABLE

const CWE CWE_USE_OF_UNINITIALIZED_VARIABLE(457U) ( 457U  )
static