class ProgramState

Declaration

class ProgramState : public Node { /* full declaration omitted */ };

Description

ProgramState - This class encapsulates: 1. A mapping from expressions to values (Environment) 2. A mapping from locations to values (Store) 3. Constraints on symbolic values (GenericDataMap) Together these represent the "abstract state" of a program. ProgramState is intended to be used as a functional object; that is, once it is created and made "persistent" in a FoldingSet, its values will never change.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:70

Inherits from: FoldingSetBase::Node

Member Variables

private clang::ento::ProgramStateManager* stateMgr
private clang::ento::Environment Env
private clang::ento::Store store
private clang::ento::ProgramState::GenericDataMap GDM
private bool PosteriorlyOverconstrained = false
private unsigned int refCount

Method Overview

  • public clang::ento::ProgramStateRef BindExpr(const clang::Stmt * S, const clang::LocationContext * LCtx, clang::ento::SVal V, bool Invalidate = true) const
  • public void *const * FindGDM(void * K) const
  • public void Profile(llvm::FoldingSetNodeID & ID) const
  • public static void Profile(llvm::FoldingSetNodeID & ID, const clang::ento::ProgramState * V)
  • public ProgramState(clang::ento::ProgramStateManager * mgr, const clang::ento::Environment & env, clang::ento::StoreRef st, clang::ento::ProgramState::GenericDataMap gdm)
  • public ProgramState(const clang::ento::ProgramState & RHS)
  • public template <typename T>clang::ento::ProgramStateRef add(typename ProgramStateTrait<T>::key_type K) const
  • public clang::ento::ConditionTruthVal areEqual(clang::ento::SVal Lhs, clang::ento::SVal Rhs) const
  • public clang::ento::ProgramStateRef assume(clang::ento::DefinedOrUnknownSVal cond, bool assumption) const
  • public std::pair<ProgramStateRef, ProgramStateRef> assume(clang::ento::DefinedOrUnknownSVal cond) const
  • public clang::ento::ProgramStateRef assumeInBound(clang::ento::DefinedOrUnknownSVal idx, clang::ento::DefinedOrUnknownSVal upperBound, bool assumption, clang::QualType IndexType = clang::QualType()) const
  • public std::pair<ProgramStateRef, ProgramStateRef> assumeInBoundDual(clang::ento::DefinedOrUnknownSVal idx, clang::ento::DefinedOrUnknownSVal upperBound, clang::QualType IndexType = clang::QualType()) const
  • public std::pair<ProgramStateRef, ProgramStateRef> assumeInclusiveRange(clang::ento::DefinedOrUnknownSVal Val, const llvm::APSInt & From, const llvm::APSInt & To) const
  • public clang::ento::ProgramStateRef assumeInclusiveRange(clang::ento::DefinedOrUnknownSVal Val, const llvm::APSInt & From, const llvm::APSInt & To, bool assumption) const
  • public clang::ento::ProgramStateRef bindDefaultInitial(clang::ento::SVal loc, clang::ento::SVal V, const clang::LocationContext * LCtx) const
  • public clang::ento::ProgramStateRef bindDefaultZero(clang::ento::SVal loc, const clang::LocationContext * LCtx) const
  • public clang::ento::ProgramStateRef bindLoc(clang::ento::Loc location, clang::ento::SVal V, const clang::LocationContext * LCtx, bool notifyChanges = true) const
  • public clang::ento::ProgramStateRef bindLoc(clang::ento::SVal location, clang::ento::SVal V, const clang::LocationContext * LCtx) const
  • private clang::ento::ProgramStateRef cloneAsPosteriorlyOverconstrained() const
  • public template <typename T>bool contains(typename ProgramStateTrait<T>::key_type key) const
  • public void dump() const
  • public clang::ento::ProgramStateRef enterStackFrame(const clang::ento::CallEvent & Call, const clang::StackFrameContext * CalleeCtx) const
  • public template <typename T>typename ProgramStateTrait<T>::lookup_type get(typename ProgramStateTrait<T>::key_type key) const
  • public template <typename T>typename ProgramStateTrait<T>::data_type get() const
  • public clang::ento::AnalysisManager & getAnalysisManager() const
  • public clang::ento::BasicValueFactory & getBasicVals() const
  • public clang::ento::ConstraintManager & getConstraintManager() const
  • public const clang::ento::Environment & getEnvironment() const
  • public clang::ento::ProgramState::GenericDataMap getGDM() const
  • public int64_t getID() const
  • public clang::ento::SVal getLValue(const clang::IndirectFieldDecl * decl, clang::ento::SVal Base) const
  • public clang::ento::SVal getLValue(const clang::FieldDecl * decl, clang::ento::SVal Base) const
  • public clang::ento::SVal getLValue(const clang::ObjCIvarDecl * decl, clang::ento::SVal base) const
  • public clang::ento::Loc getLValue(const clang::CompoundLiteralExpr * literal, const clang::LocationContext * LC) const
  • public clang::ento::Loc getLValue(const clang::VarDecl * D, const clang::LocationContext * LC) const
  • public clang::ento::Loc getLValue(const clang::CXXRecordDecl * BaseClass, const clang::ento::SubRegion * Super, bool IsVirtual) const
  • public clang::ento::Loc getLValue(const clang::CXXBaseSpecifier & BaseSpec, const clang::ento::SubRegion * Super) const
  • public clang::ento::SVal getLValue(clang::QualType ElementType, clang::ento::SVal Idx, clang::ento::SVal Base) const
  • public clang::ento::SVal getRawSVal(clang::ento::Loc LV, clang::QualType T = clang::QualType()) const
  • public const clang::ento::VarRegion * getRegion(const clang::VarDecl * D, const clang::LocationContext * LC) const
  • public clang::ento::SVal getSVal(const clang::ento::MemRegion * R, clang::QualType T = clang::QualType()) const
  • public clang::ento::SVal getSVal(const clang::Stmt * S, const clang::LocationContext * LCtx) const
  • public clang::ento::SVal getSVal(clang::ento::Loc LV, clang::QualType T = clang::QualType()) const
  • public clang::ento::SVal getSValAsScalarOrLoc(const clang::ento::MemRegion * R) const
  • public clang::ento::SVal getSValAsScalarOrLoc(const clang::Stmt * Ex, const clang::LocationContext * LCtx) const
  • public clang::ento::SVal getSelfSVal(const clang::LocationContext * LC) const
  • public clang::ento::ProgramStateManager & getStateManager() const
  • public clang::ento::Store getStore() const
  • public clang::ento::SymbolManager & getSymbolManager() const
  • public template <typename T>typename ProgramStateTrait<T>::context_type get_context() const
  • public clang::ento::ProgramStateRef invalidateRegions(ArrayRef<clang::ento::SVal> Regions, const clang::Expr * E, unsigned int BlockCount, const clang::LocationContext * LCtx, bool CausesPointerEscape, clang::ento::InvalidatedSymbols * IS = nullptr, const clang::ento::CallEvent * Call = nullptr, clang::ento::RegionAndSymbolInvalidationTraits * ITraits = nullptr) const
  • public clang::ento::ProgramStateRef invalidateRegions(ArrayRef<const clang::ento::MemRegion *> Regions, const clang::Expr * E, unsigned int BlockCount, const clang::LocationContext * LCtx, bool CausesPointerEscape, clang::ento::InvalidatedSymbols * IS = nullptr, const clang::ento::CallEvent * Call = nullptr, clang::ento::RegionAndSymbolInvalidationTraits * ITraits = nullptr) const
  • private clang::ento::ProgramStateRef invalidateRegionsImpl(ArrayRef<clang::ento::SVal> Values, const clang::Expr * E, unsigned int BlockCount, const clang::LocationContext * LCtx, bool ResultsInSymbolEscape, clang::ento::InvalidatedSymbols * IS, clang::ento::RegionAndSymbolInvalidationTraits * HTraits, const clang::ento::CallEvent * Call) const
  • public clang::ento::ConditionTruthVal isNonNull(clang::ento::SVal V) const
  • public clang::ento::ConditionTruthVal isNull(clang::ento::SVal V) const
  • private bool isPosteriorlyOverconstrained() const
  • public clang::ento::ProgramStateRef killBinding(clang::ento::Loc LV) const
  • private clang::ento::ProgramStateRef makeWithStore(const clang::ento::StoreRef & store) const
  • public void printDOT(llvm::raw_ostream & Out, const clang::LocationContext * LCtx = nullptr, unsigned int Space = 0) const
  • public void printJson(llvm::raw_ostream & Out, const clang::LocationContext * LCtx = nullptr, const char * NL = "\n", unsigned int Space = 0, bool IsDot = false) const
  • public template <typename T>clang::ento::ProgramStateRef remove(typename ProgramStateTrait<T>::key_type K) const
  • public template <typename T>clang::ento::ProgramStateRef remove(typename ProgramStateTrait<T>::key_type K, typename ProgramStateTrait<T>::context_type C) const
  • public template <typename T>clang::ento::ProgramStateRef remove() const
  • public bool scanReachableSymbols(llvm::iterator_range<region_iterator> Reachable, clang::ento::SymbolVisitor & visitor) const
  • public template <typename CB>CB scanReachableSymbols(clang::ento::SVal val) const
  • public template <typename CB>CB scanReachableSymbols(llvm::iterator_range<region_iterator> Reachable) const
  • public bool scanReachableSymbols(clang::ento::SVal val, clang::ento::SymbolVisitor & visitor) const
  • public template <typename T>clang::ento::ProgramStateRef set(typename ProgramStateTrait<T>::data_type D) const
  • public template <typename T>clang::ento::ProgramStateRef set(typename ProgramStateTrait<T>::key_type K, typename ProgramStateTrait<T>::value_type E) const
  • public template <typename T>clang::ento::ProgramStateRef set(typename ProgramStateTrait<T>::key_type K, typename ProgramStateTrait<T>::value_type E, typename ProgramStateTrait<T>::context_type C) const
  • public void setGDM(clang::ento::ProgramState::GenericDataMap gdm)
  • private void setStore(const clang::ento::StoreRef & storeRef)
  • public ~ProgramState()

