clang 18.0.0git
|
Dataflow Directional Tag Classes. More...
Classes | |
class | Arena |
The Arena owns the objects that model data within an analysis. More... | |
class | ASTMatchSwitchBuilder |
Collects cases of a "match switch": a collection of matchers paired with callbacks, which together define a switch that can be applied to a node whose type derives from BaseT . More... | |
class | AtomicBoolValue |
Models an atomic boolean. More... | |
struct | backward_analysis_tag |
class | BoolValue |
Models a boolean. More... | |
class | CFGMatchSwitchBuilder |
Collects cases of a "match switch": a collection of matchers paired with callbacks, which together define a switch that can be applied to an AST node contained in a CFG element. More... | |
class | ChromiumCheckModel |
Models the behavior of Chromium's CHECK, DCHECK, etc. More... | |
struct | CNFFormula |
A boolean formula in conjunctive normal form. More... | |
struct | CNFFormulaBuilder |
Applies simplifications while building up a BooleanFormula. More... | |
struct | ContextSensitiveOptions |
class | ControlFlowContext |
Holds CFG and other derived context that is needed to perform dataflow analysis. More... | |
class | DataflowAnalysis |
Base class template for dataflow analyses built on a single lattice type. More... | |
class | DataflowAnalysisContext |
Owns objects that encompass the state of a program and stores context that is used during dataflow analysis. More... | |
struct | DataflowAnalysisOptions |
struct | DataflowAnalysisState |
class | DataflowModel |
Abstract base class for dataflow "models": reusable analysis components that model a particular aspect of program semantics in the Environment . More... | |
class | Environment |
Holds the state of the program (store and heap) at a given program point. More... | |
class | Formula |
class | FormulaBoolValue |
Models a compound boolean formula. More... | |
struct | forward_analysis_tag |
class | IntegerValue |
Models an integer. More... | |
class | Logger |
A logger is notified as the analysis progresses. More... | |
class | MapLattice |
A lattice that maps keys to individual lattice elements. More... | |
class | NoopAnalysis |
class | NoopLattice |
Trivial lattice for dataflow analysis with exactly one element. More... | |
class | PointerValue |
Models a symbolic pointer. Specifically, any value of type T* . More... | |
class | RecordStorageLocation |
A storage location for a record (struct, class, or union). More... | |
class | RecordValue |
Models a value of struct or class type. More... | |
class | ScalarStorageLocation |
A storage location that is not subdivided further for the purposes of abstract interpretation. More... | |
struct | SimplifyConstraintsInfo |
Information on the way a set of constraints was simplified. More... | |
class | Solver |
An interface for a SAT solver that can be used by dataflow analyses. More... | |
class | StmtToEnvMap |
Maps statements to the environments of basic blocks that contain them. More... | |
class | StorageLocation |
Base class for elements of the local variable store and of the heap. More... | |
class | TopBoolValue |
A TopBoolValue represents a boolean that is explicitly unconstrained. More... | |
struct | TransferState |
A common form of state shared between the cases of a transfer function. More... | |
struct | TransferStateForDiagnostics |
A read-only version of TransferState. More... | |
class | TypeErasedDataflowAnalysis |
Type-erased base class for dataflow analyses built on a single lattice type. More... | |
struct | TypeErasedDataflowAnalysisState |
Type-erased model of the program at a given program point. More... | |
struct | TypeErasedLattice |
Type-erased lattice element container. More... | |
class | UncheckedOptionalAccessDiagnoser |
class | UncheckedOptionalAccessModel |
Dataflow analysis that models whether optionals hold values or not. More... | |
struct | UncheckedOptionalAccessModelOptions |
class | Value |
Base class for all values computed by abstract interpretation. More... | |
class | WatchedLiteralsSolver |
A SAT solver that is an implementation of Algorithm D from Knuth's The Art of Computer Programming Volume 4: Satisfiability, Fascicle 6. More... | |
class | WatchedLiteralsSolverImpl |
Typedefs | |
template<typename State , typename Result = void> | |
using | CFGMatchSwitch = std::function< Result(const CFGElement &, ASTContext &, State &)> |
using | FieldSet = llvm::SmallSetVector< const FieldDecl *, 4 > |
A set of FieldDecl * . | |
template<typename ElementLattice > | |
using | VarMapLattice = MapLattice< const clang::VarDecl *, ElementLattice > |
Convenience alias that captures the common use of map lattices to model in-scope variables. | |
template<typename T > | |
using | MatchSwitchMatcher = ast_matchers::internal::Matcher< T > |
template<typename T , typename State , typename Result = void> | |
using | MatchSwitchAction = std::function< Result(const T *, const ast_matchers::MatchFinder::MatchResult &, State &)> |
template<typename BaseT , typename State , typename Result = void> | |
using | ASTMatchSwitch = std::function< Result(const BaseT &, ASTContext &, State &)> |
using | Variable = uint32_t |
Boolean variables are represented as positive integers. | |
using | Literal = uint32_t |
Literals are represented as positive integers. | |
using | ClauseID = uint32_t |
Clause identifiers are represented as positive integers. | |
Enumerations | |
enum class | ComparisonResult { Same , Different , Unknown } |
Indicates the result of a tentative comparison. More... | |
enum class | LatticeJoinEffect { Unchanged , Changed } |
Effect indicating whether a lattice join operation resulted in a new value. More... | |
enum class | Atom : unsigned |
Identifies an atomic boolean variable such as "V1". More... | |
Functions | |
template<typename AnalysisT > | |
llvm::Expected< std::vector< std::optional< DataflowAnalysisState< typename AnalysisT::Lattice > > > > | runDataflowAnalysis (const ControlFlowContext &CFCtx, AnalysisT &Analysis, const Environment &InitEnv, std::function< void(const CFGElement &, const DataflowAnalysisState< typename AnalysisT::Lattice > &)> PostVisitCFG=nullptr) |
Performs dataflow analysis and returns a mapping from basic block IDs to dataflow analysis states that model the respective basic blocks. | |
template<typename AnalysisT > | |
auto | createAnalysis (ASTContext &ASTCtx, Environment &Env) -> decltype(AnalysisT(ASTCtx, Env)) |
template<typename AnalysisT , typename Diagnostic > | |
llvm::Expected< llvm::SmallVector< Diagnostic > > | diagnoseFunction (const FunctionDecl &FuncDecl, ASTContext &ASTCtx, llvm::function_ref< llvm::SmallVector< Diagnostic >(const CFGElement &, ASTContext &, const TransferStateForDiagnostics< typename AnalysisT::Lattice > &)> Diagnoser, std::int64_t MaxSATIterations=1 '000 '000 '000) |
Runs a dataflow analysis over the given function and then runs Diagnoser over the results. | |
const Expr & | ignoreCFGOmittedNodes (const Expr &E) |
Skip past nodes that the CFG does not emit. | |
const Stmt & | ignoreCFGOmittedNodes (const Stmt &S) |
FieldSet | getObjectFields (QualType Type) |
Returns the set of all fields in the type. | |
bool | containsSameFields (const FieldSet &Fields, const RecordStorageLocation::FieldToLoc &FieldLocs) |
Returns whether Fields and FieldLocs contain the same fields. | |
RecordStorageLocation * | getImplicitObjectLocation (const CXXMemberCallExpr &MCE, const Environment &Env) |
Returns the storage location for the implicit object of a CXXMemberCallExpr , or null if none is defined in the environment. | |
RecordStorageLocation * | getBaseObjectLocation (const MemberExpr &ME, const Environment &Env) |
Returns the storage location for the base object of a MemberExpr , or null if none is defined in the environment. | |
std::vector< FieldDecl * > | getFieldsForInitListExpr (const RecordDecl *RD) |
Returns the fields of RD that are initialized by an InitListExpr , in the order in which they appear in InitListExpr::inits() . | |
RecordValue & | refreshRecordValue (RecordStorageLocation &Loc, Environment &Env) |
Associates a new RecordValue with Loc and returns the new value. | |
RecordValue & | refreshRecordValue (const Expr &Expr, Environment &Env) |
Associates a new RecordValue with Expr and returns the new value. | |
llvm::StringRef | debugString (Value::Kind Kind) |
Returns a string representation of a value kind. | |
llvm::StringRef | debugString (Solver::Result::Status Status) |
Returns a string representation of the result status of a SAT check. | |
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, Atom A) |
llvm::raw_ostream & | operator<< (llvm::raw_ostream &OS, const Formula &F) |
template<typename Key , typename ElementLattice > | |
std::ostream & | operator<< (std::ostream &Os, const clang::dataflow::MapLattice< Key, ElementLattice > &M) |
template<typename ElementLattice > | |
std::ostream & | operator<< (std::ostream &Os, const clang::dataflow::VarMapLattice< ElementLattice > &M) |
std::ostream & | operator<< (std::ostream &OS, const NoopLattice &) |
void | copyRecord (RecordStorageLocation &Src, RecordStorageLocation &Dst, Environment &Env) |
Copies a record (struct, class, or union) from Src to Dst . | |
bool | recordsEqual (const RecordStorageLocation &Loc1, const Environment &Env1, const RecordStorageLocation &Loc2, const Environment &Env2) |
Returns whether the records Loc1 and Loc2 are equal. | |
bool | recordsEqual (const RecordStorageLocation &Loc1, const RecordStorageLocation &Loc2, const Environment &Env) |
void | simplifyConstraints (llvm::SetVector< const Formula * > &Constraints, Arena &arena, SimplifyConstraintsInfo *Info=nullptr) |
Simplifies a set of constraints (implicitly connected by "and") in a way that does not change satisfiability of the constraints. | |
llvm::raw_ostream & | operator<< (llvm::raw_ostream &, const Solver::Result &) |
llvm::raw_ostream & | operator<< (llvm::raw_ostream &, Solver::Result::Assignment) |
void | transfer (const StmtToEnvMap &StmtToEnv, const Stmt &S, Environment &Env) |
Evaluates S and updates Env accordingly. | |
llvm::Expected< std::vector< std::optional< TypeErasedDataflowAnalysisState > > > | runTypeErasedDataflowAnalysis (const ControlFlowContext &CFCtx, TypeErasedDataflowAnalysis &Analysis, const Environment &InitEnv, std::function< void(const CFGElement &, const TypeErasedDataflowAnalysisState &)> PostVisitCFG=nullptr) |
Performs dataflow analysis and returns a mapping from basic block IDs to dataflow analysis states that model the respective basic blocks. | |
bool | areEquivalentValues (const Value &Val1, const Value &Val2) |
An equivalence relation for values. | |
raw_ostream & | operator<< (raw_ostream &OS, const Value &Val) |
static std::pair< const Formula *, const Formula * > | canonicalFormulaPair (const Formula &LHS, const Formula &RHS) |
template<class Key , class ComputeFunc > | |
const Formula & | cached (llvm::DenseMap< Key, const Formula * > &Cache, Key K, ComputeFunc &&Compute) |
static llvm::DenseMap< const Stmt *, const CFGBlock * > | buildStmtToBasicBlockMap (const CFG &Cfg) |
Returns a map from statements to basic blocks that contain them. | |
static llvm::BitVector | findReachableBlocks (const CFG &Cfg) |
template<typename T > | |
static llvm::DenseSet< llvm::StringRef > | getKeys (const llvm::StringMap< T > &Map) |
static void | printAtomList (const llvm::SmallVector< Atom > &Atoms, llvm::raw_ostream &OS) |
static std::unique_ptr< Logger > | makeLoggerFromCommandLine () |
static llvm::DenseMap< const ValueDecl *, StorageLocation * > | intersectDeclToLoc (const llvm::DenseMap< const ValueDecl *, StorageLocation * > &DeclToLoc1, const llvm::DenseMap< const ValueDecl *, StorageLocation * > &DeclToLoc2) |
Returns a map consisting of key-value entries that are present in both maps. | |
static bool | equateUnknownValues (Value::Kind K) |
static bool | compareDistinctValues (QualType Type, Value &Val1, const Environment &Env1, Value &Val2, const Environment &Env2, Environment::ValueModel &Model) |
static Value * | mergeDistinctValues (QualType Type, Value &Val1, const Environment &Env1, Value &Val2, const Environment &Env2, Environment &MergedEnv, Environment::ValueModel &Model) |
Attempts to merge distinct values Val1 and Val2 in Env1 and Env2 , respectively, of the same type Type . | |
static Value & | widenDistinctValues (QualType Type, Value &Prev, const Environment &PrevEnv, Value &Current, Environment &CurrentEnv, Environment::ValueModel &Model) |
template<typename Key > | |
bool | compareKeyToValueMaps (const llvm::MapVector< Key, Value * > &Map1, const llvm::MapVector< Key, Value * > &Map2, const Environment &Env1, const Environment &Env2, Environment::ValueModel &Model) |
static llvm::MapVector< const StorageLocation *, Value * > | joinLocToVal (const llvm::MapVector< const StorageLocation *, Value * > &LocToVal, const llvm::MapVector< const StorageLocation *, Value * > &LocToVal2, const Environment &Env1, const Environment &Env2, Environment &JoinedEnv, Environment::ValueModel &Model) |
template<typename Key > | |
llvm::MapVector< Key, Value * > | widenKeyToValueMap (const llvm::MapVector< Key, Value * > &CurMap, const llvm::MapVector< Key, Value * > &PrevMap, Environment &CurEnv, const Environment &PrevEnv, Environment::ValueModel &Model, LatticeJoinEffect &Effect) |
static void | insertIfGlobal (const Decl &D, llvm::DenseSet< const VarDecl * > &Vars) |
Initializes a global storage value. | |
static void | insertIfFunction (const Decl &D, llvm::DenseSet< const FunctionDecl * > &Funcs) |
static MemberExpr * | getMemberForAccessor (const CXXMemberCallExpr &C) |
static void | getFieldsGlobalsAndFuncs (const Decl &D, FieldSet &Fields, llvm::DenseSet< const VarDecl * > &Vars, llvm::DenseSet< const FunctionDecl * > &Funcs) |
static void | getFieldsGlobalsAndFuncs (const Stmt &S, FieldSet &Fields, llvm::DenseSet< const VarDecl * > &Vars, llvm::DenseSet< const FunctionDecl * > &Funcs) |
Traverses S and inserts into Fields , Vars and Funcs any fields, global variables and functions that are declared in or referenced from sub-statements. | |
static llvm::StringLiteral | sigil (Formula::Kind K) |
bool | isCheckLikeMethod (llvm::SmallDenseSet< const CXXMethodDecl * > &CheckDecls, const CXXMethodDecl &D) |
Determines whether D is one of the methods used to implement Chromium's CHECK macros. | |
static bool | isTopLevelNamespaceWithName (const NamespaceDecl &NS, llvm::StringRef Name) |
static bool | hasOptionalClassName (const CXXRecordDecl &RD) |
static QualType | valueTypeFromOptionalType (QualType OptionalTy) |
static const Formula & | substitute (const Formula &F, const llvm::DenseMap< Atom, const Formula * > &Substitutions, Arena &arena) |
static llvm::DenseSet< Atom > | projectToLeaders (const llvm::DenseSet< Atom > &Atoms, llvm::EquivalenceClasses< Atom > &EquivalentAtoms) |
static llvm::SmallVector< Atom > | atomsInEquivalenceClass (const llvm::EquivalenceClasses< Atom > &EquivalentAtoms, llvm::EquivalenceClasses< Atom >::iterator LeaderIt) |
static BoolValue & | evaluateBooleanEquality (const Expr &LHS, const Expr &RHS, Environment &Env) |
static BoolValue & | unpackValue (BoolValue &V, Environment &Env) |
static Value * | maybeUnpackLValueExpr (const Expr &E, Environment &Env) |
static void | propagateValue (const Expr &From, const Expr &To, Environment &Env) |
static void | propagateStorageLocation (const Expr &From, const Expr &To, Environment &Env) |
static void | propagateValueOrStorageLocation (const Expr &From, const Expr &To, Environment &Env) |
static int | blockIndexInPredecessor (const CFGBlock &Pred, const CFGBlock &Block) |
Returns the index of Block in the successors of Pred . | |
static bool | isBackedgeNode (const CFGBlock &B) |
static TypeErasedDataflowAnalysisState | computeBlockInputState (const CFGBlock &Block, AnalysisContext &AC) |
Computes the input state for a given basic block by joining the output states of its predecessors. | |
static void | builtinTransferStatement (const CFGStmt &Elt, TypeErasedDataflowAnalysisState &InputState, AnalysisContext &AC) |
Built-in transfer function for CFGStmt . | |
static void | builtinTransferInitializer (const CFGInitializer &Elt, TypeErasedDataflowAnalysisState &InputState) |
Built-in transfer function for CFGInitializer . | |
static void | builtinTransfer (const CFGElement &Elt, TypeErasedDataflowAnalysisState &State, AnalysisContext &AC) |
static TypeErasedDataflowAnalysisState | transferCFGBlock (const CFGBlock &Block, AnalysisContext &AC, std::function< void(const CFGElement &, const TypeErasedDataflowAnalysisState &)> PostVisitCFG=nullptr) |
Transfers State by evaluating each element in the Block based on the AC.Analysis specified. | |
static bool | areEquivalentIndirectionValues (const Value &Val1, const Value &Val2) |
static constexpr Literal | posLit (Variable V) |
Returns the positive literal V . | |
static constexpr bool | isPosLit (Literal L) |
static constexpr bool | isNegLit (Literal L) |
static constexpr Literal | negLit (Variable V) |
Returns the negative literal !V . | |
static constexpr Literal | notLit (Literal L) |
Returns the negated literal !L . | |
static constexpr Variable | var (Literal L) |
Returns the variable of L . | |
CNFFormula | buildCNF (const llvm::ArrayRef< const Formula * > &Vals) |
Converts the conjunction of Vals into a formula in conjunctive normal form where each clause has at least one and at most three literals. | |
Variables | |
static constexpr int | MaxCompositeValueDepth = 3 |
static constexpr int | MaxCompositeValueSize = 1000 |
static constexpr Variable | NullVar = 0 |
A null boolean variable is used as a placeholder in various data structures and algorithms. | |
static constexpr Literal | NullLit = 0 |
A null literal is used as a placeholder in various data structures and algorithms. | |
static constexpr ClauseID | NullClause = 0 |
A null clause identifier is used as a placeholder in various data structures and algorithms. | |
Dataflow Directional Tag Classes.
These are used for tag dispatching within the dataflow solver/transfer functions to determine what direction a dataflow analysis flows.
using clang::dataflow::ASTMatchSwitch = typedef std::function<Result(const BaseT &, ASTContext &, State &)> |
Definition at line 72 of file MatchSwitch.h.
using clang::dataflow::CFGMatchSwitch = typedef std::function<Result(const CFGElement &, ASTContext &, State &)> |
Definition at line 33 of file CFGMatchSwitch.h.
using clang::dataflow::ClauseID = typedef uint32_t |
Clause identifiers are represented as positive integers.
Definition at line 81 of file WatchedLiteralsSolver.cpp.
using clang::dataflow::FieldSet = typedef llvm::SmallSetVector<const FieldDecl *, 4> |
A set of FieldDecl *
.
Use SmallSetVector
to guarantee deterministic iteration order.
Definition at line 56 of file DataflowAnalysisContext.h.
using clang::dataflow::Literal = typedef uint32_t |
Literals are represented as positive integers.
Specifically, for a boolean variable V
that is represented as the positive integer I
, the positive literal V
is represented as the integer 2*I
and the negative literal !V
is represented as the integer 2*I+1
.
Definition at line 58 of file WatchedLiteralsSolver.cpp.
using clang::dataflow::MatchSwitchAction = typedef std::function<Result( const T *, const ast_matchers::MatchFinder::MatchResult &, State &)> |
Definition at line 68 of file MatchSwitch.h.
using clang::dataflow::MatchSwitchMatcher = typedef ast_matchers::internal::Matcher<T> |
Definition at line 65 of file MatchSwitch.h.
using clang::dataflow::Variable = typedef uint32_t |
Boolean variables are represented as positive integers.
Definition at line 48 of file WatchedLiteralsSolver.cpp.
using clang::dataflow::VarMapLattice = typedef MapLattice<const clang::VarDecl *, ElementLattice> |
Convenience alias that captures the common use of map lattices to model in-scope variables.
Definition at line 112 of file MapLattice.h.
|
strong |
Identifies an atomic boolean variable such as "V1".
This often represents an assertion that is interesting to the analysis but cannot immediately be proven true or false. For example:
We can use these variables in formulas to describe relationships we know to be true: "if the parameter was null, the program reaches this point". We also express hypotheses as formulas, and use a SAT solver to check whether they are consistent with the known facts.
|
strong |
Indicates the result of a tentative comparison.
Enumerator | |
---|---|
Same | |
Different | |
Unknown |
Definition at line 42 of file DataflowEnvironment.h.
|
strong |
Effect indicating whether a lattice join operation resulted in a new value.
Enumerator | |
---|---|
Unchanged | |
Changed |
Definition at line 23 of file DataflowLattice.h.
|
static |
Definition at line 20 of file Value.cpp.
Referenced by areEquivalentValues().
An equivalence relation for values.
It obeys reflexivity, symmetry and transitivity. It does not include comparison of Properties
.
Computes equivalence for these subclasses:
Value
at said location.TopBoolValue
s.Otherwise, falls back to pointer equality.
Definition at line 29 of file Value.cpp.
References areEquivalentIndirectionValues(), and clang::dataflow::Value::getKind().
Referenced by compareKeyToValueMaps(), clang::dataflow::Environment::join(), joinLocToVal(), and widenKeyToValueMap().
|
static |
Definition at line 66 of file SimplifyConstraints.cpp.
References clang::Result.
Referenced by simplifyConstraints().
|
static |
Returns the index of Block
in the successors of Pred
.
Definition at line 46 of file TypeErasedDataflowAnalysis.cpp.
References clang::Block, clang::CFGBlock::succ_begin(), and clang::CFGBlock::succs().
Referenced by computeBlockInputState().
CNFFormula clang::dataflow::buildCNF | ( | const llvm::ArrayRef< const Formula * > & | Vals | ) |
Converts the conjunction of Vals
into a formula in conjunctive normal form where each clause has at least one and at most three literals.
Definition at line 261 of file WatchedLiteralsSolver.cpp.
References clang::dataflow::CNFFormulaBuilder::addClause(), clang::dataflow::CNFFormula::addClause(), clang::dataflow::Formula::And, clang::dataflow::CNFFormula::Atomics, clang::dataflow::Formula::AtomRef, clang::C, clang::dataflow::CNFFormula::clauseLiterals(), clang::dataflow::CNFFormula::clauseSize(), clang::dataflow::CNFFormula::ClauseStarts, clang::dataflow::Formula::Equal, clang::dataflow::Formula::getAtom(), clang::dataflow::Formula::Implies, clang::dataflow::CNFFormulaBuilder::isKnownContradictory(), clang::dataflow::Formula::kind(), clang::dataflow::Formula::Literal, clang::dataflow::Formula::literal(), negLit(), clang::dataflow::Formula::Not, clang::dataflow::Formula::operands(), clang::dataflow::Formula::Or, and posLit().
|
static |
Returns a map from statements to basic blocks that contain them.
Definition at line 29 of file ControlFlowContext.cpp.
References clang::Block.
Referenced by clang::dataflow::ControlFlowContext::build().
|
static |
Definition at line 431 of file TypeErasedDataflowAnalysis.cpp.
References builtinTransferInitializer(), builtinTransferStatement(), clang::CFGElement::castAs(), clang::CFGElement::getKind(), clang::CFGLifetimeEnds::getVarDecl(), clang::CFGElement::Initializer, clang::CFGElement::LifetimeEnds, and clang::CFGElement::Statement.
Referenced by transferCFGBlock().
|
static |
Built-in transfer function for CFGInitializer
.
Definition at line 369 of file TypeErasedDataflowAnalysis.cpp.
References clang::IndirectFieldDecl::chain(), copyRecord(), clang::dataflow::TypeErasedDataflowAnalysisState::Env, Env, clang::dataflow::RecordStorageLocation::getChild(), clang::CFGInitializer::getInitializer(), clang::dataflow::Environment::getStorageLocation(), clang::dataflow::Environment::getThisPointeeStorageLocation(), clang::dataflow::Environment::getValue(), clang::Init, clang::Member, clang::dataflow::RecordStorageLocation::setChild(), and clang::dataflow::Environment::setValue().
Referenced by builtinTransfer().
|
static |
Built-in transfer function for CFGStmt
.
Definition at line 359 of file TypeErasedDataflowAnalysis.cpp.
References clang::dataflow::TypeErasedDataflowAnalysisState::Env, clang::CFGStmt::getStmt(), and transfer().
Referenced by builtinTransfer().
const Formula & clang::dataflow::cached | ( | llvm::DenseMap< Key, const Formula * > & | Cache, |
Key | K, | ||
ComputeFunc && | Compute | ||
) |
Definition at line 26 of file Arena.cpp.
References clang::Compute.
Referenced by clang::dataflow::Arena::makeAnd(), clang::dataflow::Arena::makeAtomRef(), clang::dataflow::Arena::makeEquals(), clang::dataflow::Arena::makeImplies(), clang::dataflow::Arena::makeNot(), and clang::dataflow::Arena::makeOr().
|
static |
Definition at line 18 of file Arena.cpp.
Referenced by clang::dataflow::Arena::makeAnd(), clang::dataflow::Arena::makeEquals(), and clang::dataflow::Arena::makeOr().
|
static |
Definition at line 68 of file DataflowEnvironment.cpp.
References clang::dataflow::Environment::ValueModel::compare(), Different, equateUnknownValues(), clang::dataflow::Value::getKind(), Same, and Unknown.
Referenced by compareKeyToValueMaps().
bool clang::dataflow::compareKeyToValueMaps | ( | const llvm::MapVector< Key, Value * > & | Map1, |
const llvm::MapVector< Key, Value * > & | Map2, | ||
const Environment & | Env1, | ||
const Environment & | Env2, | ||
Environment::ValueModel & | Model | ||
) |
Definition at line 194 of file DataflowEnvironment.cpp.
References areEquivalentValues(), and compareDistinctValues().
Referenced by clang::dataflow::Environment::equivalentTo().
|
static |
Computes the input state for a given basic block by joining the output states of its predecessors.
Requirements:
All predecessors of Block
except those with loop back edges must have already been transferred. States in AC.BlockStates
that are set to std::nullopt
represent basic blocks that are not evaluated yet.
Definition at line 285 of file TypeErasedDataflowAnalysis.cpp.
References clang::Block, blockIndexInPredecessor(), and clang::Copy.
Referenced by transferCFGBlock().
bool clang::dataflow::containsSameFields | ( | const FieldSet & | Fields, |
const RecordStorageLocation::FieldToLoc & | FieldLocs | ||
) |
Returns whether Fields
and FieldLocs
contain the same fields.
Definition at line 398 of file DataflowAnalysisContext.cpp.
Referenced by clang::dataflow::DataflowAnalysisContext::createRecordStorageLocation().
void clang::dataflow::copyRecord | ( | RecordStorageLocation & | Src, |
RecordStorageLocation & | Dst, | ||
Environment & | Env | ||
) |
Copies a record (struct, class, or union) from Src
to Dst
.
This performs a deep copy, i.e. it copies every field (including synthetic fields) and recurses on fields of record type. It also copies properties from the RecordValue
associated with Src
to the RecordValue
associated with Dst
(if these RecordValue
s exist).
If there is a RecordValue
associated with Dst
in the environment, this function creates a new RecordValue
and associates it with Dst
; clients need to be aware of this and must not assume that the RecordValue
associated with Dst
remains the same after the call.
We create a new RecordValue
rather than modifying properties on the old RecordValue
because the old RecordValue
may be shared with other Environment
s, and we don't want changes to properties to be visible there.
Requirements:
Src
and Dst
must have the same canonical unqualified type.
Definition at line 17 of file RecordOps.cpp.
References clang::dataflow::RecordStorageLocation::children(), copyRecord(), Env, clang::Type::getAsCXXRecordDecl(), clang::QualType::getCanonicalType(), clang::dataflow::RecordStorageLocation::getChild(), clang::dataflow::RecordStorageLocation::getSyntheticField(), clang::dataflow::StorageLocation::getType(), clang::QualType::getUnqualifiedType(), clang::dataflow::Value::properties(), clang::dataflow::RecordStorageLocation::setChild(), clang::dataflow::Value::setProperty(), and clang::dataflow::RecordStorageLocation::synthetic_fields().
Referenced by builtinTransferInitializer(), and copyRecord().
auto clang::dataflow::createAnalysis | ( | ASTContext & | ASTCtx, |
Environment & | Env | ||
) | -> decltype(AnalysisT(ASTCtx, Env)) |
Definition at line 243 of file DataflowAnalysis.h.
References Env.
llvm::StringRef clang::dataflow::debugString | ( | Solver::Result::Status | Status | ) |
Returns a string representation of the result status of a SAT check.
Definition at line 54 of file DebugSupport.cpp.
References clang::dataflow::Solver::Result::Satisfiable, clang::dataflow::Solver::Result::TimedOut, and clang::dataflow::Solver::Result::Unsatisfiable.
llvm::StringRef clang::dataflow::debugString | ( | Value::Kind | Kind | ) |
Returns a string representation of a value kind.
Definition at line 25 of file DebugSupport.cpp.
References clang::dataflow::Value::AtomicBool, clang::dataflow::Value::FormulaBool, clang::dataflow::Value::Integer, clang::dataflow::Value::Pointer, clang::dataflow::Value::Record, and clang::dataflow::Value::TopBool.
Referenced by operator<<().
llvm::Expected< llvm::SmallVector< Diagnostic > > clang::dataflow::diagnoseFunction | ( | const FunctionDecl & | FuncDecl, |
ASTContext & | ASTCtx, | ||
llvm::function_ref< llvm::SmallVector< Diagnostic >(const CFGElement &, ASTContext &, const TransferStateForDiagnostics< typename AnalysisT::Lattice > &)> | Diagnoser, | ||
std::int64_t | MaxSATIterations = 1'000'000'000 |
||
) |
Runs a dataflow analysis over the given function and then runs Diagnoser
over the results.
Returns a list of diagnostics for FuncDecl
or an error. Currently, errors can occur (at least) because the analysis requires too many iterations over the CFG or the SAT solver times out.
The default value of MaxSATIterations
was chosen based on the following observations:
Definition at line 265 of file DataflowAnalysis.h.
References Analysis, clang::dataflow::ControlFlowContext::build(), Env, and runTypeErasedDataflowAnalysis().
|
static |
Definition at line 57 of file DataflowEnvironment.cpp.
References clang::dataflow::Value::Integer, clang::dataflow::Value::Pointer, and clang::dataflow::Value::Record.
Referenced by compareDistinctValues(), and widenDistinctValues().
|
static |
Definition at line 51 of file Transfer.cpp.
References Env, clang::dataflow::Environment::getBoolLiteralValue(), clang::dataflow::Environment::getValue(), clang::dataflow::Environment::makeAtomicBoolValue(), and clang::dataflow::Environment::makeIff().
|
static |
Definition at line 48 of file ControlFlowContext.cpp.
References clang::Block, clang::CFG::getEntry(), and clang::CFG::getNumBlockIDs().
Referenced by clang::dataflow::ControlFlowContext::build().
RecordStorageLocation * clang::dataflow::getBaseObjectLocation | ( | const MemberExpr & | ME, |
const Environment & | Env | ||
) |
Returns the storage location for the base object of a MemberExpr
, or null if none is defined in the environment.
Dereferences the pointer if the member expression was written using ->
.
Definition at line 1009 of file DataflowEnvironment.cpp.
References Env, clang::MemberExpr::getBase(), clang::dataflow::Environment::getStorageLocation(), clang::dataflow::Environment::getValue(), and clang::MemberExpr::isArrow().
std::vector< FieldDecl * > clang::dataflow::getFieldsForInitListExpr | ( | const RecordDecl * | RD | ) |
Returns the fields of RD
that are initialized by an InitListExpr
, in the order in which they appear in InitListExpr::inits()
.
Definition at line 1022 of file DataflowEnvironment.cpp.
References clang::RecordDecl::fields().
Referenced by getFieldsGlobalsAndFuncs().
|
static |
Definition at line 318 of file DataflowEnvironment.cpp.
References insertIfFunction(), and insertIfGlobal().
Referenced by getFieldsGlobalsAndFuncs().
|
static |
Traverses S
and inserts into Fields
, Vars
and Funcs
any fields, global variables and functions that are declared in or referenced from sub-statements.
Definition at line 335 of file DataflowEnvironment.cpp.
References clang::C, getFieldsForInitListExpr(), getFieldsGlobalsAndFuncs(), getMemberForAccessor(), insertIfFunction(), and insertIfGlobal().
RecordStorageLocation * clang::dataflow::getImplicitObjectLocation | ( | const CXXMemberCallExpr & | MCE, |
const Environment & | Env | ||
) |
Returns the storage location for the implicit object of a CXXMemberCallExpr
, or null if none is defined in the environment.
Dereferences the pointer if the member call expression was written using ->
.
Definition at line 995 of file DataflowEnvironment.cpp.
References Env, clang::CXXMemberCallExpr::getImplicitObjectArgument(), clang::dataflow::Environment::getStorageLocation(), clang::Expr::getType(), clang::dataflow::Environment::getValue(), and clang::Type::isPointerType().
|
static |
Definition at line 87 of file DataflowAnalysisContext.cpp.
References getKeys().
Referenced by clang::dataflow::DataflowAnalysisContext::createRecordStorageLocation(), and getKeys().
|
static |
Definition at line 302 of file DataflowEnvironment.cpp.
References clang::C.
Referenced by getFieldsGlobalsAndFuncs().
clang::dataflow::FieldSet clang::dataflow::getObjectFields | ( | QualType | Type | ) |
Returns the set of all fields in the type.
Gets the set of all fields in the type.
Definition at line 392 of file DataflowAnalysisContext.cpp.
References getFieldsFromClassHierarchy().
Referenced by clang::dataflow::DataflowAnalysisContext::getModeledFields().
|
static |
Definition at line 47 of file UncheckedOptionalAccessModel.cpp.
References clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::NamedDecl::getName(), clang::DeclarationName::isIdentifier(), and isTopLevelNamespaceWithName().
Skip past nodes that the CFG does not emit.
These nodes are invisible to flow-sensitive analysis, and should be ignored as they will effectively not exist.
ParenExpr
- The CFG takes the operator precedence into account, but otherwise omits the node afterwards.ExprWithCleanups
- The CFG will generate the appropriate calls to destructors and then omit the node. Definition at line 359 of file DataflowAnalysisContext.cpp.
Referenced by clang::dataflow::StmtToEnvMap::getEnvironment(), clang::dataflow::DataflowAnalysisContext::getStableStorageLocation(), clang::dataflow::Environment::getValue(), and ignoreCFGOmittedNodes().
Definition at line 370 of file DataflowAnalysisContext.cpp.
References ignoreCFGOmittedNodes().
|
static |
Definition at line 296 of file DataflowEnvironment.cpp.
Referenced by getFieldsGlobalsAndFuncs().
|
static |
Initializes a global storage value.
Definition at line 289 of file DataflowEnvironment.cpp.
References V.
Referenced by getFieldsGlobalsAndFuncs().
|
static |
Returns a map consisting of key-value entries that are present in both maps.
Definition at line 39 of file DataflowEnvironment.cpp.
References clang::Result.
Referenced by clang::dataflow::Environment::join().
Definition at line 61 of file TypeErasedDataflowAnalysis.cpp.
References clang::CFGBlock::getLoopTarget().
Referenced by runTypeErasedDataflowAnalysis().
bool clang::dataflow::isCheckLikeMethod | ( | llvm::SmallDenseSet< const CXXMethodDecl * > & | CheckDecls, |
const CXXMethodDecl & | D | ||
) |
Determines whether D
is one of the methods used to implement Chromium's CHECK
macros.
Populates CheckDecls
, if empty.
Definition at line 19 of file ChromiumCheckModel.cpp.
References clang::Decl::getDeclContext(), clang::NamedDecl::getDeclName(), clang::NamedDecl::getName(), clang::CXXMethodDecl::getParent(), clang::DeclarationName::isIdentifier(), clang::CXXMethodDecl::isStatic(), and clang::CXXRecordDecl::methods().
Referenced by clang::dataflow::ChromiumCheckModel::transfer().
Definition at line 69 of file WatchedLiteralsSolver.cpp.
Referenced by clang::dataflow::CNFFormulaBuilder::addClause().
Definition at line 67 of file WatchedLiteralsSolver.cpp.
Referenced by clang::dataflow::CNFFormulaBuilder::addClause().
|
static |
Definition at line 41 of file UncheckedOptionalAccessModel.cpp.
References clang::NamedDecl::getDeclName(), clang::NamedDecl::getName(), clang::DeclContext::getParent(), clang::DeclarationName::isIdentifier(), and clang::DeclContext::isTranslationUnit().
Referenced by hasOptionalClassName().
|
static |
Definition at line 221 of file DataflowEnvironment.cpp.
References areEquivalentValues(), clang::dataflow::StorageLocation::getType(), mergeDistinctValues(), and clang::Result.
Referenced by clang::dataflow::Environment::join().
|
static |
Definition at line 306 of file DataflowAnalysisContext.cpp.
References DataflowLog(), clang::File, and makeLoggerFromCommandLine().
Referenced by clang::dataflow::DataflowAnalysisContext::DataflowAnalysisContext(), and makeLoggerFromCommandLine().
|
static |
Definition at line 77 of file Transfer.cpp.
References Env, clang::dataflow::Environment::getStorageLocation(), clang::dataflow::Environment::getValue(), clang::dataflow::Environment::setValue(), and unpackValue().
|
static |
Attempts to merge distinct values Val1
and Val2
in Env1
and Env2
, respectively, of the same type Type
.
Merging generally produces a single value that (soundly) approximates the two inputs, although the actual meaning depends on Model
.
Definition at line 93 of file DataflowEnvironment.cpp.
References clang::dataflow::Environment::arena(), clang::dataflow::Environment::assume(), clang::dataflow::Environment::create(), clang::dataflow::Environment::createValue(), clang::dataflow::Environment::getFlowConditionToken(), clang::dataflow::Arena::makeAtomRef(), and clang::dataflow::Environment::ValueModel::merge().
Referenced by clang::dataflow::Environment::join(), and joinLocToVal().
Returns the negative literal !V
.
Definition at line 72 of file WatchedLiteralsSolver.cpp.
References V.
Referenced by buildCNF(), clang::dataflow::WatchedLiteralsSolverImpl::solve(), and clang::dataflow::WatchedLiteralsSolverImpl::WatchedLiteralsSolverImpl().
Returns the negated literal !L
.
Definition at line 75 of file WatchedLiteralsSolver.cpp.
llvm::raw_ostream & clang::dataflow::operator<< | ( | llvm::raw_ostream & | OS, |
const Solver::Result & | R | ||
) |
Definition at line 66 of file DebugSupport.cpp.
References debugString(), clang::dataflow::Solver::Result::getSolution(), and clang::dataflow::Solver::Result::getStatus().
llvm::raw_ostream & clang::dataflow::operator<< | ( | llvm::raw_ostream & | OS, |
Solver::Result::Assignment | Assignment | ||
) |
Definition at line 43 of file DebugSupport.cpp.
References clang::dataflow::Solver::Result::AssignedFalse, and clang::dataflow::Solver::Result::AssignedTrue.
|
inline |
|
inline |
Definition at line 124 of file Formula.h.
References clang::dataflow::Formula::print().
raw_ostream & clang::dataflow::operator<< | ( | raw_ostream & | OS, |
const Value & | Val | ||
) |
std::ostream & clang::dataflow::operator<< | ( | std::ostream & | Os, |
const clang::dataflow::MapLattice< Key, ElementLattice > & | M | ||
) |
Definition at line 115 of file MapLattice.h.
std::ostream & clang::dataflow::operator<< | ( | std::ostream & | Os, |
const clang::dataflow::VarMapLattice< ElementLattice > & | M | ||
) |
Definition at line 128 of file MapLattice.h.
|
inline |
Definition at line 34 of file NoopLattice.h.
Returns the positive literal V
.
Definition at line 65 of file WatchedLiteralsSolver.cpp.
References V.
Referenced by buildCNF(), clang::dataflow::WatchedLiteralsSolverImpl::solve(), and clang::dataflow::WatchedLiteralsSolverImpl::WatchedLiteralsSolverImpl().
|
static |
Definition at line 236 of file DataflowAnalysisContext.cpp.
References printAtomList().
Referenced by clang::dataflow::DataflowAnalysisContext::dumpFlowCondition(), and printAtomList().
|
static |
Definition at line 53 of file SimplifyConstraints.cpp.
References clang::Result.
Referenced by simplifyConstraints().
|
static |
Definition at line 99 of file Transfer.cpp.
References Env, clang::dataflow::Environment::getStorageLocation(), and clang::dataflow::Environment::setStorageLocation().
Referenced by propagateValueOrStorageLocation().
|
static |
Definition at line 94 of file Transfer.cpp.
References Env, clang::dataflow::Environment::getValue(), and clang::dataflow::Environment::setValue().
Referenced by propagateValueOrStorageLocation().
|
static |
Definition at line 108 of file Transfer.cpp.
References Env, clang::Expr::isGLValue(), propagateStorageLocation(), and propagateValue().
bool clang::dataflow::recordsEqual | ( | const RecordStorageLocation & | Loc1, |
const Environment & | Env1, | ||
const RecordStorageLocation & | Loc2, | ||
const Environment & | Env2 | ||
) |
Returns whether the records Loc1
and Loc2
are equal.
Values for Loc1
are retrieved from Env1
, and values for Loc2
are retrieved from Env2
. A convenience overload retrieves values for Loc1
and Loc2
from the same environment.
This performs a deep comparison, i.e. it compares every field (including synthetic fields) and recurses on fields of record type. Fields of reference type compare equal if they refer to the same storage location. If RecordValue
s are associated with Loc1
and Loc2, it also compares the properties on those
RecordValue`s.
Note on how to interpret the result:
Requirements:
Src
and Dst
must have the same canonical unqualified type.
Definition at line 84 of file RecordOps.cpp.
References clang::dataflow::RecordStorageLocation::children(), clang::QualType::getCanonicalType(), clang::dataflow::RecordStorageLocation::getChild(), clang::dataflow::RecordStorageLocation::getSyntheticField(), clang::dataflow::StorageLocation::getType(), clang::QualType::getUnqualifiedType(), clang::dataflow::Environment::getValue(), recordsEqual(), and clang::dataflow::RecordStorageLocation::synthetic_fields().
Referenced by recordsEqual().
|
inline |
Definition at line 67 of file RecordOps.h.
References Env, and recordsEqual().
RecordValue & clang::dataflow::refreshRecordValue | ( | const Expr & | Expr, |
Environment & | Env | ||
) |
Associates a new RecordValue
with Expr
and returns the new value.
See also documentation for the overload above.
Definition at line 1040 of file DataflowEnvironment.cpp.
References clang::dataflow::Environment::create(), clang::dataflow::Environment::createValue(), Env, clang::dataflow::Environment::getStorageLocation(), clang::Expr::getType(), clang::dataflow::Environment::getValue(), clang::Expr::isPRValue(), clang::Type::isRecordType(), clang::dataflow::Environment::setStorageLocation(), and clang::dataflow::Environment::setValue().
RecordValue & clang::dataflow::refreshRecordValue | ( | RecordStorageLocation & | Loc, |
Environment & | Env | ||
) |
Associates a new RecordValue
with Loc
and returns the new value.
It is not defined whether the field values remain the same or not.
This function is primarily intended for use by checks that set custom properties on RecordValue
s to model the state of these values. Such checks should avoid modifying the properties of an existing RecordValue
because these changes would be visible to other Environment
s that share the same RecordValue
. Instead, call refreshRecordValue()
, then set the properties on the new RecordValue
that it returns. Typical usage:
refreshRecordValue(Loc, Env).setProperty("my_prop", MyPropValue);
Definition at line 1034 of file DataflowEnvironment.cpp.
References clang::dataflow::Environment::create(), Env, and clang::dataflow::Environment::setValue().
llvm::Expected< std::vector< std::optional< DataflowAnalysisState< typename AnalysisT::Lattice > > > > clang::dataflow::runDataflowAnalysis | ( | const ControlFlowContext & | CFCtx, |
AnalysisT & | Analysis, | ||
const Environment & | InitEnv, | ||
std::function< void(const CFGElement &, const DataflowAnalysisState< typename AnalysisT::Lattice > &)> | PostVisitCFG = nullptr |
||
) |
Performs dataflow analysis and returns a mapping from basic block IDs to dataflow analysis states that model the respective basic blocks.
The returned vector, if any, will have the same size as the number of CFG blocks, with indices corresponding to basic block IDs. Returns an error if the dataflow analysis cannot be performed successfully. Otherwise, calls PostVisitCFG
on each CFG element with the final analysis results at that program point.
Definition at line 192 of file DataflowAnalysis.h.
References Analysis, BlockStates, CFCtx, InitEnv, and runTypeErasedDataflowAnalysis().
llvm::Expected< std::vector< std::optional< TypeErasedDataflowAnalysisState > > > clang::dataflow::runTypeErasedDataflowAnalysis | ( | const ControlFlowContext & | CFCtx, |
TypeErasedDataflowAnalysis & | Analysis, | ||
const Environment & | InitEnv, | ||
std::function< void(const CFGElement &, const TypeErasedDataflowAnalysisState &)> | PostVisitCFG = nullptr |
||
) |
Performs dataflow analysis and returns a mapping from basic block IDs to dataflow analysis states that model the respective basic blocks.
Indices of the returned vector correspond to basic block IDs. Returns an error if the dataflow analysis cannot be performed successfully. Otherwise, calls PostVisitCFG
on each CFG element with the final analysis results at that program point.
Definition at line 496 of file TypeErasedDataflowAnalysis.cpp.
References Analysis, clang::Block, BlockStates, clang::dataflow::Environment::callStackSize(), CFCtx, clang::DataflowWorklistBase< Comp, QueueSize >::dequeue(), clang::dataflow::Environment::dump(), clang::ForwardDataflowWorklist::enqueueSuccessors(), clang::dataflow::TypeErasedDataflowAnalysisState::Env, clang::dataflow::Environment::fork(), clang::CFGBlock::getBlockID(), clang::dataflow::ControlFlowContext::getCFG(), clang::CFG::getEntry(), InitEnv, clang::dataflow::Environment::initialize(), isBackedgeNode(), clang::dataflow::TypeErasedDataflowAnalysis::isEqualTypeErased(), clang::dataflow::TypeErasedDataflowAnalysisState::Lattice, clang::CFG::size(), transferCFGBlock(), clang::dataflow::TypeErasedDataflowAnalysis::typeErasedInitialElement(), Unchanged, clang::dataflow::Environment::widen(), and clang::dataflow::TypeErasedDataflowAnalysis::widenTypeErased().
Referenced by diagnoseFunction(), and runDataflowAnalysis().
|
static |
Definition at line 39 of file Formula.cpp.
References clang::dataflow::Formula::And, clang::dataflow::Formula::AtomRef, clang::dataflow::Formula::Equal, clang::dataflow::Formula::Implies, clang::dataflow::Formula::Literal, clang::dataflow::Formula::Not, and clang::dataflow::Formula::Or.
Referenced by clang::dataflow::Formula::print().
void clang::dataflow::simplifyConstraints | ( | llvm::SetVector< const Formula * > & | Constraints, |
Arena & | arena, | ||
SimplifyConstraintsInfo * | Info = nullptr |
||
) |
Simplifies a set of constraints (implicitly connected by "and") in a way that does not change satisfiability of the constraints.
This does not mean that the set of solutions is the same before and after simplification. Info
, if non-null, will be populated with information about the simplifications that were made to the formula (e.g. to display to the user).
Definition at line 75 of file SimplifyConstraints.cpp.
References clang::dataflow::Formula::And, clang::dataflow::Formula::AtomRef, atomsInEquivalenceClass(), clang::dataflow::Formula::Equal, clang::dataflow::SimplifyConstraintsInfo::EquivalentAtoms, clang::dataflow::SimplifyConstraintsInfo::FalseAtoms, clang::dataflow::Formula::kind(), clang::dataflow::Arena::makeAtomRef(), clang::dataflow::Arena::makeLiteral(), clang::dataflow::Formula::Not, clang::dataflow::Formula::operands(), projectToLeaders(), substitute(), and clang::dataflow::SimplifyConstraintsInfo::TrueAtoms.
Referenced by clang::dataflow::DataflowAnalysisContext::dumpFlowCondition().
|
static |
Definition at line 18 of file SimplifyConstraints.cpp.
References clang::dataflow::Formula::And, clang::dataflow::Formula::AtomRef, clang::dataflow::Formula::Equal, clang::dataflow::Formula::getAtom(), clang::dataflow::Formula::Implies, clang::dataflow::Formula::kind(), clang::dataflow::Formula::Literal, clang::dataflow::Arena::makeAnd(), clang::dataflow::Arena::makeEquals(), clang::dataflow::Arena::makeImplies(), clang::dataflow::Arena::makeNot(), clang::dataflow::Arena::makeOr(), clang::dataflow::Formula::Not, clang::dataflow::Formula::operands(), clang::dataflow::Formula::Or, and substitute().
Referenced by simplifyConstraints(), and substitute().
void clang::dataflow::transfer | ( | const StmtToEnvMap & | StmtToEnv, |
const Stmt & | S, | ||
Environment & | Env | ||
) |
Evaluates S
and updates Env
accordingly.
Requirements:
S
must not be ParenExpr
or ExprWithCleanups
.
Definition at line 824 of file Transfer.cpp.
References Env.
Referenced by builtinTransferStatement(), and clang::dataflow::DataflowAnalysis< Derived, LatticeT >::transferTypeErased().
|
static |
Transfers State
by evaluating each element in the Block
based on the AC.Analysis
specified.
Built-in transfer functions (if the option for ApplyBuiltinTransfer
is set by the analysis) will be applied to the element before evaluation by the user-specified analysis. PostVisitCFG
(if provided) will be applied to the element after evaluation by the user-specified analysis.
Definition at line 465 of file TypeErasedDataflowAnalysis.cpp.
References clang::Block, builtinTransfer(), and computeBlockInputState().
Referenced by runTypeErasedDataflowAnalysis().
|
static |
Definition at line 66 of file Transfer.cpp.
References clang::dataflow::DataflowAnalysisContext::arena(), Env, clang::dataflow::Environment::getDataflowAnalysisContext(), clang::dataflow::Arena::makeBoolValue(), and V.
Referenced by maybeUnpackLValueExpr().
Definition at line 856 of file UncheckedOptionalAccessModel.cpp.
References clang::Type::getAsCXXRecordDecl().
Referenced by clang::dataflow::UncheckedOptionalAccessModel::UncheckedOptionalAccessModel().
Returns the variable of L
.
Definition at line 78 of file WatchedLiteralsSolver.cpp.
Referenced by clang::dataflow::CNFFormulaBuilder::addClause().
|
static |
Definition at line 155 of file DataflowEnvironment.cpp.
References clang::dataflow::Environment::arena(), equateUnknownValues(), clang::dataflow::Environment::getBoolLiteralValue(), clang::dataflow::Value::getKind(), clang::dataflow::Arena::makeNot(), clang::dataflow::Environment::makeTopBoolValue(), clang::dataflow::Environment::proves(), and clang::dataflow::Environment::ValueModel::widen().
Referenced by widenKeyToValueMap().
llvm::MapVector< Key, Value * > clang::dataflow::widenKeyToValueMap | ( | const llvm::MapVector< Key, Value * > & | CurMap, |
const llvm::MapVector< Key, Value * > & | PrevMap, | ||
Environment & | CurEnv, | ||
const Environment & | PrevEnv, | ||
Environment::ValueModel & | Model, | ||
LatticeJoinEffect & | Effect | ||
) |
Definition at line 256 of file DataflowEnvironment.cpp.
References areEquivalentValues(), Changed, and widenDistinctValues().
Referenced by clang::dataflow::Environment::widen().
|
staticconstexpr |
Definition at line 35 of file DataflowEnvironment.cpp.
|
staticconstexpr |
Definition at line 36 of file DataflowEnvironment.cpp.
Referenced by clang::dataflow::Environment::createValue().
|
staticconstexpr |
A null clause identifier is used as a placeholder in various data structures and algorithms.
Definition at line 85 of file WatchedLiteralsSolver.cpp.
|
staticconstexpr |
A null literal is used as a placeholder in various data structures and algorithms.
Definition at line 62 of file WatchedLiteralsSolver.cpp.
Referenced by clang::dataflow::CNFFormulaBuilder::addClause(), and clang::dataflow::CNFFormula::addClause().
|
staticconstexpr |
A null boolean variable is used as a placeholder in various data structures and algorithms.
Definition at line 52 of file WatchedLiteralsSolver.cpp.
Referenced by clang::dataflow::WatchedLiteralsSolverImpl::WatchedLiteralsSolverImpl().