clang 20.0.0git
Public Member Functions | List of all members
clang::dataflow::Arena Class Reference

The Arena owns the objects that model data within an analysis. More...

#include "clang/Analysis/FlowSensitive/Arena.h"

Public Member Functions

 Arena ()
 
 Arena (const Arena &)=delete
 
Arenaoperator= (const Arena &)=delete
 
template<typename T , typename... Args>
std::enable_if_t< std::is_base_of< StorageLocation, T >::value, T & > create (Args &&...args)
 Creates a T (some subclass of StorageLocation), forwarding args to the constructor, and returns a reference to it.
 
template<typename T , typename... Args>
std::enable_if_t< std::is_base_of< Value, T >::value, T & > create (Args &&...args)
 Creates a T (some subclass of Value), forwarding args to the constructor, and returns a reference to it.
 
BoolValuemakeBoolValue (const Formula &)
 Creates a BoolValue wrapping a particular formula.
 
AtomicBoolValuemakeAtomValue ()
 Creates a fresh atom and wraps in in an AtomicBoolValue.
 
TopBoolValuemakeTopValue ()
 Creates a fresh Top boolean value.
 
IntegerValuemakeIntLiteral (llvm::APInt Value)
 Returns a symbolic integer value that models an integer literal equal to Value.
 
const FormulamakeAnd (const Formula &LHS, const Formula &RHS)
 Returns a formula for the conjunction of LHS and RHS.
 
const FormulamakeOr (const Formula &LHS, const Formula &RHS)
 Returns a formula for the disjunction of LHS and RHS.
 
const FormulamakeNot (const Formula &Val)
 Returns a formula for the negation of Val.
 
const FormulamakeImplies (const Formula &LHS, const Formula &RHS)
 Returns a formula for LHS => RHS.
 
const FormulamakeEquals (const Formula &LHS, const Formula &RHS)
 Returns a formula for LHS <=> RHS.
 
const FormulamakeAtomRef (Atom A)
 Returns a formula for the variable A.
 
const FormulamakeLiteral (bool Value)
 Returns a formula for a literal true/false.
 
llvm::Expected< const Formula & > parseFormula (llvm::StringRef)
 
Atom makeAtom ()
 Returns a new atomic boolean variable, distinct from any other.
 
Atom makeFlowConditionToken ()
 Creates a fresh flow condition and returns a token that identifies it.
 

Detailed Description

The Arena owns the objects that model data within an analysis.

For example, Value, StorageLocation, Atom, and Formula.

Definition at line 21 of file Arena.h.

Constructor & Destructor Documentation

◆ Arena() [1/2]

clang::dataflow::Arena::Arena ( )
inline

Definition at line 23 of file Arena.h.

◆ Arena() [2/2]

clang::dataflow::Arena::Arena ( const Arena )
delete

Member Function Documentation

◆ create() [1/2]

template<typename T , typename... Args>
std::enable_if_t< std::is_base_of< StorageLocation, T >::value, T & > clang::dataflow::Arena::create ( Args &&...  args)
inline

Creates a T (some subclass of StorageLocation), forwarding args to the constructor, and returns a reference to it.

The Arena takes ownership of the created object. The object will be destroyed when the Arena is destroyed.

Definition at line 36 of file Arena.h.

Referenced by clang::dataflow::Environment::create().

◆ create() [2/2]

template<typename T , typename... Args>
std::enable_if_t< std::is_base_of< Value, T >::value, T & > clang::dataflow::Arena::create ( Args &&...  args)
inline

Creates a T (some subclass of Value), forwarding args to the constructor, and returns a reference to it.

The Arena takes ownership of the created object. The object will be destroyed when the Arena is destroyed.

Definition at line 52 of file Arena.h.

◆ makeAnd()

const Formula & clang::dataflow::Arena::makeAnd ( const Formula LHS,
const Formula RHS 
)

◆ makeAtom()