Inherited from FoldingSetBase::Node:

Methods

clang::ento::ProgramStateRef BindExpr(
    const clang::Stmt* S,
    const clang::LocationContext* LCtx,
    clang::ento::SVal V,
    bool Invalidate = true) const

Description

Create a new state by binding the value 'V' to the statement 'S' in the state's environment.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:279

Parameters

const clang::Stmt* S
const clang::LocationContext* LCtx
clang::ento::SVal V
bool Invalidate = true

void* const* FindGDM(void* K) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:417

Parameters

void* K

void Profile(llvm::FoldingSetNodeID& ID) const

Description

Profile - Used to profile the contents of this object for inclusion in a FoldingSet.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:181

Parameters

llvm::FoldingSetNodeID& ID

static void Profile(
    llvm::FoldingSetNodeID& ID,
    const clang::ento::ProgramState* V)

Description

Profile - Profile the contents of a ProgramState object for use in a FoldingSet. Two ProgramState objects are considered equal if they have the same Environment, Store, and GenericDataMap.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:172

Parameters

llvm::FoldingSetNodeID& ID
const clang::ento::ProgramState* V

ProgramState(
    clang::ento::ProgramStateManager* mgr,
    const clang::ento::Environment& env,
    clang::ento::StoreRef st,
    clang::ento::ProgramState::GenericDataMap gdm)

