clang 8.0.0

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

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

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

## Public Member Functions
| RangedConstraintManager (SubEngine *SE, SValBuilder &SB)
| ~RangedConstraintManager () override
ProgramStateRef | assumeSym (ProgramStateRef State, SymbolRef Sym, bool Assumption) override
| Given a symbolic expression that can be reasoned about, assume that it is true/false and generate the new program state. More...
ProgramStateRef | assumeSymInclusiveRange (ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From, const llvm::APSInt &To, bool InRange) override
| Given a symbolic expression within the range [From, To], assume that it is true/false and generate the new program state. More...
ProgramStateRef | assumeSymUnsupported (ProgramStateRef State, SymbolRef Sym, bool Assumption) override
| Given a symbolic expression that cannot be reasoned about, assume that it is zero/nonzero and add it directly to the solver state. More...
Public Member Functions inherited from clang::ento::SimpleConstraintManager
| 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 | assumeSymRel (ProgramStateRef State, SymbolRef Sym, BinaryOperator::Opcode op, const llvm::APSInt &Int)
| Assume a constraint between a symbolic expression and a concrete integer. More...
virtual ProgramStateRef | assumeSymNE (ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
virtual ProgramStateRef | assumeSymEQ (ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
virtual ProgramStateRef | assumeSymLT (ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
virtual ProgramStateRef | assumeSymGT (ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
virtual ProgramStateRef | assumeSymLE (ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
virtual ProgramStateRef | assumeSymGE (ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
virtual ProgramStateRef | assumeSymWithinInclusiveRange (ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From, const llvm::APSInt &To, const llvm::APSInt &Adjustment)=0
virtual ProgramStateRef | assumeSymOutsideInclusiveRange (ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From, const llvm::APSInt &To, const llvm::APSInt &Adjustment)=0
Protected Member Functions inherited from clang::ento::SimpleConstraintManager
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 138 of file RangedConstraintManager.h.

## Constructor & Destructor Documentation

## ◆ RangedConstraintManager()

clang::ento::RangedConstraintManager::RangedConstraintManager | ( | SubEngine * | SE,
|  | SValBuilder & | SB
| ) |  |
| inline

Definition at line 140 of file RangedConstraintManager.h.

References clang::ento::Range::From(), State, and clang::ento::Range::To().

## ◆ ~RangedConstraintManager()

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

Definition at line 22 of file RangedConstraintManager.cpp.

## Member Function Documentation

## ◆ assumeSym()

ProgramStateRef clang::ento::RangedConstraintManager::assumeSym | ( | ProgramStateRef | State,
|  | SymbolRef | Sym,
|  | bool | Assumption
| ) |  |
| override virtual

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

Implements clang::ento::SimpleConstraintManager.

Definition at line 24 of file RangedConstraintManager.cpp.

References assumeSymRel(), assumeSymUnsupported(), clang::ento::SimpleConstraintManager::getBasicVals(), clang::ento::SymbolManager::getContext(), clang::ASTContext::getPointerDiffType(), clang::ento::SimpleConstraintManager::getSymbolManager(), clang::ento::SymbolManager::getSymSymExpr(), clang::BinaryOperator::isComparisonOp(), clang::ento::Loc::isLocType(), clang::BinaryOperator::negateComparisonOp(), and clang::BinaryOperator::reverseComparisonOp().

Referenced by assumeSymRel().

## ◆ assumeSymEQ()

virtual ProgramStateRef clang::ento::RangedConstraintManager::assumeSymEQ | ( | ProgramStateRef | State,
|  | SymbolRef | Sym,
|  | const llvm::APSInt & | V,
|  | const llvm::APSInt & | Adjustment
| ) |  |
| protected pure virtual

Referenced by assumeSymRel(), and assumeSymUnsupported().

## ◆ assumeSymGE()

virtual ProgramStateRef clang::ento::RangedConstraintManager::assumeSymGE | ( | ProgramStateRef | State,
|  | SymbolRef | Sym,
|  | const llvm::APSInt & | V,
|  | const llvm::APSInt & | Adjustment
| ) |  |
| protected pure virtual

Referenced by assumeSymRel().

## ◆ assumeSymGT()

virtual ProgramStateRef clang::ento::RangedConstraintManager::assumeSymGT | ( | ProgramStateRef | State,
|  | SymbolRef | Sym,
|  | const llvm::APSInt & | V,
|  | const llvm::APSInt & | Adjustment
| ) |  |
| protected pure virtual

Referenced by assumeSymRel().

## ◆ assumeSymInclusiveRange()

ProgramStateRef clang::ento::RangedConstraintManager::assumeSymInclusiveRange | ( | ProgramStateRef | State,
|  | SymbolRef | Sym,
|  | const llvm::APSInt & | From,
|  | const llvm::APSInt & | To,
|  | bool | InRange
| ) |  |
| override 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.

Implements clang::ento::SimpleConstraintManager.

Definition at line 74 of file RangedConstraintManager.cpp.

References assumeSymOutsideInclusiveRange(), assumeSymWithinInclusiveRange(), clang::ento::APSIntType::convert(), clang::ento::BasicValueFactory::getAPSIntType(), clang::ento::SimpleConstraintManager::getBasicVals(), clang::ento::APSIntType::getBitWidth(), clang::ento::SymExpr::getType(), clang::ento::APSIntType::getZeroValue(), clang::ento::APSIntType::isUnsigned(), and max().

## ◆ assumeSymLE()

virtual ProgramStateRef clang::ento::RangedConstraintManager::assumeSymLE | ( | ProgramStateRef | State,
|  | SymbolRef | Sym,
|  | const llvm::APSInt & | V,
|  | const llvm::APSInt & | Adjustment
| ) |  |
| protected pure virtual

Referenced by assumeSymRel().

## ◆ assumeSymLT()

virtual ProgramStateRef clang::ento::RangedConstraintManager::assumeSymLT | ( | ProgramStateRef | State,
|  | SymbolRef | Sym,
|  | const llvm::APSInt & | V,
|  | const llvm::APSInt & | Adjustment
| ) |  |
| protected pure virtual

Referenced by assumeSymRel().

## ◆ assumeSymNE()

virtual ProgramStateRef clang::ento::RangedConstraintManager::assumeSymNE | ( | ProgramStateRef | State,
|  | SymbolRef | Sym,
|  | const llvm::APSInt & | V,
|  | const llvm::APSInt & | Adjustment
| ) |  |
| protected pure virtual

Referenced by assumeSymRel(), and assumeSymUnsupported().

## ◆ assumeSymOutsideInclusiveRange()

virtual ProgramStateRef clang::ento::RangedConstraintManager::assumeSymOutsideInclusiveRange | ( | ProgramStateRef | State,
|  | SymbolRef | Sym,
|  | const llvm::APSInt & | From,
|  | const llvm::APSInt & | To,
|  | const llvm::APSInt & | Adjustment
| ) |  |
| protected pure virtual

Referenced by assumeSymInclusiveRange().

## ◆ assumeSymRel()

ProgramStateRef clang::ento::RangedConstraintManager::assumeSymRel | ( | ProgramStateRef | State,
|  | SymbolRef | Sym,
|  | BinaryOperator::Opcode | op,
|  | const llvm::APSInt & | Int
| ) |  |
| protected virtual

Assume a constraint between a symbolic expression and a concrete integer.

Definition at line 120 of file RangedConstraintManager.cpp.

References assumeSym(), assumeSymEQ(), assumeSymGE(), assumeSymGT(), assumeSymLE(), assumeSymLT(), assumeSymNE(), clang::ento::APSIntType::convert(), clang::ento::BasicValueFactory::getAPSIntType(), clang::ento::SimpleConstraintManager::getBasicVals(), clang::ento::APSIntType::getBitWidth(), clang::ento::SymExpr::getType(), clang::ento::APSIntType::getZeroValue(), clang::BinaryOperator::isComparisonOp(), clang::ento::APSIntType::isUnsigned(), and max().

Referenced by assumeSym().

## ◆ assumeSymUnsupported()

ProgramStateRef clang::ento::RangedConstraintManager::assumeSymUnsupported | ( | ProgramStateRef | State,
|  | SymbolRef | Sym,
|  | bool | Assumption
| ) |  |
| override virtual

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

Implements clang::ento::SimpleConstraintManager.

Definition at line 103 of file RangedConstraintManager.cpp.

References assumeSymEQ(), assumeSymNE(), clang::ento::SimpleConstraintManager::getBasicVals(), clang::ento::SymExpr::getType(), and clang::Type::isIntegralOrEnumerationType().

Referenced by assumeSym().

## ◆ assumeSymWithinInclusiveRange()

virtual ProgramStateRef clang::ento::RangedConstraintManager::assumeSymWithinInclusiveRange | ( | ProgramStateRef | State,
|  | SymbolRef | Sym,
|  | const llvm::APSInt & | From,
|  | const llvm::APSInt & | To,
|  | const llvm::APSInt & | Adjustment
| ) |  |
| protected pure virtual

Referenced by assumeSymInclusiveRange().

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

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