Atom clang::dataflow::Arena::makeAtom ( )
inline

Returns a new atomic boolean variable, distinct from any other.

Definition at line 118 of file Arena.h.

Referenced by makeAtomValue(), makeFlowConditionToken(), and makeTopValue().

◆ makeAtomRef()

const Formula & clang::dataflow::Arena::makeAtomRef ( Atom  A)

◆ makeAtomValue()

AtomicBoolValue & clang::dataflow::Arena::makeAtomValue ( )
inline

Creates a fresh atom and wraps in in an AtomicBoolValue.

FIXME: For now, identical-address AtomicBoolValue <=> identical atom. Stop relying on pointer identity and remove this guarantee.

Definition at line 71 of file Arena.h.

References makeAtom(), makeAtomRef(), and makeBoolValue().

Referenced by clang::dataflow::Environment::makeAtomicBoolValue().

◆ makeBoolValue()

BoolValue & clang::dataflow::Arena::makeBoolValue ( const Formula F)

Creates a BoolValue wrapping a particular formula.

Passing in the same formula will result in the same BoolValue. FIXME: Interning BoolValues but not other Values is inconsistent. Decide whether we want Value interning or not.

Definition at line 112 of file Arena.cpp.

References clang::dataflow::Formula::AtomRef, and clang::dataflow::Formula::kind().

Referenced by clang::dataflow::Environment::getBoolLiteralValue(), clang::dataflow::Environment::makeAnd(), makeAtomValue(), clang::dataflow::Environment::makeIff(), clang::dataflow::Environment::makeImplication(), clang::dataflow::Environment::makeNot(), clang::dataflow::Environment::makeOr(), and clang::dataflow::unpackValue().

◆ makeEquals()

const Formula & clang::dataflow::Arena::makeEquals ( const Formula LHS,
const Formula RHS 
)

◆ makeFlowConditionToken()

Atom clang::dataflow::Arena::makeFlowConditionToken ( )
inline

Creates a fresh flow condition and returns a token that identifies it.

The token can be used to perform various operations on the flow condition such as adding constraints to it, forking it, joining it with another flow condition, or checking implications.

Definition at line 124 of file Arena.h.

References makeAtom().

◆ makeImplies()

const Formula & clang::dataflow::Arena::makeImplies ( const Formula LHS,
const Formula RHS 
)

◆ makeIntLiteral()

IntegerValue & clang::dataflow::Arena::makeIntLiteral ( llvm::APInt  Value)

Returns a symbolic integer value that models an integer literal equal to Value.

These literals are the same every time. Integer literals are not typed; the type is determined by the Expr that an integer literal is associated with.

Definition at line 104 of file Arena.cpp.

Referenced by clang::dataflow::Environment::getIntLiteralValue().

◆ makeLiteral()

const Formula & clang::dataflow::Arena::makeLiteral ( bool  Value)
inline

Returns a formula for a literal true/false.

Definition at line 111 of file Arena.h.

Referenced by makeEquals(), makeImplies(), makeNot(), and clang::dataflow::simplifyConstraints().

◆ makeNot()

const Formula & clang::dataflow::Arena::makeNot ( const Formula Val)

◆ makeOr()

const Formula & clang::dataflow::Arena::makeOr ( const Formula LHS,
const Formula RHS 
)

◆ makeTopValue()

TopBoolValue & clang::dataflow::Arena::makeTopValue ( )
inline

Creates a fresh Top boolean value.

Definition at line 76 of file Arena.h.

References makeAtom(), and makeAtomRef().

Referenced by clang::dataflow::Environment::makeTopBoolValue().

◆ operator=()

Arena & clang::dataflow::Arena::operator= ( const Arena )
delete

◆ parseFormula()

llvm::Expected< const Formula & > clang::dataflow::Arena::parseFormula ( llvm::StringRef  In)

Definition at line 202 of file Arena.cpp.

References clang::Result.


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