clang 10.0.0git

Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
clang::ento::ConstraintManager Class Referenceabstract

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

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

## Public Types
using | ProgramStatePair = std::pair< ProgramStateRef, ProgramStateRef >

## Public Member Functions
| ConstraintManager ()=default
virtual | ~ConstraintManager ()
virtual bool | haveEqualConstraints (ProgramStateRef S1, ProgramStateRef S2) const =0
virtual ProgramStateRef | assume (ProgramStateRef state, DefinedSVal Cond, bool Assumption)=0
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 ProgramStateRef | assumeInclusiveRange (ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To, bool InBound)=0
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 | printJson (raw_ostream &Out, ProgramStateRef State, const char *NL, unsigned int Space, bool IsDot) const =0
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 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...

## Protected Attributes
bool | NotifyAssumeClients = true
| A flag to indicate that clients should be notified of assumptions. More...

## Detailed Description

Definition at line 77 of file ConstraintManager.h.

## Member Typedef Documentation

## ◆ ProgramStatePair

using clang::ento::ConstraintManager::ProgramStatePair = std::pair<ProgramStateRef, ProgramStateRef>

Definition at line 89 of file ConstraintManager.h.

## Constructor & Destructor Documentation

## ◆ ConstraintManager()

clang::ento::ConstraintManager::ConstraintManager | ( |  | ) |
| default

## ◆ ~ConstraintManager()

ConstraintManager::~ConstraintManager | ( |  | ) |
| virtual default

## Member Function Documentation

## ◆ assume()

virtual ProgramStateRef clang::ento::ConstraintManager::assume | ( | ProgramStateRef | state,
|  | DefinedSVal | Cond,
|  | bool | Assumption
| ) |  |
| pure virtual

Implemented in clang::ento::SimpleConstraintManager.

Referenced by clang::ento::ProgramState::assumeInBound().

## ◆ assumeDual()

ProgramStatePair clang::ento::ConstraintManager::assumeDual | ( | ProgramStateRef | State,
|  | DefinedSVal | Cond
| ) |  |
| inline

Returns a pair of states (StTrue, StFalse) where the given condition is assumed to be true or false, respectively.

Definition at line 93 of file ConstraintManager.h.

References State.

Referenced by checkNull().

## ◆ assumeInclusiveRange()

virtual ProgramStateRef clang::ento::ConstraintManager::assumeInclusiveRange | ( | ProgramStateRef | State,
|  | NonLoc | Value,
|  | const llvm::APSInt & | From,
|  | const llvm::APSInt & | To,
|  | bool | InBound
| ) |  |
| pure virtual

Implemented in clang::ento::SimpleConstraintManager.

## ◆ assumeInclusiveRangeDual()

virtual ProgramStatePair clang::ento::ConstraintManager::assumeInclusiveRangeDual | ( | ProgramStateRef | State,
|  | NonLoc | Value,
|  | const llvm::APSInt & | From,
|  | const llvm::APSInt & | To
| ) |  |
| inline virtual

Definition at line 126 of file ConstraintManager.h.

## ◆ canReasonAbout()

virtual bool clang::ento::ConstraintManager::canReasonAbout | ( | SVal | X | ) | const
| protected pure virtual

canReasonAbout - Not all ConstraintManagers can accurately reason about all SVal values.

This method returns true if the ConstraintManager can reasonably handle a given SVal value. This is typically queried by ExprEngine to determine if the value should be replaced with a conjured symbolic value in order to recover some precision.

Implemented in clang::ento::SMTConstraintManager.

Referenced by clang::ento::SimpleConstraintManager::assume(), and clang::ento::SimpleConstraintManager::assumeInclusiveRange().

## ◆ checkNull()

ConditionTruthVal ConstraintManager::checkNull | ( | ProgramStateRef | State,
|  | SymbolRef | Sym
| ) |  |
| protected virtual

Returns whether or not a symbol is known to be null ("true"), known to be non-null ("false"), or may be either ("underconstrained").

Reimplemented in clang::ento::SMTConstraintManager.

Definition at line 32 of file ConstraintManager.cpp.

References assumeDual(), getLocFromSymbol(), clang::ento::SymExpr::getType(), clang::ento::Loc::isLocType(), P, and V.

## ◆ getSymVal()

virtual const llvm::APSInt* clang::ento::ConstraintManager::getSymVal | ( | ProgramStateRef | state,
|  | SymbolRef | sym
| ) |  | const
| inline virtual

If a symbol is perfectly constrained to a constant, attempt to return the concrete value.

Note that a ConstraintManager is not obligated to return a concretized value for a symbol, even if it is perfectly constrained.

Reimplemented in clang::ento::SMTConstraintManager.

Definition at line 155 of file ConstraintManager.h.

## ◆ haveEqualConstraints()

virtual bool clang::ento::ConstraintManager::haveEqualConstraints | ( | ProgramStateRef | S1,
|  | ProgramStateRef | S2
| ) |  | const
| pure virtual

Implemented in clang::ento::SMTConstraintManager.

## ◆ isNull()

ConditionTruthVal clang::ento::ConstraintManager::isNull | ( | ProgramStateRef | State,
|  | SymbolRef | Sym
| ) |  |
| inline

Convenience method to query the state to see if a symbol is null or not null, or if neither assumption can be made.

Definition at line 171 of file ConstraintManager.h.

Referenced by clang::ento::retaincountchecker::RetainCountChecker::checkPostStmt().

## ◆ printJson()

virtual void clang::ento::ConstraintManager::printJson | ( | raw_ostream & | Out,
|  | ProgramStateRef | State,
|  | const char * | NL,
|  | unsigned int | Space,
|  | bool | IsDot
| ) |  | const
| pure virtual

Implemented in clang::ento::SMTConstraintManager.

Referenced by clang::ento::ProgramState::printJson().

## ◆ removeDeadBindings()

virtual ProgramStateRef clang::ento::ConstraintManager::removeDeadBindings | ( | ProgramStateRef | state,
|  | SymbolReaper & | SymReaper
| ) |  |
| pure virtual

Scan all symbols referenced by the constraints.

If the symbol is not alive, remove it.

Implemented in clang::ento::SMTConstraintManager.

Referenced by clang::ento::ExprEngine::removeDead().

## Member Data Documentation

## ◆ NotifyAssumeClients

bool clang::ento::ConstraintManager::NotifyAssumeClients = true
| protected

A flag to indicate that clients should be notified of assumptions.

By default this is the case, but sometimes this needs to be restricted to avoid infinite recursions within the ConstraintManager.

Note that this flag allows the ConstraintManager to be re-entrant, but not thread-safe.

Definition at line 184 of file ConstraintManager.h.

Referenced by clang::ento::SimpleConstraintManager::assume().

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

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