Description

This ctor is used when creating the first ProgramState object.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:134

Parameters

clang::ento::ProgramStateManager* mgr
const clang::ento::Environment& env
clang::ento::StoreRef st
clang::ento::ProgramState::GenericDataMap gdm

ProgramState(const clang::ento::ProgramState& RHS)

Description

Copy ctor - We must explicitly define this or else the "Next" ptr in FoldingSetNode will also get copied.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:139

Parameters

const clang::ento::ProgramState& RHS

template <typename T>
clang::ento::ProgramStateRef add(
    typename ProgramStateTrait<T>::key_type K)
    const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:421

Templates

T

Parameters

typename ProgramStateTrait<T>::key_type K

clang::ento::ConditionTruthVal areEqual(
    clang::ento::SVal Lhs,
    clang::ento::SVal Rhs) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:267

Parameters

clang::ento::SVal Lhs
clang::ento::SVal Rhs

Returns

Whether values \p Lhs and \p Rhs are equal.

clang::ento::ProgramStateRef assume(
    clang::ento::DefinedOrUnknownSVal cond,
    bool assumption) const

Description

Assumes that the value of \p cond is zero (if \p assumption is "false") or non-zero (if \p assumption is "true"). This returns a new state with the added constraint on \p cond. If no new state is feasible, NULL is returned.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:219

Parameters

clang::ento::DefinedOrUnknownSVal cond
bool assumption

std::pair<ProgramStateRef, ProgramStateRef>
assume(
    clang::ento::DefinedOrUnknownSVal cond) const

Description

