#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
#include "clang/Analysis/CFG.h"
#include "clang/Basic/JsonSupport.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/DynamicType.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
#include "llvm/Support/raw_ostream.h"
#include <optional>
usingnamespaceclang;
usingnamespaceento;
namespace clang { namespace ento {
void ProgramStateRetain(const ProgramState *state) { … }
void ProgramStateRelease(const ProgramState *state) { … }
}}
ProgramState::ProgramState(ProgramStateManager *mgr, const Environment& env,
StoreRef st, GenericDataMap gdm)
: … { … }
ProgramState::ProgramState(const ProgramState &RHS)
: … { … }
ProgramState::~ProgramState() { … }
int64_t ProgramState::getID() const { … }
ProgramStateManager::ProgramStateManager(ASTContext &Ctx,
StoreManagerCreator CreateSMgr,
ConstraintManagerCreator CreateCMgr,
llvm::BumpPtrAllocator &alloc,
ExprEngine *ExprEng)
: … { … }
ProgramStateManager::~ProgramStateManager() { … }
ProgramStateRef ProgramStateManager::removeDeadBindingsFromEnvironmentAndStore(
ProgramStateRef state, const StackFrameContext *LCtx,
SymbolReaper &SymReaper) { … }
ProgramStateRef ProgramState::bindLoc(Loc LV,
SVal V,
const LocationContext *LCtx,
bool notifyChanges) const { … }
ProgramStateRef
ProgramState::bindDefaultInitial(SVal loc, SVal V,
const LocationContext *LCtx) const { … }
ProgramStateRef
ProgramState::bindDefaultZero(SVal loc, const LocationContext *LCtx) const { … }
RegionList;
ValueList;
ProgramStateRef
ProgramState::invalidateRegions(RegionList Regions,
const Expr *E, unsigned Count,
const LocationContext *LCtx,
bool CausedByPointerEscape,
InvalidatedSymbols *IS,
const CallEvent *Call,
RegionAndSymbolInvalidationTraits *ITraits) const { … }
ProgramStateRef
ProgramState::invalidateRegions(ValueList Values,
const Expr *E, unsigned Count,
const LocationContext *LCtx,
bool CausedByPointerEscape,
InvalidatedSymbols *IS,
const CallEvent *Call,
RegionAndSymbolInvalidationTraits *ITraits) const { … }
ProgramStateRef ProgramState::killBinding(Loc LV) const { … }
SVal ProgramState::wrapSymbolicRegion(SVal Val) const { … }
ProgramStateRef
ProgramState::enterStackFrame(const CallEvent &Call,
const StackFrameContext *CalleeCtx) const { … }
SVal ProgramState::getSelfSVal(const LocationContext *LCtx) const { … }
SVal ProgramState::getSValAsScalarOrLoc(const MemRegion *R) const { … }
SVal ProgramState::getSVal(Loc location, QualType T) const { … }
ProgramStateRef ProgramState::BindExpr(const Stmt *S,
const LocationContext *LCtx,
SVal V, bool Invalidate) const{ … }
[[nodiscard]] std::pair<ProgramStateRef, ProgramStateRef>
ProgramState::assumeInBoundDual(DefinedOrUnknownSVal Idx,
DefinedOrUnknownSVal UpperBound,
QualType indexTy) const { … }
ProgramStateRef ProgramState::assumeInBound(DefinedOrUnknownSVal Idx,
DefinedOrUnknownSVal UpperBound,
bool Assumption,
QualType indexTy) const { … }
ConditionTruthVal ProgramState::isNonNull(SVal V) const { … }
ConditionTruthVal ProgramState::areEqual(SVal Lhs, SVal Rhs) const { … }
ConditionTruthVal ProgramState::isNull(SVal V) const { … }
ProgramStateRef ProgramStateManager::getInitialState(const LocationContext *InitLoc) { … }
ProgramStateRef ProgramStateManager::getPersistentStateWithGDM(
ProgramStateRef FromState,
ProgramStateRef GDMState) { … }
ProgramStateRef ProgramStateManager::getPersistentState(ProgramState &State) { … }
ProgramStateRef ProgramState::makeWithStore(const StoreRef &store) const { … }
ProgramStateRef ProgramState::cloneAsPosteriorlyOverconstrained() const { … }
void ProgramState::setStore(const StoreRef &newStore) { … }
SVal ProgramState::getLValue(const FieldDecl *D, SVal Base) const { … }
SVal ProgramState::getLValue(const IndirectFieldDecl *D, SVal Base) const { … }
void ProgramState::printJson(raw_ostream &Out, const LocationContext *LCtx,
const char *NL, unsigned int Space,
bool IsDot) const { … }
void ProgramState::printDOT(raw_ostream &Out, const LocationContext *LCtx,
unsigned int Space) const { … }
LLVM_DUMP_METHOD void ProgramState::dump() const { … }
AnalysisManager& ProgramState::getAnalysisManager() const { … }
void *const* ProgramState::FindGDM(void *K) const { … }
void*
ProgramStateManager::FindGDMContext(void *K,
void *(*CreateContext)(llvm::BumpPtrAllocator&),
void (*DeleteContext)(void*)) { … }
ProgramStateRef ProgramStateManager::addGDM(ProgramStateRef St, void *Key, void *Data){ … }
ProgramStateRef ProgramStateManager::removeGDM(ProgramStateRef state, void *Key) { … }
bool ScanReachableSymbols::scan(nonloc::LazyCompoundVal val) { … }
bool ScanReachableSymbols::scan(nonloc::CompoundVal val) { … }
bool ScanReachableSymbols::scan(const SymExpr *sym) { … }
bool ScanReachableSymbols::scan(SVal val) { … }
bool ScanReachableSymbols::scan(const MemRegion *R) { … }
bool ProgramState::scanReachableSymbols(SVal val, SymbolVisitor& visitor) const { … }
bool ProgramState::scanReachableSymbols(
llvm::iterator_range<region_iterator> Reachable,
SymbolVisitor &visitor) const { … }