clang 20.0.0git

Supplements Environment
with nonstandard comparison and join operations.
More...
#include "clang/Analysis/FlowSensitive/DataflowEnvironment.h"
Public Member Functions  
virtual  ~ValueModel ()=default 
virtual ComparisonResult  compare (QualType Type, const Value &Val1, const Environment &Env1, const Value &Val2, const Environment &Env2) 
Returns: Same : Val1 is equivalent to Val2 , according to the model.  
virtual void  join (QualType Type, const Value &Val1, const Environment &Env1, const Value &Val2, const Environment &Env2, Value &JoinedVal, Environment &JoinedEnv) 
Modifies JoinedVal to approximate both Val1 and Val2 .  
virtual std::optional< WidenResult >  widen (QualType Type, Value &Prev, const Environment &PrevEnv, Value &Current, Environment &CurrentEnv) 
This function may widen the current value – replace it with an approximation that can reach a fixed point more quickly than iterated application of the transfer function alone.  
Supplements Environment
with nonstandard comparison and join operations.
Definition at line 69 of file DataflowEnvironment.h.

virtualdefault 

inlinevirtual 
Returns: Same
: Val1
is equivalent to Val2
, according to the model.
Different
: Val1
is distinct from Val2
, according to the model. Unknown
: The model can't determine a relationship between Val1
and Val2
.
Requirements:
Val1
and Val2
must be distinct.
Val1
and Val2
must model values of type Type
.
Val1
and Val2
must be assigned to the same storage location in Env1
and Env2
respectively.
Definition at line 87 of file DataflowEnvironment.h.
References clang::dataflow::Unknown.
Referenced by clang::dataflow::compareDistinctValues(), and widen().

inlinevirtual 
Modifies JoinedVal
to approximate both Val1
and Val2
.
This should obey the properties of a lattice join.
Env1
and Env2
can be used to query child values and path condition implications of Val1
and Val2
respectively.
Requirements:
Val1
and Val2
must be distinct.
Val1
, Val2
, and JoinedVal
must model values of type Type
.
Val1
and Val2
must be assigned to the same storage location in Env1
and Env2
respectively.
Definition at line 109 of file DataflowEnvironment.h.
Referenced by clang::dataflow::joinDistinctValues().

inlinevirtual 
This function may widen the current value – replace it with an approximation that can reach a fixed point more quickly than iterated application of the transfer function alone.
The previous value is provided to inform the choice of widened value. The function must also serve as a comparison operation, by indicating whether the widened value is equivalent to the previous value.
Returns one of the folowing:
std::nullopt
, if this value is not of interest to the model.WidenResult
with:Value *
that points either to Current
or a widened version of Current
. This value must be consistent with the flow condition of CurrentEnv
. We particularly caution against using Prev
, which is rarely consistent.LatticeEffect
indicating whether the value should be considered a new value (Changed
) or one equivalent (if not necessarily equal) to Prev
(Unchanged
).PrevEnv
and CurrentEnv
can be used to query child values and path condition implications of Prev
and Current
, respectively.
Requirements:
Prev
and Current
must model values of type Type
.
Prev
and Current
must be assigned to the same storage location in PrevEnv
and CurrentEnv
, respectively.
Definition at line 141 of file DataflowEnvironment.h.
References clang::dataflow::Changed, compare(), clang::dataflow::Different, clang::dataflow::Same, clang::dataflow::Unchanged, and clang::dataflow::Unknown.
Referenced by clang::dataflow::widenDistinctValues().