Assumes both "true" and "false" for \p cond, and returns both corresponding states (respectively). This is more efficient than calling assume() twice. Note that one (but not both) of the returned states may be NULL.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:228

Parameters

clang::ento::DefinedOrUnknownSVal cond

clang::ento::ProgramStateRef assumeInBound(
    clang::ento::DefinedOrUnknownSVal idx,
    clang::ento::DefinedOrUnknownSVal upperBound,
    bool assumption,
    clang::QualType IndexType =
        clang::QualType()) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:235

Parameters

clang::ento::DefinedOrUnknownSVal idx
clang::ento::DefinedOrUnknownSVal upperBound
bool assumption
clang::QualType IndexType = clang::QualType()

std::pair<ProgramStateRef, ProgramStateRef>
assumeInBoundDual(
    clang::ento::DefinedOrUnknownSVal idx,
    clang::ento::DefinedOrUnknownSVal upperBound,
    clang::QualType IndexType =
        clang::QualType()) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:231

Parameters

clang::ento::DefinedOrUnknownSVal idx
clang::ento::DefinedOrUnknownSVal upperBound
clang::QualType IndexType = clang::QualType()

std::pair<ProgramStateRef, ProgramStateRef>
assumeInclusiveRange(
    clang::ento::DefinedOrUnknownSVal Val,
    const llvm::APSInt& From,
    const llvm::APSInt& To) const

Description

Assumes given range both "true" and "false" for \p Val, and returns both corresponding states (respectively). This is more efficient than calling assume() twice. Note that one (but not both) of the returned states may be NULL.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:255

Parameters

clang::ento::DefinedOrUnknownSVal Val
const llvm::APSInt& From
const llvm::APSInt& To

clang::ento::ProgramStateRef assumeInclusiveRange(
    clang::ento::DefinedOrUnknownSVal Val,
    const llvm::APSInt& From,
    const llvm::APSInt& To,
    bool assumption) const

Description

Assumes that the value of \p Val is bounded with [\p From; \p To] (if \p assumption is "true") or it is fully out of this range (if \p assumption is "false"). This returns a new state with the added constraint on \p cond. If no new state is feasible, NULL is returned.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:244

Parameters

clang::ento::DefinedOrUnknownSVal Val
const llvm::APSInt& From
const llvm::APSInt& To
bool assumption

clang::ento::ProgramStateRef bindDefaultInitial(
    clang::ento::SVal loc,
    clang::ento::SVal V,
    const clang::LocationContext* LCtx) const

Description

Initializes the region of memory represented by \p loc with an initial value. Once initialized, all values loaded from any sub-regions of that region will be equal to \p V, unless overwritten later by the program. This method should not be used on regions that are already initialized. If you need to indicate that memory contents have suddenly become unknown within a certain region of memory, consider invalidateRegions().

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:297

Parameters

clang::ento::SVal loc
clang::ento::SVal V
const clang::LocationContext* LCtx

clang::ento::ProgramStateRef bindDefaultZero(
    clang::ento::SVal loc,
    const clang::LocationContext* LCtx) const

Description

Performs C++ zero-initialization procedure on the region of memory represented by \p loc.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:302

Parameters

clang::ento::SVal loc
const clang::LocationContext* LCtx

clang::ento::ProgramStateRef bindLoc(
    clang::ento::Loc location,
    clang::ento::SVal V,
    const clang::LocationContext* LCtx,
    bool notifyChanges = true) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:283

Parameters

clang::ento::Loc location
clang::ento::SVal V
const clang::LocationContext* LCtx
bool notifyChanges = true

clang::ento::ProgramStateRef bindLoc(
    clang::ento::SVal location,
    clang::ento::SVal V,
    const clang::LocationContext* LCtx) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:287

Parameters

clang::ento::SVal location
clang::ento::SVal V
const clang::LocationContext* LCtx

clang::ento::ProgramStateRef
cloneAsPosteriorlyOverconstrained() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:122

template <typename T>
bool contains(
    typename ProgramStateTrait<T>::key_type key)
    const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:466

Templates

T

Parameters

typename ProgramStateTrait<T>::key_type key

void dump() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:479

clang::ento::ProgramStateRef enterStackFrame(
    const clang::ento::CallEvent& Call,
    const clang::StackFrameContext* CalleeCtx)
    const

Description

enterStackFrame - Returns the state for entry to the given stack frame, preserving the current state.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:340

Parameters

