clang  9.0.0svn
RangeConstraintManager.cpp File Reference
#include "clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h"
#include "llvm/ADT/FoldingSet.h"
#include "llvm/ADT/ImmutableSet.h"
#include "llvm/Support/raw_ostream.h"
Include dependency graph for RangeConstraintManager.cpp:

Go to the source code of this file.


static RangeSet assumeNonZero (BasicValueFactory &BV, RangeSet::Factory &F, SymbolRef Sym, RangeSet Domain)
 Return a range set subtracting zero from Domain. More...
static RangeSet applyBitwiseConstraints (BasicValueFactory &BV, RangeSet::Factory &F, RangeSet Input, const SymIntExpr *SIE)
 Apply implicit constraints for bitwise OR- and AND-. More...

Function Documentation

◆ applyBitwiseConstraints()

static RangeSet applyBitwiseConstraints ( BasicValueFactory &  BV,
RangeSet::Factory &  F,
RangeSet  Input,
const SymIntExpr *  SIE 

Apply implicit constraints for bitwise OR- and AND-.

For unsigned types, bitwise OR with a constant always returns a value greater-or-equal than the constant, and bitwise AND returns a value less-or-equal then the constant.

Pattern matches the expression Sym against those rule, and applies the required constraints. Input Previously established expression range set

Definition at line 450 of file RangeConstraintManager.cpp.

References assumeNonZero(), clang::Type::isReferenceType(), clang::Type::isSignedIntegerOrEnumerationType(), clang::Type::isUnsignedIntegerType(), clang::ento::RangeSet::RangeSet(), clang::ento::APSIntType::RTR_Above, clang::ento::APSIntType::RTR_Below, and clang::ento::APSIntType::RTR_Within.

◆ assumeNonZero()

static RangeSet assumeNonZero ( BasicValueFactory &  BV,
RangeSet::Factory &  F,
SymbolRef  Sym,
RangeSet  Domain 

Return a range set subtracting zero from Domain.

Definition at line 432 of file RangeConstraintManager.cpp.

Referenced by applyBitwiseConstraints().