32 #include <type_traits> 
   44         enum class Bound { Upper, Lower, Point };
 
   46         explicit Value(
long long val = 0, 
Bound b = Bound::Point) :
 
   52         Value(
const Token* c, 
long long val, Bound b = Bound::Point);
 
   65             case ValueType::CONTAINER_SIZE:
 
   66             case ValueType::BUFFER_SIZE:
 
   67             case ValueType::ITERATOR_START:
 
   68             case ValueType::ITERATOR_END:
 
   80             case ValueType::MOVED:
 
   84             case ValueType::UNINIT:
 
   86             case ValueType::LIFETIME:
 
   90             case ValueType::SYMBOLIC:
 
   91                 if (!sameToken(tokvalue, rhs.
tokvalue))
 
  100         template<
class T, 
class F>
 
  102             switch (
self.valueType) {
 
  104             case ValueType::SYMBOLIC:
 
  105             case ValueType::BUFFER_SIZE:
 
  106             case ValueType::CONTAINER_SIZE:
 
  107             case ValueType::ITERATOR_START:
 
  108             case ValueType::ITERATOR_END: {
 
  116             case ValueType::UNINIT:
 
  118             case ValueType::LIFETIME:
 
  119             case ValueType::MOVED:
 
  126                 template<
class Compare, 
class T, 
class U>
 
  127                 void operator()(
bool& result, Compare compare, T x, U y)
 const {
 
  128                     result = compare(x, y);
 
  131             template<
class Compare, 
class T>
 
  134                            std::bind(
innerVisitor{}, std::ref(result), std::move(compare), x, std::placeholders::_1));
 
  138         template<
class Compare>
 
  145                 std::bind(
compareVisitor{}, std::ref(result), std::ref(rhs), std::move(compare), std::placeholders::_1));
 
  150             if (!equalValue(rhs))
 
  155                    varId == rhs.
varId &&
 
  163             return !(*
this == rhs);
 
  166         template<
class T, 
REQUIRES(
"T must be an arithmetic type", std::is_arithmetic<T> )>
 
  169             visitValue(*
this, std::bind(
equalVisitor{}, std::ref(result), x, std::placeholders::_1));
 
  174             if (bound == Bound::Lower)
 
  176             else if (bound == Bound::Upper)
 
  181             if (bound == Bound::Lower)
 
  182                 bound = Bound::Upper;
 
  183             else if (bound == Bound::Upper)
 
  184                 bound = Bound::Lower;
 
  192         void assumeCondition(
const Token* tok);
 
  194         std::string infoString() 
const;
 
  215             return valueType == ValueType::TOK;
 
  221             return valueType == ValueType::MOVED;
 
  224             return valueType == ValueType::UNINIT;
 
  227             return valueType == ValueType::CONTAINER_SIZE;
 
  230             return valueType == ValueType::LIFETIME;
 
  233             return valueType == ValueType::BUFFER_SIZE;
 
  236             return valueType == ValueType::ITERATOR_START || valueType == ValueType::ITERATOR_END;
 
  239             return valueType == ValueType::ITERATOR_START;
 
  242             return valueType == ValueType::ITERATOR_END;
 
  245             return valueType == ValueType::SYMBOLIC;
 
  249             return valueType == ValueType::LIFETIME && lifetimeScope == LifetimeScope::Local;
 
  253             return valueType == ValueType::LIFETIME && lifetimeScope == LifetimeScope::Argument;
 
  257             return valueType == ValueType::LIFETIME && lifetimeScope == LifetimeScope::SubFunction;
 
  261             return isMovedValue() || isUninitValue() || isLifetimeValue();
 
  268         long long intvalue{};
 
  277         long long varvalue{};
 
  304         enum class MoveKind { NonMovedVariable, MovedVariable, ForwardedVariable } moveKind = MoveKind::NonMovedVariable;
 
  310         long long wideintvalue{};
 
  328         } lifetimeKind = LifetimeKind::Object;
 
  332         static const char* 
toString(MoveKind moveKind);
 
  333         static const char* 
toString(LifetimeKind lifetimeKind);
 
  334         static const char* 
toString(LifetimeScope lifetimeScope);
 
  335         static const char* 
toString(Bound bound);
 
  347         } valueKind = ValueKind::Possible;
 
  350             valueKind = ValueKind::Known;
 
  354             return valueKind == ValueKind::Known;
 
  358             valueKind = ValueKind::Possible;
 
  362             return valueKind == ValueKind::Possible;
 
  366             return valueKind == ValueKind::Impossible;
 
  370             valueKind = ValueKind::Impossible;
 
  375                 valueKind = ValueKind::Inconclusive;
 
  379             return valueKind == ValueKind::Inconclusive;
 
  384                 valueKind = ValueKind::Possible;
 
  388             return !condition && !defaultArg;
 
  391         static bool sameToken(
const Token* tok1, 
const Token* tok2);
 
  395             template<
class T, 
class U>
 
  397                 result = !(x > y || x < y);
 
The token list that the TokenList generates is a linked-list of this class.
 
bool equalTo(const T &x) const
 
bool isArgumentLifetimeValue() const
 
bool isSymbolicValue() const
 
enum ValueFlow::Value::ValueType valueType
 
void changeKnownToPossible()
 
bool isIteratorValue() const
 
bool isMovedValue() const
 
bool isFloatValue() const
 
bool errorSeverity() const
 
bool conditional
Conditional value.
 
ValueKind
How known is this value.
 
bool isLifetimeValue() const
 
long long varvalue
For calculated values - variable value that calculated value depends on.
 
bool defaultArg
Is this value passed as default parameter to the function?
 
bool isImpossible() const
 
double floatValue
float value
 
bool isUninitValue() const
 
static void visitValue(T &self, F f)
 
const Token * condition
Condition that this value depends on.
 
const Token * tokvalue
token value - the token that has the value.
 
long long intvalue
int value (or sometimes bool value?)
 
nonneg int varId
For calculated values - varId that calculated value depends on.
 
bool isBufferSizeValue() const
 
bool operator!=(const Value &rhs) const
 
enum ValueFlow::Value::ValueKind valueKind
 
bool equalValue(const ValueFlow::Value &rhs) const
 
bool isLocalLifetimeValue() const
 
bool operator==(const Value &rhs) const
 
Value(long long val=0, Bound b=Bound::Point)
 
bool isContainerSizeValue() const
 
std::list< ErrorPathItem > ErrorPath
 
std::pair< const Token *, std::string > ErrorPathItem
 
enum ValueFlow::Value::MoveKind moveKind
 
void setInconclusive(bool inconclusive=true)
 
bool isSubFunctionLifetimeValue() const
 
bool isIteratorStartValue() const
 
bool isIteratorEndValue() const
 
bool isInconclusive() const
 
bool compareValue(const Value &rhs, Compare compare) const
 
std::vector< std::string > subexpressions
 
std::string toString(Color c)
 
#define REQUIRES(msg,...)
 
void operator()(bool &result, Compare compare, T x, U y) const
 
void operator()(bool &result, const Value &rhs, Compare compare, T x) const
 
void operator()(T &x) const
 
void operator()(bool &result, T x, U y) const
 
void operator()(T &x) const