const clang::ento::CallEvent& Call
const clang::StackFrameContext* CalleeCtx

template <typename T>
typename ProgramStateTrait<T>::lookup_type get(
    typename ProgramStateTrait<T>::key_type key)
    const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:431

Templates

T

Parameters

typename ProgramStateTrait<T>::key_type key

template <typename T>
typename ProgramStateTrait<T>::data_type get()
    const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:425

Templates

T

clang::ento::AnalysisManager& getAnalysisManager()
    const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:150

clang::ento::BasicValueFactory& getBasicVals()
    const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:185

clang::ento::ConstraintManager&
getConstraintManager() const

Description

Return the ConstraintManager.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:153

const clang::ento::Environment& getEnvironment()
    const

Description

getEnvironment - Return the environment associated with this state. The environment is the mapping from expressions to values.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:157

clang::ento::ProgramState::GenericDataMap getGDM()
    const

Description

getGDM - Return the generic data map associated with this state.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:165

int64_t getID() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:143

clang::ento::SVal getLValue(
    const clang::IndirectFieldDecl* decl,
    clang::ento::SVal Base) const

Description

Get the lvalue for an indirect field reference.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:366

Parameters

const clang::IndirectFieldDecl* decl
clang::ento::SVal Base

clang::ento::SVal getLValue(
    const clang::FieldDecl* decl,
    clang::ento::SVal Base) const

Description

Get the lvalue for a field reference.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:363

Parameters

const clang::FieldDecl* decl
clang::ento::SVal Base

clang::ento::SVal getLValue(
    const clang::ObjCIvarDecl* decl,
    clang::ento::SVal base) const

Description

Get the lvalue for an ivar reference.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:360

Parameters

const clang::ObjCIvarDecl* decl
clang::ento::SVal base

clang::ento::Loc getLValue(
    const clang::CompoundLiteralExpr* literal,
    const clang::LocationContext* LC) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:356

Parameters

const clang::CompoundLiteralExpr* literal
const clang::LocationContext* LC

clang::ento::Loc getLValue(
    const clang::VarDecl* D,
    const clang::LocationContext* LC) const

Description

Get the lvalue for a variable reference.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:354

Parameters

const clang::VarDecl* D
const clang::LocationContext* LC

clang::ento::Loc getLValue(
    const clang::CXXRecordDecl* BaseClass,
    const clang::ento::SubRegion* Super,
    bool IsVirtual) const

Description

Get the lvalue for a base class object reference.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:350

Parameters

const clang::CXXRecordDecl* BaseClass
const clang::ento::SubRegion* Super
bool IsVirtual

clang::ento::Loc getLValue(
    const clang::CXXBaseSpecifier& BaseSpec,
    const clang::ento::SubRegion* Super) const

Description

Get the lvalue for a base class object reference.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:347

Parameters

const clang::CXXBaseSpecifier& BaseSpec
const clang::ento::SubRegion* Super

clang::ento::SVal getLValue(
    clang::QualType ElementType,
    clang::ento::SVal Idx,
    clang::ento::SVal Base) const

Description

Get the lvalue for an array index.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:369

Parameters

clang::QualType ElementType
clang::ento::SVal Idx
clang::ento::SVal Base

clang::ento::SVal getRawSVal(
    clang::ento::Loc LV,
    clang::QualType T = clang::QualType()) const

Description

Returns the "raw" SVal bound to LV before any value simplfication.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:381

Parameters

clang::ento::Loc LV
clang::QualType T = clang::QualType()

const clang::ento::VarRegion* getRegion(
    const clang::VarDecl* D,
    const clang::LocationContext* LC) const

Description

Utility method for getting regions.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:271

Parameters

const clang::VarDecl* D
const clang::LocationContext* LC

clang::ento::SVal getSVal(
    const clang::ento::MemRegion* R,
    clang::QualType T = clang::QualType()) const

Description

Return the value bound to the specified location. Returns UnknownVal() if none found.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:385

Parameters

const clang::ento::MemRegion* R
clang::QualType T = clang::QualType()

clang::ento::SVal getSVal(
    const clang::Stmt* S,
    const clang::LocationContext* LCtx) const

Description

Returns the SVal bound to the statement 'S' in the state's environment.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:372

Parameters

const clang::Stmt* S
const clang::LocationContext* LCtx

clang::ento::SVal getSVal(
    clang::ento::Loc LV,
    clang::QualType T = clang::QualType()) const

Description

