18 #include "llvm/Support/raw_ostream.h"
19 using namespace clang;
35 if (isa<SymbolConjured>(sym))
43 if (isa<SymbolConjured>(sym))
55 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(CTR->getDecl()))
72 return X->getLoc().getAsLocSymbol();
79 return SymR->getSymbol();
93 while (
const SubRegion *SR = dyn_cast<SubRegion>(R)) {
95 return SymR->getSymbol();
97 R = SR->getSuperRegion();
114 return X->getSymbol();
123 return X->getSymbol();
137 return X->getRegion();
140 return X->getLoc().getAsRegion();
147 return R ? R->
StripCasts(StripBaseCasts) :
nullptr;
175 return getAs<nonloc::ConcreteInt>() || getAs<loc::ConcreteInt>();
180 return LV->getValue() ==
I;
182 return NV->getValue() ==
I;
187 return isConstant(0);
198 const llvm::APSInt*
X =
239 LLVM_DUMP_METHOD
void SVal::dump()
const { dumpToStream(llvm::errs()); }
242 switch (getBaseKind()) {
247 castAs<NonLoc>().dumpToStream(os);
250 castAs<Loc>().dumpToStream(os);
252 case UndefinedValKind:
259 switch (getSubKind()) {
260 case nonloc::ConcreteIntKind: {
266 os <<
' ' << (C.
getValue().isUnsigned() ?
'U' :
'S')
267 << C.
getValue().getBitWidth() <<
'b';
270 case nonloc::SymbolValKind: {
271 os << castAs<nonloc::SymbolVal>().getSymbol();
274 case nonloc::LocAsIntegerKind: {
279 case nonloc::CompoundValKind: {
281 os <<
"compoundVal{";
285 os <<
' '; first =
false;
290 (*I).dumpToStream(os);
295 case nonloc::LazyCompoundValKind: {
297 os <<
"lazyCompoundVal{" <<
const_cast<void *
>(C.
getStore())
303 assert (
false &&
"Pretty-printed not implemented for this NonLoc.");
309 switch (getSubKind()) {
310 case loc::ConcreteIntKind:
311 os << castAs<loc::ConcreteInt>().
getValue().getZExtValue() <<
" (Loc)";
313 case loc::GotoLabelKind:
314 os <<
"&&" << castAs<loc::GotoLabel>().getLabel()->getName();
316 case loc::MemRegionValKind:
317 os << '&' << castAs<loc::MemRegionVal>().getRegion()->getString();
320 llvm_unreachable(
"Pretty-printing not implemented for this Loc.");
const SymExpr * getAsSymExpr() const
FunctionDecl - An instance of this class is created to represent a function declaration or definition...
TypedValueRegion - An abstract class representing regions having a typed value.
bool hasConjuredSymbol() const
hasConjuredSymbol - If this SVal wraps a conjured symbol, return true;
nonloc::ConcreteInt makeIntVal(const IntegerLiteral *integer)
MemRegion - The root abstract class for all memory regions.
const MemRegion * stripCasts(bool StripBaseCasts=true) const
Get the underlining region and strip casts.
const RegionTy * getAs() const
void dumpToStream(raw_ostream &Out) const
SymbolRef getLocSymbolInBase() const
Get the symbol in the SVal or its base region.
Value representing integer constant.
bool isZeroConstant() const
bool isComparisonOp() const
SymbolRef getAsLocSymbol(bool IncludeBaseRegions=false) const
If this SVal is a location and wraps a symbol, return that SymbolRef.
SVal evalBinOp(BasicValueFactory &BasicVals, BinaryOperator::Opcode Op, const ConcreteInt &R) const
const FunctionDecl * getAsFunctionDecl() const
getAsFunctionDecl - If this SVal is a MemRegionVal and wraps a CodeTextRegion wrapping a FunctionDecl...
const SymbolicRegion * getSymbolicBase() const
If this is a symbolic region, returns the region.
unsigned getNumBits() const
detail::InMemoryDirectory::const_iterator I
llvm::ImmutableList< SVal >::iterator iterator
const MemRegion * StripCasts(bool StripBaseCasts=true) const
SymbolicRegion - A special, "non-concrete" region.
static SVal getValue(SVal val, SValBuilder &svalBuilder)
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
FunctionCodeRegion - A region that represents code texts of function.
SVal evalBinOp(SValBuilder &svalBuilder, BinaryOperator::Opcode Op, const ConcreteInt &R) const
void dumpToStream(raw_ostream &Out) const
SVal - This represents a symbolic expression, which can be either an L-value or an R-value...
const llvm::APSInt * evalAPSInt(BinaryOperator::Opcode Op, const llvm::APSInt &V1, const llvm::APSInt &V2)
ConcreteInt evalMinus(SValBuilder &svalBuilder) const
const llvm::APSInt & getValue() const
detail::InMemoryDirectory::const_iterator E
const MemRegion * getAsRegion() const
ConcreteInt evalComplement(SValBuilder &svalBuilder) const
BasicValueFactory & getBasicValueFactory()
SubRegion - A region that subsets another larger region.
const TypedValueRegion * getRegion() const
void dumpToStream(raw_ostream &OS) const
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
SymbolRef getAsSymbol(bool IncludeBaseRegions=false) const
If this SVal wraps a symbol return that SymbolRef.
const SymExpr * getAsSymbolicExpression() const
getAsSymbolicExpression - If this Sval wraps a symbolic expression then return that expression...
const llvm::APSInt & getValue() const
const MemRegion * getRegion() const
Get the underlining region.
const void * getStore() const