clang  10.0.0svn
RangeConstraintManager.cpp File Reference
#include "clang/Basic/JsonSupport.h"
#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 451 of file RangeConstraintManager.cpp.

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

◆ assumeNonZero()

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

Return a range set subtracting zero from Domain.

Definition at line 433 of file RangeConstraintManager.cpp.

Referenced by applyBitwiseConstraints().