Return the value bound to the specified location. Returns UnknownVal() if none found.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:378

Parameters

clang::ento::Loc LV
clang::QualType T = clang::QualType()

clang::ento::SVal getSValAsScalarOrLoc(
    const clang::ento::MemRegion* R) const

Description

Return the value bound to the specified location, assuming that the value is a scalar integer or an enumeration or a pointer. Returns UnknownVal() if none found or the region is not known to hold a value of such type.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:391

Parameters

const clang::ento::MemRegion* R

clang::ento::SVal getSValAsScalarOrLoc(
    const clang::Stmt* Ex,
    const clang::LocationContext* LCtx) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:374

Parameters

const clang::Stmt* Ex
const clang::LocationContext* LCtx

clang::ento::SVal getSelfSVal(
    const clang::LocationContext* LC) const

Description

Return the value of 'self' if available in the given context.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:344

Parameters

const clang::LocationContext* LC

clang::ento::ProgramStateManager&
getStateManager() const

Description

Return the ProgramStateManager associated with this state.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:146

clang::ento::Store getStore() const

Description

Return the store associated with this state. The store is a mapping from locations to values.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:161

clang::ento::SymbolManager& getSymbolManager()
    const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:186

template <typename T>
typename ProgramStateTrait<T>::context_type
get_context() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:437

Templates

T

clang::ento::ProgramStateRef invalidateRegions(
    ArrayRef<clang::ento::SVal> Regions,
    const clang::Expr* E,
    unsigned int BlockCount,
    const clang::LocationContext* LCtx,
    bool CausesPointerEscape,
    clang::ento::InvalidatedSymbols* IS = nullptr,
    const clang::ento::CallEvent* Call = nullptr,
    clang::ento::
        RegionAndSymbolInvalidationTraits*
            ITraits = nullptr) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:332

Parameters

ArrayRef<clang::ento::SVal> Regions
const clang::Expr* E
unsigned int BlockCount
const clang::LocationContext* LCtx
bool CausesPointerEscape
clang::ento::InvalidatedSymbols* IS = nullptr
const clang::ento::CallEvent* Call = nullptr
clang::ento::RegionAndSymbolInvalidationTraits* ITraits = nullptr

clang::ento::ProgramStateRef invalidateRegions(
    ArrayRef<const clang::ento::MemRegion*>
        Regions,
    const clang::Expr* E,
    unsigned int BlockCount,
    const clang::LocationContext* LCtx,
    bool CausesPointerEscape,
    clang::ento::InvalidatedSymbols* IS = nullptr,
    const clang::ento::CallEvent* Call = nullptr,
    clang::ento::
        RegionAndSymbolInvalidationTraits*
            ITraits = nullptr) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:325

Parameters

ArrayRef<const clang::ento::MemRegion*> Regions
const clang::Expr* E
unsigned int BlockCount
const clang::LocationContext* LCtx
bool CausesPointerEscape
the flag is set to true when the invalidation entails escape of a symbol (representing a pointer). For example, due to it being passed as an argument in a call.
clang::ento::InvalidatedSymbols* IS = nullptr
the set of invalidated symbols.
const clang::ento::CallEvent* Call = nullptr
if non-null, the invalidated regions represent parameters to the call and should be considered directly invalidated.
clang::ento::RegionAndSymbolInvalidationTraits* ITraits = nullptr
information about special handling for a particular region/symbol.

clang::ento::ProgramStateRef
invalidateRegionsImpl(
    ArrayRef<clang::ento::SVal> Values,
    const clang::Expr* E,
    unsigned int BlockCount,
    const clang::LocationContext* LCtx,
    bool ResultsInSymbolEscape,
    clang::ento::InvalidatedSymbols* IS,
    clang::ento::
        RegionAndSymbolInvalidationTraits*
            HTraits,
    const clang::ento::CallEvent* Call) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:488

Parameters

ArrayRef<clang::ento::SVal> Values
const clang::Expr* E
unsigned int BlockCount
const clang::LocationContext* LCtx
bool ResultsInSymbolEscape
clang::ento::InvalidatedSymbols* IS
clang::ento::RegionAndSymbolInvalidationTraits* HTraits
const clang::ento::CallEvent* Call

clang::ento::ConditionTruthVal isNonNull(
    clang::ento::SVal V) const

Description

Check if the given SVal is not constrained to zero and is not a zero constant.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:260

Parameters

clang::ento::SVal V

