clang: clang::dataflow Namespace Reference (original) (raw)
Dataflow Directional Tag Classes. More...
| Classes | |
|---|---|
| class | AdornedCFG |
| Holds CFG with additional information derived from it that is needed to perform dataflow analysis. More... | |
| class | AnalysisASTVisitor |
| Specialization of RecursiveASTVisitor that visits those nodes that are relevant to the dataflow analysis; generally, these are the ones that also appear in the CFG. More... | |
| 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 | CachedConstAccessorsLattice |
| A mixin for a lattice that additionally maintains a cache of stable method call return values to model const accessors methods. More... | |
| struct | CFGEltCallbacks |
| A pair of callbacks to be called with the state before and after visiting a CFG element. More... | |
| struct | CFGEltCallbacksTypeErased |
| A pair of callbacks to be called with the state before and after visiting a CFG element. 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... | |
| class | CNFFormula |
| A boolean formula in 3-CNF (conjunctive normal form with at most 3 literals per clause). More... | |
| struct | ContextSensitiveOptions |
| 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... | |
| struct | DiagnosisCallbacks |
| A pair of callbacks for performing diagnosis on a CFG element, called with the state before and after visiting that CFG element. 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 | RecordInitListHelper |
| Helper class for initialization of a record with an InitListExpr. More... | |
| class | RecordStorageLocation |
| A storage location for a record (struct, class, or union). More... | |
| struct | ReferencedDecls |
| A collection of several types of declarations, all referenced from the same function. More... | |
| class | ReferencedDeclsVisitor |
| class | ScalarStorageLocation |
| A storage location that is not subdivided further for the purposes of abstract interpretation. More... | |
| struct | SimpleLogicalContext |
| A simple representation of essential elements of the logical context used in environments. 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 |
| struct | UncheckedOptionalAccessDiagnostic |
| Diagnostic information for an unchecked optional access. More... | |
| 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... | |
| struct | WidenResult |
| The result of a widen operation. More... |
| Typedefs | |
|---|---|
| using | FieldSet = llvm::SmallSetVector<const FieldDecl *, 4> |
| A set of FieldDecl *. | |
| template<typename State, typename Result = void> | |
| using | CFGMatchSwitch |
| 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. | |
| template | |
| using | CFGEltCallback |
| A callback to be called with the state before or after visiting a CFG element. | |
| template<typename AnalysisT, typename Diagnostic> | |
| using | DiagnosisCallback |
| A callback for performing diagnosis on a CFG element, called with the state before or after visiting that CFG element. | |
| using | LatticeJoinEffect = LatticeEffect |
| template | |
| 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 |
| template<typename BaseT, typename State, typename Result = void> | |
| using | ASTMatchSwitch |
| using | UncheckedOptionalAccessLattice = CachedConstAccessorsLattice<NoopLattice> |
| using | CFGEltCallbackTypeErased |
| A callback to be called with the state before or after visiting a CFG element. |
| Enumerations | |
|---|---|
| enum class | ComparisonResult { Same, Different, Unknown } |
| Indicates the result of a tentative comparison. More... | |
| enum class | LatticeEffect { Unchanged, Changed } |
| Effect indicating whether a lattice operation resulted in a new value. More... | |
| enum class | Atom : unsigned |
| Identifies an atomic boolean variable such as "V1". More... |
| Functions | |
|---|---|
| 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. | |
| ReferencedDecls | getReferencedDecls (const FunctionDecl &FD) |
| Returns declarations that are declared in or referenced from FD. | |
| ReferencedDecls | getReferencedDecls (const Stmt &S) |
| Returns declarations that are declared in or referenced from S. | |
| constexpr Literal | posLit (Variable V) |
| Returns the positive literal V. | |
| constexpr Literal | negLit (Variable V) |
| Returns the negative literal !V. | |
| constexpr bool | isPosLit (Literal L) |
| Returns whether L is a positive literal. | |
| constexpr bool | isNegLit (Literal L) |
| Returns whether L is a negative literal. | |
| constexpr Literal | notLit (Literal L) |
| Returns the negated literal !L. | |
| constexpr Variable | var (Literal L) |
| Returns the variable of L. | |
| CNFFormula | buildCNF (const llvm::ArrayRef< const Formula * > &Formulas, llvm::DenseMap< Variable, Atom > &Atomics) |
| Converts the conjunction of Vals into a formula in conjunctive normal form where each clause has at least one and at most three literals. | |
| template | |
| llvm::Expected< std::vector< std::optional< DataflowAnalysisState< typename AnalysisT::Lattice > > > > | runDataflowAnalysis (const AdornedCFG &ACFG, AnalysisT &Analysis, const Environment &InitEnv, CFGEltCallbacks< AnalysisT > PostAnalysisCallbacks={}, std::int32_t MaxBlockVisits=kDefaultMaxBlockVisits) |
| Performs dataflow analysis and returns a mapping from basic block IDs to dataflow analysis states that model the respective basic blocks. | |
| template | |
| 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, DiagnosisCallbacks< AnalysisT, Diagnostic > Diagnoser, std::int64_t MaxSATIterations=kDefaultMaxSATIterations, std::int32_t MaxBlockVisits=kDefaultMaxBlockVisits) |
| Runs a dataflow analysis over the given function and then runs Diagnoser over the results. | |
| template<typename AnalysisT, typename Diagnostic> | |
| llvm::Expected< llvm::SmallVector< Diagnostic > > | diagnoseFunction (const FunctionDecl &FuncDecl, ASTContext &ASTCtx, DiagnosisCallback< AnalysisT, Diagnostic > Diagnoser, std::int64_t MaxSATIterations=kDefaultMaxSATIterations, std::int32_t MaxBlockVisits=kDefaultMaxBlockVisits) |
| Overload that takes only one diagnosis callback, which is run on the state after visiting the CFGElement. | |
| 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. | |
| 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) |
| void | serializeFormula (const Formula &F, llvm::raw_ostream &OS) |
| Prints F to OS in a compact format, optimized for easy parsing (deserialization) rather than human use. | |
| llvm::Expected< const Formula * > | parseFormula (llvm::StringRef Str, Arena &A, llvm::DenseMap< unsigned, Atom > &AtomMap) |
| Parses Str to build a serialized Formula. | |
| template<typename Key, typename ElementLattice> | |
| std::ostream & | operator<< (std::ostream &Os, const clang::dataflow::MapLattice< Key, ElementLattice > &M) |
| template | |
| 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, QualType TypeToCopy=QualType()) |
| 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. | |
| ast_matchers::StatementMatcher | isPointerLikeOperatorStar () |
| Matchers: For now, these match on any class with an operator* or operator-> where the return types have a similar shape as std::unique_ptr and std::optional. | |
| ast_matchers::StatementMatcher | isSmartPointerLikeOperatorStar () |
| ast_matchers::StatementMatcher | isPointerLikeOperatorArrow () |
| ast_matchers::StatementMatcher | isSmartPointerLikeOperatorArrow () |
| ast_matchers::StatementMatcher | isSmartPointerLikeValueMethodCall (clang::StringRef MethodName="value") |
| ast_matchers::StatementMatcher | isSmartPointerLikeGetMethodCall (clang::StringRef MethodName="get") |
| const FunctionDecl * | getCanonicalSmartPointerLikeOperatorCallee (const CallExpr *CE) |
| Returns the "canonical" callee for smart pointer operators (* and ->) as a key for caching. | |
| template | |
| void | transferSmartPointerLikeCachedDeref (const CallExpr *DerefExpr, RecordStorageLocation *SmartPointerLoc, TransferState< LatticeT > &State, llvm::function_ref< void(StorageLocation &)> InitializeLoc) |
| A transfer function for operator* (and value) calls that can be cached. | |
| template | |
| void | transferSmartPointerLikeCachedGet (const CallExpr *GetExpr, RecordStorageLocation *SmartPointerLoc, TransferState< LatticeT > &State, llvm::function_ref< void(StorageLocation &)> InitializeLoc) |
| A transfer function for operator-> (and get) calls that can be cached. | |
| 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, Environment::ValueModel &Model) |
| Evaluates S and updates Env accordingly. | |
| llvm::Expected< std::vector< std::optional< TypeErasedDataflowAnalysisState > > > | runTypeErasedDataflowAnalysis (const AdornedCFG &ACFG, TypeErasedDataflowAnalysis &Analysis, const Environment &InitEnv, const CFGEltCallbacksTypeErased &PostAnalysisCallbacks, std::int32_t MaxBlockVisits) |
| 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 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) |
| static llvm::DenseSet< const CFGBlock * > | buildContainsExprConsumedInDifferentBlock (const CFG &Cfg, const internal::StmtToBlockMap &StmtToBlock) |
| static std::pair< const Formula *, const Formula * > | canonicalFormulaPair (const Formula &LHS, const Formula &RHS) |
| template<class Key, class ComputeFunc> | |
| static const Formula & | cached (llvm::DenseMap< Key, const Formula * > &Cache, Key K, ComputeFunc &&Compute) |
| static void | getFieldsFromClassHierarchy (QualType Type, FieldSet &Fields) |
| template | |
| static std::vector< const FieldDecl * > | getFieldsForInitListExpr (const InitListT *InitList) |
| Returns the fields of a RecordDecl that are initialized by an InitListExpr or CXXParenListInitExpr, in the order in which they appear in InitListExpr::inits() / CXXParenListInitExpr::getInitExprs(). | |
| static void | insertIfGlobal (const Decl &D, llvm::SetVector< const VarDecl * > &Globals) |
| static void | insertIfLocal (const Decl &D, llvm::SetVector< const VarDecl * > &Locals) |
| static void | insertIfFunction (const Decl &D, llvm::SetVector< const FunctionDecl * > &Funcs) |
| static MemberExpr * | getMemberForAccessor (const CXXMemberCallExpr &C) |
| template<typename T> | |
| static llvm::DenseSet< llvm::StringRef > | getKeys (const llvm::StringMap< T > &Map) |
| static void | getReferencedAtoms (const Formula &F, llvm::DenseSet< dataflow::Atom > &Refs) |
| 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. | |
| template | |
| static MapT | joinExprMaps (const MapT &Map1, const MapT &Map2) |
| 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 * | joinDistinctValues (QualType Type, Value &Val1, const Environment &Env1, Value &Val2, const Environment &Env2, Environment &JoinedEnv, Environment::ValueModel &Model) |
| Attempts to join distinct values Val1 and Val2 in Env1 and Env2, respectively, of the same type Type. | |
| static WidenResult | widenDistinctValues (QualType Type, Value &Prev, const Environment &PrevEnv, Value &Current, Environment &CurrentEnv, Environment::ValueModel &Model) |
| template | |
| static 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 | |
| static 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, LatticeEffect &Effect) |
| static llvm::StringLiteral | sigil (Formula::Kind K) |
| static char | compactSigil (Formula::Kind K) |
| static llvm::Expected< const Formula * > | parsePrefix (llvm::StringRef &Str, Arena &A, llvm::DenseMap< unsigned, Atom > &AtomMap) |
| static 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. | |
| template<class... NameTypes> | |
| static bool | isFullyQualifiedNamespaceEqualTo (const NamespaceDecl &NS, llvm::StringRef Name, NameTypes... Names) |
| static bool | hasOptionalClassName (const CXXRecordDecl &RD) |
| static const CXXRecordDecl * | getOptionalBaseClass (const CXXRecordDecl *RD) |
| static bool | isSupportedOptionalType (QualType Ty) |
| static void | copyField (const ValueDecl &Field, StorageLocation *SrcFieldLoc, StorageLocation *DstFieldLoc, RecordStorageLocation &Dst, Environment &Env) |
| static void | copySyntheticField (QualType FieldType, StorageLocation &SrcFieldLoc, StorageLocation &DstFieldLoc, Environment &Env) |
| 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, const Atom &At) |
| 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 const Expr * | getTerminatorCondition (const Stmt *TerminatorStmt) |
| 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 (unsigned CurBlockID, 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 (unsigned CurBlockID, const CFGElement &Elt, TypeErasedDataflowAnalysisState &State, AnalysisContext &AC) |
| static TypeErasedDataflowAnalysisState | transferCFGBlock (const CFGBlock &Block, AnalysisContext &AC, const CFGEltCallbacksTypeErased &PostAnalysisCallbacks={}) |
| Transfers State by evaluating each element in the Block based on the AC.Analysis specified. | |
| static bool | areEquivalentIndirectionValues (const Value &Val1, const Value &Val2) |
| internal::Matcher< NamedDecl > | hasName (StringRef Name) |
| Matches NamedDecl nodes that have the specified name. | |
| internal::PolymorphicMatcher< internal::HasOverloadedOperatorNameMatcher, AST_POLYMORPHIC_SUPPORTED_TYPES(CXXOperatorCallExpr, FunctionDecl), std::vector< std::string > > | hasOverloadedOperatorName (StringRef Name) |
| Matches overloaded operator names. |
| Variables | |
|---|---|
| constexpr Variable | NullVar = 0 |
| A null boolean variable is used as a placeholder in various data structures and algorithms. | |
| constexpr Literal | NullLit = 0 |
| A null literal is used as a placeholder in various data structures and algorithms. | |
| constexpr ClauseID | NullClause = 0 |
| A null clause identifier is used as a placeholder in various data structures and algorithms. | |
| constexpr std::int64_t | kDefaultMaxSATIterations = 1'000'000'000 |
| Default for the maximum number of SAT solver iterations during analysis. | |
| constexpr std::int32_t | kDefaultMaxBlockVisits = 20'000 |
| Default for the maximum number of block visits during analysis. | |
| static constexpr int | MaxCompositeValueDepth = 3 |
| static constexpr int | MaxCompositeValueSize = 1000 |
| const internal::VariadicDynCastAllOfMatcher< Stmt, CXXMemberCallExpr > | cxxMemberCallExpr |
| Matches member call expressions. | |
| const internal::VariadicDynCastAllOfMatcher< Decl, CXXMethodDecl > | cxxMethodDecl |
| Matches method declarations. | |
| const internal::VariadicDynCastAllOfMatcher< Stmt, CXXOperatorCallExpr > | cxxOperatorCallExpr |
| Matches overloaded operator calls. | |
| const AstTypeMatcher< PointerType > | pointerType |
| const AstTypeMatcher< ReferenceType > | referenceType |
Dataflow Directional Tag Classes.
These are used for tag dispatching within the dataflow solver/transfer functions to determine what direction a dataflow analysis flows.
◆ ASTMatchSwitch
template<typename BaseT, typename State, typename Result = void>
Initial value:
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
@ Result
The result type of a method or function.
int const char * function
Definition at line 72 of file MatchSwitch.h.
◆ CFGEltCallback
template
Initial value:
Represents a top-level expression in a basic block.
A callback to be called with the state before or after visiting a CFG element.
Definition at line 184 of file DataflowAnalysis.h.
◆ CFGEltCallbackTypeErased
Initial value:
Type-erased model of the program at a given program point.
A callback to be called with the state before or after visiting a CFG element.
Definition at line 137 of file TypeErasedDataflowAnalysis.h.
◆ CFGMatchSwitch
template<typename State, typename Result = void>
◆ ClauseID
using clang::dataflow::ClauseID = uint32_t
Clause identifiers are represented as positive integers.
Definition at line 42 of file CNFFormula.h.
◆ DiagnosisCallback
Initial value:
llvm::function_ref<llvm::SmallVector(
A read-only version of TransferState.
A callback for performing diagnosis on a CFG element, called with the state before or after visiting that CFG element.
Returns a list of diagnostics to emit (if any).
Definition at line 200 of file DataflowAnalysis.h.
◆ FieldSet
◆ LatticeJoinEffect
◆ Literal
using clang::dataflow::Literal = 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 35 of file CNFFormula.h.
◆ MatchSwitchAction
template<typename T, typename State, typename Result = void>
Initial value:
const FunctionProtoType * T
Contains all information for a given match.
Definition at line 68 of file MatchSwitch.h.
◆ MatchSwitchMatcher
template<typename T>
using clang::dataflow::MatchSwitchMatcher = ast_matchers::internal::Matcher<T>
◆ UncheckedOptionalAccessLattice
◆ Variable
using clang::dataflow::Variable = uint32_t
Boolean variables are represented as positive integers.
Definition at line 25 of file CNFFormula.h.
◆ VarMapLattice
template
Convenience alias that captures the common use of map lattices to model in-scope variables.
Definition at line 112 of file MapLattice.h.
◆ Atom
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:
- V1 may mean "the program reaches this point",
- V2 may mean "the parameter was null"
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.
Definition at line 34 of file Formula.h.
◆ ComparisonResult
Indicates the result of a tentative comparison.
| Enumerator |
|---|
| Same |
| Different |
| Unknown |
Definition at line 44 of file DataflowEnvironment.h.
◆ LatticeEffect
Effect indicating whether a lattice operation resulted in a new value.
| Enumerator |
|---|
| Unchanged |
| Changed |
Definition at line 21 of file DataflowLattice.h.
◆ areEquivalentIndirectionValues()
| bool clang::dataflow::areEquivalentIndirectionValues ( const Value & Val1, const Value & Val2 ) | static |
|---|
◆ areEquivalentValues()
| bool clang::dataflow::areEquivalentValues | ( | const Value & | Val1, |
|---|---|---|---|
| const Value & | Val2 ) |
◆ atomsInEquivalenceClass()
| llvm::SmallVector< Atom > clang::dataflow::atomsInEquivalenceClass ( const llvm::EquivalenceClasses< Atom > & EquivalentAtoms, const Atom & At ) | static |
|---|
◆ blockIndexInPredecessor()
◆ buildCNF()
Converts the conjunction of Vals into a formula in conjunctive normal form where each clause has at least one and at most three literals.
Atomics is populated with a mapping from Variables to the corresponding [Atom](#a34cd8db4595e927c9c56f1d665762e05 "Identifies an atomic boolean variable such as "V1".")s for atomic booleans in the input formulas.
Definition at line 115 of file CNFFormula.cpp.
References clang::dataflow::CNFFormula::addClause(), clang::dataflow::Formula::And, clang::dataflow::Formula::AtomRef, clang::C, clang::dataflow::CNFFormula::clauseLiterals(), clang::dataflow::CNFFormula::clauseSize(), clang::dataflow::Formula::Equal, clang::dataflow::Formula::getAtom(), clang::dataflow::Formula::Implies, clang::dataflow::Formula::kind(), clang::dataflow::Formula::Literal, clang::dataflow::Formula::literal(), negLit(), clang::dataflow::Formula::Not, clang::dataflow::CNFFormula::numClauses(), clang::dataflow::Formula::operands(), clang::dataflow::Formula::Or, and posLit().
◆ buildContainsExprConsumedInDifferentBlock()
◆ buildStmtToBasicBlockMap()
| llvm::DenseMap< const Stmt *, const CFGBlock * > clang::dataflow::buildStmtToBasicBlockMap ( const CFG & Cfg) | static |
|---|
◆ builtinTransfer()
◆ builtinTransferInitializer()
Built-in transfer function for CFGInitializer.
Definition at line 339 of file TypeErasedDataflowAnalysis.cpp.
References builtinTransferInitializer(), clang::cast(), clang::IndirectFieldDecl::chain(), clang::dataflow::TypeErasedDataflowAnalysisState::Env, clang::dataflow::RecordStorageLocation::getChild(), clang::CFGInitializer::getInitializer(), clang::dataflow::Environment::getThisPointeeStorageLocation(), clang::Init, clang::Member, and clang::dataflow::RecordStorageLocation::setChild().
Referenced by builtinTransfer(), and builtinTransferInitializer().
◆ builtinTransferStatement()
◆ cached()
template<class Key, class ComputeFunc>
| const Formula & clang::dataflow::cached ( llvm::DenseMap< Key, const Formula * > & Cache, Key K, ComputeFunc && Compute ) | static |
|---|
◆ canonicalFormulaPair()
◆ compactSigil()
◆ compareDistinctValues()
◆ compareKeyToValueMaps()
◆ computeBlockInputState()
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 233 of file TypeErasedDataflowAnalysis.cpp.
References clang::Block, clang::dataflow::AdornedCFG::blockForStmt(), blockIndexInPredecessor(), clang::dataflow::TypeErasedDataflowAnalysis::builtinOptions(), computeBlockInputState(), clang::Cond, clang::dataflow::AdornedCFG::containsExprConsumedInDifferentBlock(), clang::Copy, clang::dataflow::Environment::DiscardExprState, clang::dataflow::BoolValue::formula(), getTerminatorCondition(), clang::dataflow::Environment::KeepExprState, and clang::dataflow::TypeErasedDataflowAnalysis::transferBranchTypeErased().
Referenced by computeBlockInputState().
◆ containsSameFields()
◆ copyField()
◆ copyRecord()
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.
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.
Requirements:
Either:
- Src and Dest must have the same canonical unqualified type, or
- The type of Src must be derived from Dest, or
- The type of Dest must be derived from Src (in this case, any fields that are only present in Dest are not overwritten).
- The types of Dest and Src are both derived from a non-null TypeToCopy (in this case, only fields present in TypeToCopy are overwritten).
Definition at line 57 of file RecordOps.cpp.
References clang::dataflow::RecordStorageLocation::children(), copyField(), copySyntheticField(), clang::Type::getAsCXXRecordDecl(), clang::QualType::getCanonicalType(), clang::dataflow::RecordStorageLocation::getChild(), clang::dataflow::Environment::getDataflowAnalysisContext(), clang::dataflow::DataflowAnalysisContext::getModeledFields(), clang::dataflow::RecordStorageLocation::getSyntheticField(), clang::dataflow::DataflowAnalysisContext::getSyntheticFields(), clang::dataflow::StorageLocation::getType(), clang::QualType::getUnqualifiedType(), clang::CXXRecordDecl::isDerivedFrom(), clang::QualType::isNull(), clang::nullptr, and clang::dataflow::RecordStorageLocation::synthetic_fields().
Referenced by copyField(), copySyntheticField(), clang::dataflow::statusor_model::doHandleConstStatusOrAccessorMemberCall(), and clang::dataflow::statusor_model::transferStatusCall().
◆ copySyntheticField()
◆ createAnalysis()
template
| auto clang::dataflow::createAnalysis | ( | ASTContext & | ASTCtx, |
|---|---|---|---|
| Environment & | Env ) -> decltype(AnalysisT(ASTCtx, Env)) |
◆ debugString() [1/2]
◆ debugString() [2/2]
| llvm::StringRef clang::dataflow::debugString | ( | Value::Kind | Kind | ) |
|---|
◆ diagnoseFunction() [1/2]
◆ diagnoseFunction() [2/2]
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:
- Non-pathological calls to the solver typically require only a few hundred iterations.
- This limit is still low enough to keep runtimes acceptable (on typical machines) in cases where we hit the limit.
MaxBlockVisits caps the number of block visits during analysis. See runDataflowAnalysis for a full description and explanation of the default value.
Definition at line 322 of file DataflowAnalysis.h.
References clang::dataflow::CFGEltCallbacksTypeErased::After, clang::dataflow::DiagnosisCallbacks< AnalysisT, Diagnostic >::After, clang::dataflow::CFGEltCallbacksTypeErased::Before, clang::dataflow::DiagnosisCallbacks< AnalysisT, Diagnostic >::Before, clang::dataflow::AdornedCFG::build(), createAnalysis(), kDefaultMaxBlockVisits, kDefaultMaxSATIterations, clang::dataflow::Solver::reachedLimit(), and runTypeErasedDataflowAnalysis().
Referenced by diagnoseFunction().
◆ equateUnknownValues()
◆ evaluateBooleanEquality()
◆ findReachableBlocks()
| llvm::BitVector clang::dataflow::findReachableBlocks ( const CFG & Cfg) | static |
|---|
◆ getBaseObjectLocation()
◆ getCanonicalSmartPointerLikeOperatorCallee()
| const FunctionDecl * clang::dataflow::getCanonicalSmartPointerLikeOperatorCallee | ( | const CallExpr * | CE | ) |
|---|
◆ getFieldsForInitListExpr()
template
| std::vector< const FieldDecl * > clang::dataflow::getFieldsForInitListExpr ( const InitListT * InitList) | static |
|---|
◆ getFieldsFromClassHierarchy()
| void clang::dataflow::getFieldsFromClassHierarchy ( QualType Type, FieldSet & Fields ) | static |
|---|
◆ getImplicitObjectLocation()
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 1230 of file DataflowEnvironment.cpp.
References clang::cast(), clang::dataflow::Environment::get(), clang::CXXMemberCallExpr::getImplicitObjectArgument(), clang::dataflow::Environment::getStorageLocation(), clang::Expr::getType(), and clang::Type::isPointerType().
Referenced by clang::dataflow::statusor_model::buildDiagnoseMatchSwitch(), clang::dataflow::statusor_model::buildTransferMatchSwitch(), clang::dataflow::statusor_model::transferAssertionResultOperatorBoolCall(), clang::dataflow::statusor_model::transferConstStatusOrAccessorMemberCall(), clang::dataflow::statusor_model::transferConstStatusOrPointerAccessorMemberCall(), clang::dataflow::statusor_model::transferEmplaceCall(), clang::dataflow::statusor_model::transferNonConstMemberCall(), clang::dataflow::statusor_model::transferStatusCall(), clang::dataflow::statusor_model::transferStatusOkCall(), clang::dataflow::statusor_model::transferStatusOrOkCall(), clang::dataflow::statusor_model::transferStatusUpdateCall(), and clang::dataflow::statusor_model::transferValueCall().
◆ getKeys()
template<typename T>
| llvm::DenseSet< llvm::StringRef > clang::dataflow::getKeys ( const llvm::StringMap< T > & Map) | static |
|---|
◆ getMemberForAccessor()
◆ getObjectFields()
| FieldSet clang::dataflow::getObjectFields | ( | QualType | Type | ) |
|---|
◆ getOptionalBaseClass()
◆ getReferencedAtoms()
| void clang::dataflow::getReferencedAtoms ( const Formula & F, llvm::DenseSet< dataflow::Atom > & Refs ) | static |
|---|
Definition at line 262 of file DataflowAnalysisContext.cpp.
References clang::dataflow::Formula::And, clang::dataflow::Formula::AtomRef, clang::dataflow::Formula::Equal, clang::dataflow::Formula::getAtom(), getReferencedAtoms(), clang::dataflow::Formula::Implies, clang::dataflow::Formula::kind(), clang::dataflow::Formula::Literal, clang::dataflow::Formula::Not, clang::dataflow::Formula::operands(), and clang::dataflow::Formula::Or.
Referenced by clang::dataflow::DataflowAnalysisContext::exportLogicalContext(), and getReferencedAtoms().
◆ getReferencedDecls() [1/2]
◆ getReferencedDecls() [2/2]
◆ getTerminatorCondition()
| const Expr * clang::dataflow::getTerminatorCondition ( const Stmt * TerminatorStmt) | static |
|---|
◆ hasName()
| internal::Matcher< NamedDecl > clang::ast_matchers::hasName ( StringRef Name) | inline |
|---|
Matches NamedDecl nodes that have the specified name.
Supports specifying enclosing namespaces or classes by prefixing the name with '::'. Does not match typedefs of an underlying type with the given name.
Example matches X (Name == "X")
Example matches X (Name is one of "::a::b::X", "a::b::X", "b::X", "X")
namespace a { namespace b { class X; } }
Definition at line 3192 of file ASTMatchers.h.
Referenced by clang::dataflow::statusor_model::isAssertionResultConstructFromBoolCall(), clang::dataflow::statusor_model::isAssertionResultOperatorBoolCall(), clang::dataflow::statusor_model::isAsStatusCallWithStatus(), clang::dataflow::statusor_model::isAsStatusCallWithStatusOr(), clang::dataflow::statusor_model::isLoggingCheckEqImpl(), clang::dataflow::statusor_model::isLoggingGetReferenceableValueCall(), clang::dataflow::statusor_model::isMakePredicateFormatterFromIsOkMatcherCall(), clang::dataflow::statusor_model::isMakePredicateFormatterFromStatusIsMatcherCall(), clang::dataflow::statusor_model::isOkStatusCall(), clang::dataflow::statusor_model::isPredicateFormatterFromStatusMatcherCall(), clang::dataflow::statusor_model::isPredicateFormatterFromStatusOrMatcherCall(), isSmartPointerLikeGetMethodCall(), isSmartPointerLikeValueMethodCall(), clang::dataflow::statusor_model::isStatusMemberCallWithName(), clang::dataflow::statusor_model::isStatusOrMemberCallWithName(), clang::dataflow::statusor_model::ofClassStatus(), clang::dataflow::statusor_model::statusClass(), clang::dataflow::statusor_model::statusOrClass(), and clang::dataflow::statusor_model::statusOrOperatorBaseClass().
◆ hasOptionalClassName()
◆ hasOverloadedOperatorName()
Matches overloaded operator names.
Matches overloaded operator names specified in strings without the "operator" prefix: e.g. "<<".
Given:
const A &operator<<(const A &a, const A &b);
A a;
a << a;
clang::CharUnits operator*(clang::CharUnits::QuantityType Scale, const clang::CharUnits &CU)
llvm::raw_ostream & operator<<(llvm::raw_ostream &OS, Atom A)
cxxOperatorCallExpr(hasOverloadedOperatorName("<<"))) matches the specified line and cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*"))) matches the declaration of A.
Usable as: Matcher, Matcher
Definition at line 3255 of file ASTMatchers.h.
Referenced by clang::dataflow::statusor_model::isComparisonOperatorCall(), isPointerLikeOperatorArrow(), isPointerLikeOperatorStar(), clang::dataflow::statusor_model::isPredicateFormatterFromStatusMatcherCall(), clang::dataflow::statusor_model::isPredicateFormatterFromStatusOrMatcherCall(), isSmartPointerLikeOperatorArrow(), isSmartPointerLikeOperatorStar(), clang::dataflow::statusor_model::isStatusOrOperatorCallWithName(), and clang::dataflow::statusor_model::isStatusOrValueAssignmentCall().
◆ ignoreCFGOmittedNodes() [1/2]
| const Expr & clang::dataflow::ignoreCFGOmittedNodes | ( | const Expr & | E | ) |
|---|
◆ ignoreCFGOmittedNodes() [2/2]
| const Stmt & clang::dataflow::ignoreCFGOmittedNodes | ( | const Stmt & | S | ) |
|---|
◆ insertIfFunction()
| void clang::dataflow::insertIfFunction ( const Decl & D, llvm::SetVector< const FunctionDecl * > & Funcs ) | static |
|---|
◆ insertIfGlobal()
| void clang::dataflow::insertIfGlobal ( const Decl & D, llvm::SetVector< const VarDecl * > & Globals ) | static |
|---|
◆ insertIfLocal()
| void clang::dataflow::insertIfLocal ( const Decl & D, llvm::SetVector< const VarDecl * > & Locals ) | static |
|---|
◆ intersectDeclToLoc()
◆ isBackedgeNode()
| bool clang::dataflow::isBackedgeNode ( const CFGBlock & B) | static |
|---|
◆ isCheckLikeMethod()
◆ isFullyQualifiedNamespaceEqualTo()
template<class... NameTypes>
| bool clang::dataflow::isFullyQualifiedNamespaceEqualTo ( const NamespaceDecl & NS, llvm::StringRef Name, NameTypes... Names ) | static |
|---|
◆ isNegLit()
| bool clang::dataflow::isNegLit ( Literal L) | inlineconstexpr |
|---|
Returns whether L is a negative literal.
Definition at line 58 of file CNFFormula.h.
◆ isPointerLikeOperatorArrow()
◆ isPointerLikeOperatorStar()
Matchers: For now, these match on any class with an operator* or operator-> where the return types have a similar shape as std::unique_ptr and std::optional.
- * returns a reference to a type T
- -> returns a pointer to T
- get returns a pointer to T
- value returns a reference T
(1) The T should all match across the accessors (ignoring qualifiers).
(2) The specific accessor used in a call isn't required to be const, but the class must have a const overload of each accessor.
For now, we don't have customization to ignore certain classes. For example, if writing a ClangTidy check for std::optional, these would also match std::optional. In order to have special handling for std::optional, we assume the (Matcher, TransferFunction) case with custom handling is ordered early so that these generic cases do not trigger.
Definition at line 148 of file SmartPointerAccessorCaching.cpp.
References cxxMethodDecl, cxxOperatorCallExpr, hasOverloadedOperatorName(), and referenceType.
Referenced by clang::dataflow::statusor_model::buildTransferMatchSwitch().
◆ isPosLit()
| bool clang::dataflow::isPosLit ( Literal L) | inlineconstexpr |
|---|
Returns whether L is a positive literal.
Definition at line 55 of file CNFFormula.h.
◆ isSmartPointerLikeGetMethodCall()
◆ isSmartPointerLikeOperatorArrow()
◆ isSmartPointerLikeOperatorStar()
◆ isSmartPointerLikeValueMethodCall()
◆ isSupportedOptionalType()
| bool clang::dataflow::isSupportedOptionalType ( QualType Ty) | static |
|---|
◆ joinDistinctValues()
◆ joinExprMaps()
template
| MapT clang::dataflow::joinExprMaps ( const MapT & Map1, const MapT & Map2 ) | static |
|---|
◆ joinLocToVal()
◆ makeLoggerFromCommandLine()
| std::unique_ptr< Logger > clang::dataflow::makeLoggerFromCommandLine ( ) | static |
|---|
◆ maybeUnpackLValueExpr()
◆ negLit()
| Literal clang::dataflow::negLit ( Variable V) | inlineconstexpr |
|---|
◆ notLit()
| Literal clang::dataflow::notLit ( Literal L) | inlineconstexpr |
|---|
Returns the negated literal !L.
Definition at line 61 of file CNFFormula.h.
◆ operator<<() [1/8]
| llvm::raw_ostream & clang::dataflow::operator<< | ( | llvm::raw_ostream & | OS, |
|---|---|---|---|
| const Solver::Result & | R ) |
◆ operator<<() [2/8]
◆ operator<<() [3/8]
| llvm::raw_ostream & clang::dataflow::operator<< ( llvm::raw_ostream & OS, Atom A ) | inline |
|---|
◆ operator<<() [4/8]
| llvm::raw_ostream & clang::dataflow::operator<< ( llvm::raw_ostream & OS, const Formula & F ) | inline |
|---|
◆ operator<<() [5/8]
| raw_ostream & clang::dataflow::operator<< | ( | raw_ostream & | OS, |
|---|---|---|---|
| const Value & | Val ) |
◆ operator<<() [6/8]
template<typename Key, typename ElementLattice>
◆ operator<<() [7/8]
template
| std::ostream & clang::dataflow::operator<< | ( | std::ostream & | Os, |
|---|---|---|---|
| const clang::dataflow::VarMapLattice< ElementLattice > & | M ) |
◆ operator<<() [8/8]
| std::ostream & clang::dataflow::operator<< ( std::ostream & OS, const NoopLattice & ) | inline |
|---|
◆ parseFormula()
Parses Str to build a serialized Formula.
Returns
error on parse failure or if parsing does not fully consume Str.
Parameters
| A | used to construct the formula components. |
|---|---|
| AtomMap | maps serialized [Atom](#a34cd8db4595e927c9c56f1d665762e05 "Identifies an atomic boolean variable such as "V1".") identifiers (unsigned ints) to Atoms. This map is provided by the caller to enable consistency across multiple formulas in a single file. |
Definition at line 139 of file FormulaSerialization.cpp.
References parsePrefix().
◆ parsePrefix()
◆ posLit()
| Literal clang::dataflow::posLit ( Variable V) | inlineconstexpr |
|---|
◆ printAtomList()
| void clang::dataflow::printAtomList ( const llvm::SmallVector< Atom > & Atoms, llvm::raw_ostream & OS ) | static |
|---|
◆ projectToLeaders()
| llvm::DenseSet< Atom > clang::dataflow::projectToLeaders ( const llvm::DenseSet< Atom > & Atoms, llvm::EquivalenceClasses< Atom > & EquivalentAtoms ) | static |
|---|
◆ propagateStorageLocation()
| void clang::dataflow::propagateStorageLocation ( const Expr & From, const Expr & To, Environment & Env ) | static |
|---|
◆ propagateValue()
| void clang::dataflow::propagateValue ( const Expr & From, const Expr & To, Environment & Env ) | static |
|---|
◆ propagateValueOrStorageLocation()
| void clang::dataflow::propagateValueOrStorageLocation ( const Expr & From, const Expr & To, Environment & Env ) | static |
|---|
◆ recordsEqual() [1/2]
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.
Note on how to interpret the result:
- If this returns true, the records are guaranteed to be equal at runtime.
- If this returns false, the records may still be equal at runtime; our analysis merely cannot guarantee that they will be equal.
Requirements:
Src and Dst must have the same canonical unqualified type.
Definition at line 134 of file RecordOps.cpp.
References clang::cast(), 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(), and recordsEqual().
◆ recordsEqual() [2/2]
◆ runDataflowAnalysis()
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 PostAnalysisCallbacks on each CFG element with the final analysis results before and after that program point.
MaxBlockVisits caps the number of block visits during analysis. See runTypeErasedDataflowAnalysis for a full description. The default value is essentially arbitrary – large enough to accommodate what seems like any reasonable CFG, but still small enough to limit the cost of hitting the limit.
Definition at line 234 of file DataflowAnalysis.h.
◆ runTypeErasedDataflowAnalysis()
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 PostAnalysisCallbacks on each CFG element with the final analysis results before and after that program point.
MaxBlockVisits caps the number of block visits during analysis. It doesn't distinguish between repeat visits to the same block and visits to distinct blocks. This parameter is a backstop to prevent infinite loops, in the case of bugs in the lattice and/or transfer functions that prevent the analysis from converging.
Definition at line 488 of file TypeErasedDataflowAnalysis.cpp.
References clang::dataflow::CFGEltCallbacksTypeErased::After, clang::dataflow::CFGEltCallbacksTypeErased::Before, clang::Block, clang::dataflow::Logger::blockConverged(), clang::dataflow::Environment::callStackSize(), 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::AdornedCFG::getCFG(), clang::CFG::getEntry(), clang::dataflow::Environment::initialize(), isBackedgeNode(), clang::dataflow::TypeErasedDataflowAnalysis::isEqualTypeErased(), clang::dataflow::TypeErasedDataflowAnalysisState::Lattice, runTypeErasedDataflowAnalysis(), clang::CFG::size(), transferCFGBlock(), clang::dataflow::TypeErasedDataflowAnalysis::typeErasedInitialElement(), Unchanged, clang::dataflow::Environment::widen(), and clang::dataflow::TypeErasedDataflowAnalysis::widenTypeErased().
Referenced by diagnoseFunction(), and runTypeErasedDataflowAnalysis().
◆ serializeFormula()
| void clang::dataflow::serializeFormula | ( | const Formula & | F, |
|---|---|---|---|
| llvm::raw_ostream & | OS ) |
◆ sigil()
| llvm::StringLiteral clang::dataflow::sigil ( Formula::Kind K) | static |
|---|
◆ simplifyConstraints()
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::isLiteral(), 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().
◆ substitute()
| const Formula & clang::dataflow::substitute ( const Formula & F, const llvm::DenseMap< Atom, const Formula * > & Substitutions, Arena & arena ) | 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().
◆ transfer()
◆ transferCFGBlock()
◆ transferSmartPointerLikeCachedDeref()
◆ transferSmartPointerLikeCachedGet()
◆ unpackValue()
◆ var()
| Variable clang::dataflow::var ( Literal L) | inlineconstexpr |
|---|
Returns the variable of L.
Definition at line 64 of file CNFFormula.h.
◆ widenDistinctValues()
Definition at line 159 of file DataflowEnvironment.cpp.
References clang::dataflow::Environment::arena(), clang::cast(), Changed, equateUnknownValues(), clang::dataflow::Environment::getBoolLiteralValue(), clang::dataflow::Value::getKind(), clang::isa(), clang::dataflow::Arena::makeNot(), clang::dataflow::Environment::makeTopBoolValue(), clang::dataflow::Environment::proves(), clang::Result, and Unchanged.
Referenced by widenKeyToValueMap().
◆ widenKeyToValueMap()
◆ cxxMemberCallExpr
const internal::VariadicDynCastAllOfMatcher< Stmt, CXXMemberCallExpr > clang::ast_matchers::cxxMemberCallExpr
◆ cxxMethodDecl
const internal::VariadicDynCastAllOfMatcher< Decl, CXXMethodDecl > clang::ast_matchers::cxxMethodDecl
Matches method declarations.
Example matches y
Definition at line 827 of file ASTMatchersInternal.cpp.
Referenced by clang::dataflow::statusor_model::isAssertionResultOperatorBoolCall(), clang::dataflow::statusor_model::isConstStatusOrAccessorMemberCall(), clang::dataflow::statusor_model::isConstStatusOrAccessorMemberOperatorCall(), clang::dataflow::statusor_model::isConstStatusOrPointerAccessorMemberCall(), clang::dataflow::statusor_model::isConstStatusOrPointerAccessorMemberOperatorCall(), clang::dataflow::statusor_model::isNonConstMemberCall(), clang::dataflow::statusor_model::isNonConstMemberOperatorCall(), isPointerLikeOperatorArrow(), isPointerLikeOperatorStar(), clang::dataflow::statusor_model::isPredicateFormatterFromStatusMatcherCall(), clang::dataflow::statusor_model::isPredicateFormatterFromStatusOrMatcherCall(), isSmartPointerLikeGetMethodCall(), isSmartPointerLikeOperatorArrow(), isSmartPointerLikeOperatorStar(), isSmartPointerLikeValueMethodCall(), clang::dataflow::statusor_model::isStatusMemberCallWithName(), clang::dataflow::statusor_model::isStatusOrMemberCallWithName(), clang::dataflow::statusor_model::isStatusOrOperatorCallWithName(), and clang::dataflow::statusor_model::isStatusOrValueAssignmentCall().
◆ cxxOperatorCallExpr
Matches overloaded operator calls.
Note that if an operator isn't overloaded, it won't match. Instead, use binaryOperator matcher. Currently it does not match operators such as new delete. FIXME: figure out why these do not match?
Example matches both operator<<((o << b), c) and operator<<(o, b) (matcher = cxxOperatorCallExpr())
ostream &operator<< (ostream &out, int i) { };
__device__ __2f16 float c
See also the binaryOperation() matcher for more-general matching of binary uses of this AST node.
Definition at line 923 of file ASTMatchersInternal.cpp.
Referenced by clang::dataflow::statusor_model::isComparisonOperatorCall(), clang::dataflow::statusor_model::isConstStatusOrAccessorMemberOperatorCall(), clang::dataflow::statusor_model::isConstStatusOrPointerAccessorMemberOperatorCall(), clang::dataflow::statusor_model::isNonConstMemberOperatorCall(), isPointerLikeOperatorArrow(), isPointerLikeOperatorStar(), clang::dataflow::statusor_model::isPredicateFormatterFromStatusMatcherCall(), clang::dataflow::statusor_model::isPredicateFormatterFromStatusOrMatcherCall(), isSmartPointerLikeOperatorArrow(), isSmartPointerLikeOperatorStar(), clang::dataflow::statusor_model::isStatusOrOperatorCallWithName(), and clang::dataflow::statusor_model::isStatusOrValueAssignmentCall().
◆ kDefaultMaxBlockVisits
| std::int32_t clang::dataflow::kDefaultMaxBlockVisits = 20'000 | inlineconstexpr |
|---|
◆ kDefaultMaxSATIterations
| std::int64_t clang::dataflow::kDefaultMaxSATIterations = 1'000'000'000 | inlineconstexpr |
|---|
◆ MaxCompositeValueDepth
| int clang::dataflow::MaxCompositeValueDepth = 3 | staticconstexpr |
|---|
◆ MaxCompositeValueSize
| int clang::dataflow::MaxCompositeValueSize = 1000 | staticconstexpr |
|---|
◆ NullClause
| ClauseID clang::dataflow::NullClause = 0 | constexpr |
|---|
A null clause identifier is used as a placeholder in various data structures and algorithms.
Definition at line 46 of file CNFFormula.h.
◆ NullLit
| Literal clang::dataflow::NullLit = 0 | constexpr |
|---|
◆ NullVar
| Variable clang::dataflow::NullVar = 0 | constexpr |
|---|
A null boolean variable is used as a placeholder in various data structures and algorithms.
Definition at line 29 of file CNFFormula.h.
◆ pointerType
const AstTypeMatcher<PointerType> clang::ast_matchers::pointerType
◆ referenceType
const AstTypeMatcher<ReferenceType> clang::ast_matchers::referenceType