Cppcheck
Classes | Functions
programmemory.h File Reference
#include "config.h"
#include "mathlib.h"
#include "vfvalue.h"
#include <cstddef>
#include <functional>
#include <map>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

struct  ExprIdToken
 
struct  ExprIdToken::Hash
 
struct  ProgramMemory
 
struct  ProgramMemoryState
 

Functions

std::vector< ValueFlow::Valueexecute (const Scope *scope, ProgramMemory &pm, const Settings &settings)
 
void execute (const Token *expr, ProgramMemory &programMemory, MathLib::bigint *result, bool *error, const Settings &settings)
 
bool conditionIsFalse (const Token *condition, ProgramMemory pm, const Settings &settings)
 Is condition always false when variable has given value? More...
 
bool conditionIsTrue (const Token *condition, ProgramMemory pm, const Settings &settings)
 Is condition always true when variable has given value? More...
 
ProgramMemory getProgramMemory (const Token *tok, const Token *expr, const ValueFlow::Value &value, const Settings &settings)
 Get program memory by looking backwards from given token. More...
 
ValueFlow::Value evaluateLibraryFunction (const std::unordered_map< nonneg int, ValueFlow::Value > &args, const std::string &returnValue, const Settings &settings, bool cpp)
 

Function Documentation

◆ conditionIsFalse()

bool conditionIsFalse ( const Token condition,
ProgramMemory  pm,
const Settings settings 
)

Is condition always false when variable has given value?

Parameters
conditiontop ast token in condition
pmprogram memory

Definition at line 211 of file programmemory.cpp.

References evaluateCondition().

Referenced by ValueFlowAnalyzer::evaluateInt(), fillProgramMemoryFromAssignments(), ProgramMemoryState::removeModifiedVars(), and valueFlowForLoopSimplify().

◆ conditionIsTrue()

bool conditionIsTrue ( const Token condition,
ProgramMemory  pm,
const Settings settings 
)

Is condition always true when variable has given value?

Parameters
conditiontop ast token in condition
pmprogram memory

Definition at line 216 of file programmemory.cpp.

References evaluateCondition().

Referenced by evalSameCondition(), ValueFlowAnalyzer::evaluateInt(), fillProgramMemoryFromAssignments(), ProgramMemoryState::removeModifiedVars(), and valueFlowForLoopSimplify().

◆ evaluateLibraryFunction()

ValueFlow::Value evaluateLibraryFunction ( const std::unordered_map< nonneg int, ValueFlow::Value > &  args,
const std::string &  returnValue,
const Settings settings,
bool  cpp 
)

◆ execute() [1/2]

std::vector<ValueFlow::Value> execute ( const Scope scope,
ProgramMemory pm,
const Settings settings 
)

Definition at line 1757 of file programmemory.cpp.

◆ execute() [2/2]

void execute ( const Token expr,
ProgramMemory programMemory,
MathLib::bigint result,
bool *  error,
const Settings settings 
)

◆ getProgramMemory()

ProgramMemory getProgramMemory ( const Token tok,
const Token expr,
const ValueFlow::Value value,
const Settings settings 
)