clang 24.0.0git
clang::dataflow::UncheckedExpectedAccessModel Class Reference

Dataflow analysis that models whether expected objects hold values. More...

#include "clang/Analysis/FlowSensitive/Models/UncheckedExpectedAccessModel.h"

Inheritance diagram for clang::dataflow::UncheckedExpectedAccessModel:
[legend]

Public Member Functions

 UncheckedExpectedAccessModel (ASTContext &Ctx, Environment &Env)
void transfer (const CFGElement &Elt, NoopLattice &L, Environment &Env)
Public Member Functions inherited from clang::dataflow::DataflowAnalysis< UncheckedExpectedAccessModel, NoopLattice >
 DataflowAnalysis (ASTContext &Context)
ASTContext & getASTContext () final
 Returns the ASTContext that is used by the analysis.
TypeErasedLattice typeErasedInitialElement () final
 Returns a type-erased lattice element that models the initial state of a basic block.
TypeErasedLattice joinTypeErased (const TypeErasedLattice &E1, const TypeErasedLattice &E2) final
 Joins two type-erased lattice elements by computing their least upper bound.
LatticeJoinEffect widenTypeErased (TypeErasedLattice &Current, const TypeErasedLattice &Previous) final
 Chooses a lattice element that approximates the current element at a program point, given the previous element at that point.
bool isEqualTypeErased (const TypeErasedLattice &E1, const TypeErasedLattice &E2) final
 Returns true if and only if the two given type-erased lattice elements are equal.
void transferTypeErased (const CFGElement &Element, TypeErasedLattice &E, Environment &Env) final
 Applies the analysis transfer function for a given control flow graph element and type-erased lattice element.
void transferBranchTypeErased (bool Branch, const Stmt *Stmt, TypeErasedLattice &E, Environment &Env) final
 Applies the analysis transfer function for a given edge from a CFG block of a conditional statement.
Public Member Functions inherited from clang::dataflow::TypeErasedDataflowAnalysis
 TypeErasedDataflowAnalysis ()
 TypeErasedDataflowAnalysis (DataflowAnalysisOptions Options)
virtual ~TypeErasedDataflowAnalysis ()
const std::optional< DataflowAnalysisContext::Options > & builtinOptions () const
 If the built-in model is enabled, returns the options to be passed to them.
Public Member Functions inherited from clang::dataflow::Environment::ValueModel
virtual ~ValueModel ()=default
virtual ComparisonResult compare (QualType Type, const Value &Val1, const Environment &Env1, const Value &Val2, const Environment &Env2)
 Returns: Same: Val1 is equivalent to Val2, according to the model.
virtual void join (QualType Type, const Value &Val1, const Environment &Env1, const Value &Val2, const Environment &Env2, Value &JoinedVal, Environment &JoinedEnv)
 Modifies JoinedVal to approximate both Val1 and Val2.
virtual std::optional< WidenResult > widen (QualType Type, Value &Prev, const Environment &PrevEnv, Value &Current, Environment &CurrentEnv)
 This function may widen the current value – replace it with an approximation that can reach a fixed point more quickly than iterated application of the transfer function alone.

Static Public Member Functions

static ast_matchers::StatementMatcher callToExpectedClass ()
 Returns a matcher for calls to member functions of a supported expected type.
static NoopLattice initialElement ()

Additional Inherited Members

Public Types inherited from clang::dataflow::DataflowAnalysis< UncheckedExpectedAccessModel, NoopLattice >
using Lattice
 Bounded join-semilattice that is used in the analysis.

Detailed Description

Dataflow analysis that models whether expected objects hold values.

Supported types are std::expected and tl::expected (https://github.com/TartanLlama/expected).

Definition at line 35 of file UncheckedExpectedAccessModel.h.

Constructor & Destructor Documentation

◆ UncheckedExpectedAccessModel()

Member Function Documentation

◆ callToExpectedClass()

ast_matchers::StatementMatcher clang::dataflow::UncheckedExpectedAccessModel::callToExpectedClass ( )
static

Returns a matcher for calls to member functions of a supported expected type.

Definition at line 177 of file UncheckedExpectedAccessModel.cpp.

References clang::ast_matchers::callExpr, and clang::dataflow::cxxMethodDecl.

◆ initialElement()

NoopLattice clang::dataflow::UncheckedExpectedAccessModel::initialElement ( )
inlinestatic

Definition at line 44 of file UncheckedExpectedAccessModel.h.

◆ transfer()

void clang::dataflow::UncheckedExpectedAccessModel::transfer ( const CFGElement & Elt,
NoopLattice & L,
Environment & Env )

The documentation for this class was generated from the following files: