Go to the documentation of this file.
15 #ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_DATAFLOWENVIRONMENT_H
16 #define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_DATAFLOWENVIRONMENT_H
27 #include "llvm/ADT/DenseMap.h"
28 #include "llvm/ADT/DenseSet.h"
30 #include <type_traits>
237 template <
typename T>
238 typename std::enable_if<std::is_base_of<StorageLocation, T>::value, T &>
::type
249 template <
typename T>
250 typename std::enable_if<std::is_base_of<Value, T>::value, T &>
::type
330 int Depth,
int &CreatedValuesCount);
342 llvm::DenseMap<const ValueDecl *, StorageLocation *> DeclToLoc;
343 llvm::DenseMap<const Expr *, StorageLocation *> ExprToLoc;
345 llvm::DenseMap<const StorageLocation *, Value *> LocToVal;
350 std::pair<StructValue *, const ValueDecl *>>
359 #endif // LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_DATAFLOWENVIRONMENT_H
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
virtual ~ValueModel()=default
AtomicBoolValue & getBoolLiteralValue(bool Value) const
Returns a symbolic boolean value that models a boolean literal equal to Value
A (possibly-)qualified type.
Base class for elements of the local variable store and of the heap.
StorageLocation & createStorageLocation(QualType Type)
Creates a storage location appropriate for Type.
@ Reference
An optional reference should be skipped past.
virtual bool merge(QualType Type, const Value &Val1, const Environment &Env1, const Value &Val2, const Environment &Env2, Value &MergedVal, Environment &MergedEnv)
Modifies MergedVal to approximate both Val1 and Val2.
Value * createValue(QualType Type)
Creates a value appropriate for Type, if Type is supported, otherwise return null.
bool flowConditionImplies(BoolValue &Val) const
Returns true if and only if the clauses that constitute the flow condition imply that Val is true.
bool equivalentTo(const Environment &Other, Environment::ValueModel &Model) const
Returns true if and only if the environment is equivalent to Other, i.e the two environments:
LatticeJoinEffect
Effect indicating whether a lattice join operation resulted in a new value.
void addToFlowCondition(BoolValue &Val)
Adds Val to the set of clauses that constitute the flow condition.
void setStorageLocation(const ValueDecl &D, StorageLocation &Loc)
Assigns Loc as the storage location of D in the environment.
The base class of the type hierarchy.
Owns objects that encompass the state of a program and stores context that is used during dataflow an...
AtomicBoolValue & getFlowConditionToken() const
Returns the token that identifies the flow condition of the environment.
BoolValue & getOrCreateNegationValue(BoolValue &Val)
Returns a boolean value that represents the negation of Val.
BoolValue & makeOr(BoolValue &LHS, BoolValue &RHS) const
Returns a boolean value that represents the disjunction of LHS and RHS.
@ None
No indirections should be skipped past.
void setValue(const StorageLocation &Loc, Value &Val)
Assigns Val as the value of Loc in the environment.
Represents a variable declaration or definition.
BoolValue & getOrCreateConjunctionValue(BoolValue &LHS, BoolValue &RHS)
Returns a boolean value that represents the conjunction of LHS and RHS.
BoolValue & makeImplication(BoolValue &LHS, BoolValue &RHS) const
Returns a boolean value represents LHS => RHS.
Models an atomic boolean.
BoolValue & getOrCreateDisjunctionValue(BoolValue &LHS, BoolValue &RHS)
Returns a boolean value that represents the disjunction of LHS and RHS.
StorageLocation * getThisPointeeStorageLocation() const
Returns the storage location assigned to the this pointee in the environment or null if the this poin...
Supplements Environment with non-standard comparison and join operations.
Value * getValue(const StorageLocation &Loc) const
Returns the value assigned to Loc in the environment or null if Loc isn't assigned a value in the env...
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Environment & operator=(const Environment &Other)
@ ReferenceThenPointer
An optional reference should be skipped past, then an optional pointer should be skipped past.
AtomicBoolValue & getBoolLiteralValue(bool Value) const
Returns a symbolic boolean value that models a boolean literal equal to Value.
BoolValue & makeAtomicBoolValue() const
Returns an atomic boolean value.
virtual bool compareEquivalent(QualType Type, const Value &Val1, const Environment &Env1, const Value &Val2, const Environment &Env2)
Returns true if and only if Val1 is equivalent to Val2.
SkipPast
Indicates what kind of indirections should be skipped past when retrieving storage locations or value...
BoolValue & makeAnd(BoolValue &LHS, BoolValue &RHS) const
Returns a boolean value that represents the conjunction of LHS and RHS.
std::enable_if< std::is_base_of< StorageLocation, T >::value, T & >::type takeOwnership(std::unique_ptr< T > Loc)
Transfers ownership of Loc to the analysis context and returns a reference to it.
Base class for all values computed by abstract interpretation.
BoolValue & makeIff(BoolValue &LHS, BoolValue &RHS) const
Returns a boolean value represents LHS <=> RHS.
StorageLocation * getStorageLocation(const ValueDecl &D, SkipPast SP) const
Returns the storage location assigned to D in the environment, applying the SP policy for skipping pa...
std::enable_if< std::is_base_of< StorageLocation, T >::value, T & >::type takeOwnership(std::unique_ptr< T > Loc)
Takes ownership of Loc and returns a reference to it.
Holds the state of the program (store and heap) at a given program point.
This represents one expression.
Environment(DataflowAnalysisContext &DACtx)
Creates an environment that uses DACtx to store objects that encompass the state of a program.
LatticeJoinEffect join(const Environment &Other, Environment::ValueModel &Model)
Joins the environment with Other by taking the intersection of storage locations and values that are ...
BoolValue & makeNot(BoolValue &Val) const
Returns a boolean value that represents the negation of Val.
AtomicBoolValue & createAtomicBoolValue()
Creates an atomic boolean value.
std::enable_if< std::is_base_of< Value, T >::value, T & >::type takeOwnership(std::unique_ptr< T > Val)
Transfers ownership of Val to the analysis context and returns a reference to it.