clang 22.0.0git
clang::dataflow::Formula Class Reference

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

Public Types

enum  Kind : unsigned {
  AtomRef , Literal , Not , And ,
  Or , Implies , Equal
}
using AtomNames = llvm::DenseMap<Atom, std::string>

Public Member Functions

Kind kind () const
Atom getAtom () const
bool literal () const
bool isLiteral (bool b) const
ArrayRef< const Formula * > operands () const
void print (llvm::raw_ostream &OS, const AtomNames *=nullptr) const
 Produces a stable human-readable representation of this formula.

Static Public Member Functions

static const Formulacreate (llvm::BumpPtrAllocator &Alloc, Kind K, ArrayRef< const Formula * > Operands, unsigned Value=0)
 Allocates Formulas using Arena rather than calling this function directly.
static unsigned numOperands (Kind K)
 Count of operands (sub-formulas) associated with Formulas of kind K.

Detailed Description

Definition at line 49 of file Formula.h.

Member Typedef Documentation

◆ AtomNames

using clang::dataflow::Formula::AtomNames = llvm::DenseMap<Atom, std::string>

Definition at line 87 of file Formula.h.

Member Enumeration Documentation

◆ Kind

Enumerator
AtomRef 

A reference to an atomic boolean variable.

We name these e.g. "V3", where 3 == atom identity == Value.

Literal 

Constant true or false.

Not 
And 

True if its only operand is false.

Or 

True if LHS and RHS are both true.

Implies 

True if either LHS or RHS is true.

Equal 

True if LHS is false or RHS is true.

Definition at line 51 of file Formula.h.

Member Function Documentation

◆ create()

const Formula & clang::dataflow::Formula::create ( llvm::BumpPtrAllocator & Alloc,
Kind K,
ArrayRef< const Formula * > Operands,
unsigned Value = 0 )
static

◆ getAtom()

◆ isLiteral()

bool clang::dataflow::Formula::isLiteral ( bool b) const
inline

◆ kind()

◆ literal()

◆ numOperands()

unsigned clang::dataflow::Formula::numOperands ( Kind K)
inlinestatic

Count of operands (sub-formulas) associated with Formulas of kind K.

Definition at line 99 of file Formula.h.

References And, AtomRef, Equal, Implies, Literal, Not, and Or.

Referenced by create(), operands(), print(), and clang::dataflow::serializeFormula().

◆ operands()

◆ print()

void clang::dataflow::Formula::print ( llvm::raw_ostream & OS,
const AtomNames * Names = nullptr ) const

Produces a stable human-readable representation of this formula.

For example: (V3 | !(V1 & V2)) If AtomNames is provided, these override the default V0, V1... names.

Definition at line 57 of file Formula.cpp.

References AtomRef, getAtom(), kind(), Literal, literal(), numOperands(), operands(), and clang::dataflow::sigil().

Referenced by clang::dataflow::operator<<().


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