clang 8.0.0

Public Member Functions | Protected Member Functions | List of all members
clang::ento::SimpleConstraintManager Class Referenceabstract

`#include "clang/StaticAnalyzer/Core/PathSensitive/SimpleConstraintManager.h"`

Inheritance diagram for clang::ento::SimpleConstraintManager:
[legend]
Collaboration diagram for clang::ento::SimpleConstraintManager:
[legend]

## Public Member Functions
| SimpleConstraintManager (SubEngine *subengine, SValBuilder &SB)
| ~SimpleConstraintManager () override
ProgramStateRef | assume (ProgramStateRef State, DefinedSVal Cond, bool Assumption) override
| Ensures that the DefinedSVal conditional is expressed as a NonLoc by creating boolean casts to handle Loc's. More...
ProgramStateRef | assumeInclusiveRange (ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To, bool InRange) override
Public Member Functions inherited from clang::ento::ConstraintManager
| ConstraintManager ()=default
virtual | ~ConstraintManager ()
ProgramStatePair | assumeDual (ProgramStateRef State, DefinedSVal Cond)
| Returns a pair of states (StTrue, StFalse) where the given condition is assumed to be true or false, respectively. More...
virtual ProgramStatePair | assumeInclusiveRangeDual (ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To)
virtual const llvm::APSInt * | getSymVal (ProgramStateRef state, SymbolRef sym) const
| If a symbol is perfectly constrained to a constant, attempt to return the concrete value. More...
virtual ProgramStateRef | removeDeadBindings (ProgramStateRef state, SymbolReaper &SymReaper)=0
| Scan all symbols referenced by the constraints. More...
virtual void | print (ProgramStateRef state, raw_ostream &Out, const char *nl, const char *sep)=0
virtual void | EndPath (ProgramStateRef state)
ConditionTruthVal | isNull (ProgramStateRef State, SymbolRef Sym)
| Convenience method to query the state to see if a symbol is null or not null, or if neither assumption can be made. More...

## Protected Member Functions
virtual ProgramStateRef | assumeSym (ProgramStateRef State, SymbolRef Sym, bool Assumption)=0
| Given a symbolic expression that can be reasoned about, assume that it is true/false and generate the new program state. More...
virtual ProgramStateRef | assumeSymInclusiveRange (ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From, const llvm::APSInt &To, bool InRange)=0
| Given a symbolic expression within the range [From, To], assume that it is true/false and generate the new program state. More...
virtual ProgramStateRef | assumeSymUnsupported (ProgramStateRef State, SymbolRef Sym, bool Assumption)=0
| Given a symbolic expression that cannot be reasoned about, assume that it is zero/nonzero and add it directly to the solver state. More...
SValBuilder & | getSValBuilder () const
BasicValueFactory & | getBasicVals () const
SymbolManager & | getSymbolManager () const
Protected Member Functions inherited from clang::ento::ConstraintManager
virtual bool | canReasonAbout (SVal X) const =0
| canReasonAbout - Not all ConstraintManagers can accurately reason about all SVal values. More...
virtual ConditionTruthVal | checkNull (ProgramStateRef State, SymbolRef Sym)
| Returns whether or not a symbol is known to be null ("true"), known to be non-null ("false"), or may be either ("underconstrained"). More...

## Additional Inherited Members
Public Types inherited from clang::ento::ConstraintManager
using | ProgramStatePair = std::pair< ProgramStateRef, ProgramStateRef >
Protected Attributes inherited from clang::ento::ConstraintManager
bool | NotifyAssumeClients = true
| A flag to indicate that clients should be notified of assumptions. More...

## Detailed Description

Definition at line 24 of file SimpleConstraintManager.h.

## Constructor & Destructor Documentation

## ◆ SimpleConstraintManager()

clang::ento::SimpleConstraintManager::SimpleConstraintManager | ( | SubEngine * | subengine,
|  | SValBuilder & | SB
| ) |  |
| inline

Definition at line 29 of file SimpleConstraintManager.h.

References assume(), assumeInclusiveRange(), assumeSym(), assumeSymInclusiveRange(), assumeSymUnsupported(), State, and ~SimpleConstraintManager().

## ◆ ~SimpleConstraintManager()

clang::ento::SimpleConstraintManager::~SimpleConstraintManager | ( |  | ) |
| override

Definition at line 24 of file SimpleConstraintManager.cpp.

Referenced by SimpleConstraintManager().

## Member Function Documentation

## ◆ assume()

ProgramStateRef clang::ento::SimpleConstraintManager::assume | ( | ProgramStateRef | State,
|  | DefinedSVal | Cond,
|  | bool | Assumption
| ) |  |
| override virtual

Ensures that the DefinedSVal conditional is expressed as a NonLoc by creating boolean casts to handle Loc's.

Implements clang::ento::ConstraintManager.

Definition at line 26 of file SimpleConstraintManager.cpp.