clang::ento::ConditionTruthVal isNull(
    clang::ento::SVal V) const

Description

Check if the given SVal is constrained to zero or is a zero constant.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:264

Parameters

clang::ento::SVal V

bool isPosteriorlyOverconstrained() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:119

clang::ento::ProgramStateRef killBinding(
    clang::ento::Loc LV) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:304

Parameters

clang::ento::Loc LV

clang::ento::ProgramStateRef makeWithStore(
    const clang::ento::StoreRef& store) const

Description

makeWithStore - Return a ProgramState with the same values as the current state with the exception of using the specified Store.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:128

Parameters

const clang::ento::StoreRef& store

void printDOT(
    llvm::raw_ostream& Out,
    const clang::LocationContext* LCtx = nullptr,
    unsigned int Space = 0) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:476

Parameters

llvm::raw_ostream& Out
const clang::LocationContext* LCtx = nullptr
unsigned int Space = 0

void printJson(
    llvm::raw_ostream& Out,
    const clang::LocationContext* LCtx = nullptr,
    const char* NL = "\n",
    unsigned int Space = 0,
    bool IsDot = false) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:472

Parameters

llvm::raw_ostream& Out
const clang::LocationContext* LCtx = nullptr
const char* NL = "\n"
unsigned int Space = 0
bool IsDot = false

template <typename T>
clang::ento::ProgramStateRef remove(
    typename ProgramStateTrait<T>::key_type K)
    const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:441

Templates

T

Parameters

typename ProgramStateTrait<T>::key_type K

template <typename T>
clang::ento::ProgramStateRef remove(
    typename ProgramStateTrait<T>::key_type K,
    typename ProgramStateTrait<T>::context_type C)
    const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:445

Templates

T

Parameters

typename ProgramStateTrait<T>::key_type K
typename ProgramStateTrait<T>::context_type C

template <typename T>
clang::ento::ProgramStateRef remove() const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:448

Templates

T

bool scanReachableSymbols(
    llvm::iterator_range<region_iterator>
        Reachable,
    clang::ento::SymbolVisitor& visitor) const

Description

Visits the symbols reachable from the regions in the given MemRegions range using the provided SymbolVisitor.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:406

Parameters

llvm::iterator_range<region_iterator> Reachable
clang::ento::SymbolVisitor& visitor

template <typename CB>
CB scanReachableSymbols(
    clang::ento::SVal val) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:409

Templates

CB

Parameters

clang::ento::SVal val

template <typename CB>
CB scanReachableSymbols(
    llvm::iterator_range<region_iterator>
        Reachable) const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:411

Templates

CB

Parameters

llvm::iterator_range<region_iterator> Reachable

bool scanReachableSymbols(
    clang::ento::SVal val,
    clang::ento::SymbolVisitor& visitor) const

Description

Visits the symbols reachable from the given SVal using the provided SymbolVisitor. This is a convenience API. Consider using ScanReachableSymbols class directly when making multiple scans on the same state with the same visitor to avoid repeated initialization cost.

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:402

Parameters

clang::ento::SVal val
clang::ento::SymbolVisitor& visitor

template <typename T>
clang::ento::ProgramStateRef set(
    typename ProgramStateTrait<T>::data_type D)
    const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:452

Templates

T

Parameters

typename ProgramStateTrait<T>::data_type D

template <typename T>
clang::ento::ProgramStateRef set(
    typename ProgramStateTrait<T>::key_type K,
    typename ProgramStateTrait<T>::value_type E)
    const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:456

Templates

T

Parameters

typename ProgramStateTrait<T>::key_type K
typename ProgramStateTrait<T>::value_type E

template <typename T>
clang::ento::ProgramStateRef set(
    typename ProgramStateTrait<T>::key_type K,
    typename ProgramStateTrait<T>::value_type E,
    typename ProgramStateTrait<T>::context_type C)
    const

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:461

Templates

T

Parameters

typename ProgramStateTrait<T>::key_type K
typename ProgramStateTrait<T>::value_type E
typename ProgramStateTrait<T>::context_type C

void setGDM(
    clang::ento::ProgramState::GenericDataMap gdm)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:167

Parameters

clang::ento::ProgramState::GenericDataMap gdm

void setStore(
    const clang::ento::StoreRef& storeRef)

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:130

Parameters

const clang::ento::StoreRef& storeRef

~ProgramState()

Declared at: clang/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h:141