class DataflowAnalysis

Declaration

template <typename Derived, typename LatticeT>
class DataflowAnalysis : public TypeErasedDataflowAnalysis { /* full declaration omitted */ };

Description

Base class template for dataflow analyses built on a single lattice type. Requirements: `Derived` must be derived from a specialization of this class template and must provide the following public members: * `LatticeT initialElement()` - returns a lattice element that models the initial state of a basic block; * `void transfer(const Stmt *, LatticeT & , Environment & )` - applies the analysis transfer function for a given statement and lattice element. `Derived` can optionally override the following members: * `bool merge(QualType, const Value & , const Value & , Value & , Environment & )` - joins distinct values. This could be a strict lattice join or a more general widening operation. `LatticeT` is a bounded join-shdocattice that is used by `Derived` and must provide the following public members: * `LatticeJoinEffect join(const LatticeT & )` - joins the object and the argument by computing their least upper bound, modifies the object if necessary, and returns an effect indicating whether any changes were made to it; * `bool operator==(const LatticeT & ) const` - returns true if and only if the object is equal to the argument.

Declared at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h:60

Inherits from: TypeErasedDataflowAnalysis

Templates

Derived
LatticeT

Member Variables

private clang::ASTContext& Context

Method Overview

Inherited from TypeErasedDataflowAnalysis:

Inherited from Environment::ValueModel:

Methods

DataflowAnalysis<Derived, LatticeT>(
    clang::ASTContext& Context)

Declared at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h:65

Parameters

clang::ASTContext& Context

DataflowAnalysis<Derived, LatticeT>(
    clang::ASTContext& Context,
    bool ApplyBuiltinTransfer)

Description

Deprecated. Use the `DataflowAnalysisOptions` constructor instead.

Declared at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h:68

Parameters

clang::ASTContext& Context
bool ApplyBuiltinTransfer

DataflowAnalysis<Derived, LatticeT>(
    clang::ASTContext& Context,
    clang::dataflow::DataflowAnalysisOptions
        Options)

Declared at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h:71

Parameters

clang::ASTContext& Context
clang::dataflow::DataflowAnalysisOptions Options

clang::ASTContext& getASTContext()

Description

Returns the `ASTContext` that is used by the analysis.

Declared at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h:75

bool isEqualTypeErased(
    const clang::dataflow::TypeErasedLattice& E1,
    const clang::dataflow::TypeErasedLattice& E2)

Description

Returns true if and only if the two given type-erased lattice elements are equal.

Declared at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h:88

Parameters

const clang::dataflow::TypeErasedLattice& E1
const clang::dataflow::TypeErasedLattice& E2

clang::dataflow::LatticeJoinEffect joinTypeErased(
    clang::dataflow::TypeErasedLattice& E1,
    const clang::dataflow::TypeErasedLattice& E2)

Description

Joins two type-erased lattice elements by computing their least upper bound. Places the join result in the left element and returns an effect indicating whether any changes were made to it.

Declared at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h:81

Parameters

clang::dataflow::TypeErasedLattice& E1
const clang::dataflow::TypeErasedLattice& E2

void transferTypeErased(
    const clang::Stmt* Stmt,
    clang::dataflow::TypeErasedLattice& E,
    clang::dataflow::Environment& Env)

Description

Applies the analysis transfer function for a given statement and type-erased lattice element.

Declared at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h:95

Parameters

const clang::Stmt* Stmt
clang::dataflow::TypeErasedLattice& E
clang::dataflow::Environment& Env

clang::dataflow::TypeErasedLattice
typeErasedInitialElement()

Description

Returns a type-erased lattice element that models the initial state of a basic block.

Declared at: clang/include/clang/Analysis/FlowSensitive/DataflowAnalysis.h:77