References assumeSym(), assumeSymUnsupported(), clang::ASTContext::BoolTy, clang::ento::ConstraintManager::canReasonAbout(), clang::ento::SVal::castAs(), clang::ento::SValBuilder::evalCast(), clang::ento::SVal::getAs(), clang::ento::SVal::getAsSymExpr(), clang::ento::SValBuilder::getContext(), clang::ento::nonloc::LocAsInteger::getLoc(), clang::ento::SVal::getSubKind(), clang::ento::nonloc::SymbolVal::getSymbol(), getValue(), clang::ento::ConstraintManager::NotifyAssumeClients, clang::ento::SubEngine::processAssume(), State, and clang::ASTContext::VoidPtrTy.

Referenced by getSymbolManager(), and SimpleConstraintManager().

## ◆ assumeInclusiveRange()

ProgramStateRef clang::ento::SimpleConstraintManager::assumeInclusiveRange | ( | ProgramStateRef | State,
|  | NonLoc | Value,
|  | const llvm::APSInt & | From,
|  | const llvm::APSInt & | To,
|  | bool | InRange
| ) |  |
| override virtual

Implements clang::ento::ConstraintManager.

Definition at line 95 of file SimpleConstraintManager.cpp.

References assumeSymInclusiveRange(), clang::ento::ConstraintManager::canReasonAbout(), clang::ento::SVal::castAs(), clang::ento::SVal::getAsSymbol(), clang::ento::SVal::getAsSymExpr(), clang::ento::SVal::getSubKind(), getValue(), and State.

Referenced by SimpleConstraintManager().

## ◆ assumeSym()

virtual ProgramStateRef clang::ento::SimpleConstraintManager::assumeSym | ( | ProgramStateRef | State,
|  | SymbolRef | Sym,
|  | bool | Assumption
| ) |  |
| protected pure virtual

Given a symbolic expression that can be reasoned about, assume that it is true/false and generate the new program state.

Implemented in clang::ento::RangedConstraintManager, and clang::ento::SMTConstraintManager< ConstraintSMT, SMTExprTy >.

Referenced by assume(), and SimpleConstraintManager().

## ◆ assumeSymInclusiveRange()

virtual ProgramStateRef clang::ento::SimpleConstraintManager::assumeSymInclusiveRange | ( | ProgramStateRef | State,
|  | SymbolRef | Sym,
|  | const llvm::APSInt & | From,
|  | const llvm::APSInt & | To,
|  | bool | InRange
| ) |  |
| protected pure virtual

Given a symbolic expression within the range [From, To], assume that it is true/false and generate the new program state.

This function is used to handle case ranges produced by a language extension for switch case statements.

Implemented in clang::ento::RangedConstraintManager, and clang::ento::SMTConstraintManager< ConstraintSMT, SMTExprTy >.

Referenced by assumeInclusiveRange(), and SimpleConstraintManager().

## ◆ assumeSymUnsupported()

virtual ProgramStateRef clang::ento::SimpleConstraintManager::assumeSymUnsupported | ( | ProgramStateRef | State,
|  | SymbolRef | Sym,
|  | bool | Assumption
| ) |  |
| protected pure virtual

Given a symbolic expression that cannot be reasoned about, assume that it is zero/nonzero and add it directly to the solver state.

Implemented in clang::ento::RangedConstraintManager, and clang::ento::SMTConstraintManager< ConstraintSMT, SMTExprTy >.

Referenced by assume(), and SimpleConstraintManager().

## ◆ getBasicVals()

BasicValueFactory& clang::ento::SimpleConstraintManager::getBasicVals | ( |  | ) | const
| inline protected

Definition at line 79 of file SimpleConstraintManager.h.

References clang::ento::SValBuilder::getBasicValueFactory().

Referenced by clang::ento::SMTConstraintManager< ConstraintSMT, SMTExprTy >::assumeSym(), clang::ento::RangedConstraintManager::assumeSym(), clang::ento::SMTConstraintManager< ConstraintSMT, SMTExprTy >::assumeSymInclusiveRange(), clang::ento::RangedConstraintManager::assumeSymInclusiveRange(), clang::ento::RangedConstraintManager::assumeSymRel(), clang::ento::RangedConstraintManager::assumeSymUnsupported(), clang::ento::SMTConstraintManager< ConstraintSMT, SMTExprTy >::canReasonAbout(), clang::ento::SMTConstraintManager< ConstraintSMT, SMTExprTy >::checkNull(), and clang::ento::SMTConstraintManager< ConstraintSMT, SMTExprTy >::getSymVal().

## ◆ getSValBuilder()

SValBuilder& clang::ento::SimpleConstraintManager::getSValBuilder | ( |  | ) | const
| inline protected

Definition at line 78 of file SimpleConstraintManager.h.

Referenced by clang::ento::SMTConstraintManager< ConstraintSMT, SMTExprTy >::canReasonAbout().

## ◆ getSymbolManager()

SymbolManager& clang::ento::SimpleConstraintManager::getSymbolManager | ( |  | ) | const
| inline protected

Definition at line 80 of file SimpleConstraintManager.h.

References assume(), and clang::ento::SValBuilder::getSymbolManager().

Referenced by clang::ento::RangedConstraintManager::assumeSym().

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

- include/clang/StaticAnalyzer/Core/PathSensitive/SimpleConstraintManager.h
- lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp