15#ifndef LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_DATAFLOWANALYSISCONTEXT_H
16#define LLVM_CLANG_ANALYSIS_FLOWSENSITIVE_DATAFLOWANALYSISCONTEXT_H
26#include "llvm/ADT/DenseMap.h"
27#include "llvm/ADT/DenseSet.h"
28#include "llvm/Support/Compiler.h"
107 assert(!DeclToLoc.contains(&D));
108 DeclToLoc[&D] = &Loc;
114 auto It = DeclToLoc.find(&D);
115 return It == DeclToLoc.end() ? nullptr : It->second;
125 assert(!ExprToLoc.contains(&CanonE));
126 ExprToLoc[&CanonE] = &Loc;
133 return It == ExprToLoc.end() ? nullptr : It->second;
169 llvm::raw_ostream &OS = llvm::dbgs());
182 struct NullableQualTypeDenseMapInfo :
private llvm::DenseMapInfo<QualType> {
188 using DenseMapInfo::getHashValue;
189 using DenseMapInfo::getTombstoneKey;
190 using DenseMapInfo::isEqual;
204 void addTransitiveFlowConditionConstraints(
218 return querySolver(std::move(Constraints)).
getStatus() ==
222 std::unique_ptr<Solver> S;
223 std::unique_ptr<Arena> A;
230 llvm::DenseMap<const ValueDecl *, StorageLocation *> DeclToLoc;
231 llvm::DenseMap<const Expr *, StorageLocation *> ExprToLoc;
239 llvm::DenseMap<QualType, PointerValue *, NullableQualTypeDenseMapInfo>
256 llvm::DenseMap<AtomicBoolValue *, llvm::DenseSet<AtomicBoolValue *>>
258 llvm::DenseMap<AtomicBoolValue *, BoolValue *> FlowConditionConstraints;
260 llvm::DenseMap<const FunctionDecl *, ControlFlowContext> FunctionContexts;
265 std::unique_ptr<Logger> LogOwner;
Allows QualTypes to be sorted and hence used in maps and sets.
This represents one expression.
Represents a function declaration or definition.
A (possibly-)qualified type.
static QualType getFromOpaquePtr(const void *Ptr)
Token - This structure provides full information about a lexed token.
The base class of the type hierarchy.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
The Arena owns the objects that model data within an analysis.
Models an atomic boolean.
Holds CFG and other derived context that is needed to perform dataflow analysis.
Owns objects that encompass the state of a program and stores context that is used during dataflow an...
StorageLocation & getStableStorageLocation(const VarDecl &D)
Returns a stable storage location for D.
const Options & getOptions()
StorageLocation * getStorageLocation(const ValueDecl &D) const
Returns the storage location assigned to D or null if D has no assigned storage location.
bool equivalentBoolValues(BoolValue &Val1, BoolValue &Val2)
Returns true if Val1 is equivalent to Val2.
void setStorageLocation(const Expr &E, StorageLocation &Loc)
Assigns Loc as the storage location of E.
bool flowConditionImplies(AtomicBoolValue &Token, BoolValue &Val)
Returns true if and only if the constraints of the flow condition identified by Token imply that Val ...
void setStorageLocation(const ValueDecl &D, StorageLocation &Loc)
Assigns Loc as the storage location of D.
bool flowConditionIsTautology(AtomicBoolValue &Token)
Returns true if and only if the constraints of the flow condition identified by Token are always true...
void addFlowConditionConstraint(AtomicBoolValue &Token, BoolValue &Constraint)
Adds Constraint to the flow condition identified by Token.
PointerValue & getOrCreateNullPointerValue(QualType PointeeType)
Returns a pointer value that represents a null pointer.
~DataflowAnalysisContext()
StorageLocation & createStorageLocation(QualType Type)
Returns a new storage location appropriate for Type.
AtomicBoolValue & joinFlowConditions(AtomicBoolValue &FirstToken, AtomicBoolValue &SecondToken)
Creates a new flow condition that represents the disjunction of the flow conditions identified by Fir...
LLVM_DUMP_METHOD void dumpFlowCondition(AtomicBoolValue &Token, llvm::raw_ostream &OS=llvm::dbgs())
AtomicBoolValue & forkFlowCondition(AtomicBoolValue &Token)
Creates a new flow condition with the same constraints as the flow condition identified by Token and ...
const ControlFlowContext * getControlFlowContext(const FunctionDecl *F)
Returns the ControlFlowContext registered for F, if any.
StorageLocation * getStorageLocation(const Expr &E) const
Returns the storage location assigned to E or null if E has no assigned storage location.
Holds the state of the program (store and heap) at a given program point.
A logger is notified as the analysis progresses.
Models a symbolic pointer. Specifically, any value of type T*.
Base class for elements of the local variable store and of the heap.
llvm::DenseSet< const FieldDecl * > getObjectFields(QualType Type)
Returns the set of all fields in the type.
const Expr & ignoreCFGOmittedNodes(const Expr &E)
Skip past nodes that the CFG does not emit.
unsigned Depth
The maximum depth to analyze.
Logger * Log
If provided, analysis details will be recorded here.
std::optional< ContextSensitiveOptions > ContextSensitiveOpts
Options for analyzing function bodies when present in the translation unit, or empty to disable conte...
Status getStatus() const
Returns the status of satisfiability checking on the queried boolean formula.
@ Unsatisfiable
Indicates that there is no satisfying assignment for a boolean formula.