19 #ifndef GUARD_PROGRAMMEMORY_H
20 #define GUARD_PROGRAMMEMORY_H
30 #include <unordered_map>
62 template<
class T,
class U>
68 template<
class T,
class U>
74 template<
class T,
class U>
80 template<
class T,
class U>
100 using Map = std::unordered_map<ExprIdToken, ValueFlow::Value, ExprIdToken::Hash>;
148 Map::const_iterator
end()
const {
176 void assume(
const Token* tok,
bool b,
bool isEmpty =
false);
211 const std::string& returnValue,
This is just a container for general settings so that we don't need to pass individual values to func...
The token list that the TokenList generates is a linked-list of this class.
bool conditionIsFalse(const Token *condition, ProgramMemory pm, const Settings &settings)
Is condition always false when variable has given value?
ProgramMemory getProgramMemory(const Token *tok, const Token *expr, const ValueFlow::Value &value, const Settings &settings)
Get program memory by looking backwards from given token.
ValueFlow::Value evaluateLibraryFunction(const std::unordered_map< nonneg int, ValueFlow::Value > &args, const std::string &returnValue, const Settings &settings, bool cpp)
std::vector< ValueFlow::Value > execute(const Scope *scope, ProgramMemory &pm, const Settings &settings)
bool conditionIsTrue(const Token *condition, ProgramMemory pm, const Settings &settings)
Is condition always true when variable has given value?
std::size_t operator()(ExprIdToken etok) const
friend bool operator>=(const T &lhs, const U &rhs)
friend bool operator>(const T &lhs, const U &rhs)
const Token * operator->() const NOEXCEPT
ExprIdToken(nonneg int exprid)
friend bool operator<=(const T &lhs, const U &rhs)
const Token & operator*() const NOEXCEPT
bool operator<(const ExprIdToken &rhs) const
friend bool operator!=(const T &lhs, const U &rhs)
nonneg int getExpressionId() const
bool operator==(const ExprIdToken &rhs) const
ProgramMemoryState(const Settings *s)
void assume(const Token *tok, bool b, bool isEmpty=false)
std::map< nonneg int, const Token * > origins
void replace(ProgramMemory pm, const Token *origin=nullptr)
void removeModifiedVars(const Token *tok)
ProgramMemory get(const Token *tok, const Token *ctx, const ProgramMemory::Map &vars) const
void insert(const ProgramMemory &pm, const Token *origin=nullptr)
void addState(const Token *tok, const ProgramMemory::Map &vars)
const Settings * settings
void setValue(const Token *expr, const ValueFlow::Value &value)
bool getIntValue(nonneg int exprid, MathLib::bigint &result) const
void insert(const ProgramMemory &pm)
bool getTokValue(nonneg int exprid, const Token *&result) const
void setUnknown(const Token *expr)
const ValueFlow::Value * getValue(nonneg int exprid, bool impossible=false) const
void erase_if(const std::function< bool(const ExprIdToken &)> &pred)
ProgramMemory(Map values)
bool getContainerEmptyValue(nonneg int exprid, MathLib::bigint &result) const
bool getContainerSizeValue(nonneg int exprid, MathLib::bigint &result) const
Map::const_iterator begin() const
friend bool operator!=(const ProgramMemory &x, const ProgramMemory &y)
Map::const_iterator end() const
const ValueFlow::Value & at(nonneg int exprid) const
void setContainerSizeValue(const Token *expr, MathLib::bigint value, bool isEqual=true)
std::unordered_map< ExprIdToken, ValueFlow::Value, ExprIdToken::Hash > Map
void replace(ProgramMemory pm)
bool hasValue(nonneg int exprid)
friend bool operator==(const ProgramMemory &x, const ProgramMemory &y)
void swap(ProgramMemory &pm)
void setIntValue(const Token *expr, MathLib::bigint value, bool impossible=false)