18 #include "llvm/Support/raw_ostream.h"
20 using namespace clang;
36 if (isa<SymbolConjured>(sym))
44 if (isa<SymbolConjured>(sym))
56 if (
const FunctionDecl *FD = dyn_cast<FunctionDecl>(CTR->getDecl()))
60 if (
auto X = getAs<nonloc::PointerToMember>()) {
61 if (
const CXXMethodDecl *MD = dyn_cast_or_null<CXXMethodDecl>(
X->getDecl()))
77 return X->getLoc().getAsLocSymbol();
84 return SymR->getSymbol();
98 while (
const SubRegion *SR = dyn_cast<SubRegion>(R)) {
100 return SymR->getSymbol();
102 R = SR->getSuperRegion();
119 return X->getSymbol();
128 return X->getSymbol();
142 return X->getRegion();
145 return X->getLoc().getAsRegion();
152 return R ? R->
StripCasts(StripBaseCasts) :
nullptr;
164 const auto PTMD = this->getPTMData();
208 return getAs<nonloc::ConcreteInt>() || getAs<loc::ConcreteInt>();
213 return LV->getValue() ==
I;
215 return NV->getValue() ==
I;
220 return isConstant(0);
231 const llvm::APSInt*
X =
272 LLVM_DUMP_METHOD
void SVal::dump()
const { dumpToStream(llvm::errs()); }
275 switch (getBaseKind()) {
280 castAs<NonLoc>().dumpToStream(os);
283 castAs<Loc>().dumpToStream(os);
285 case UndefinedValKind:
292 switch (getSubKind()) {
293 case nonloc::ConcreteIntKind: {
299 os <<
' ' << (C.
getValue().isUnsigned() ?
'U' :
'S')
300 << C.
getValue().getBitWidth() <<
'b';
303 case nonloc::SymbolValKind: {
304 os << castAs<nonloc::SymbolVal>().getSymbol();
307 case nonloc::LocAsIntegerKind: {
312 case nonloc::CompoundValKind: {
314 os <<
"compoundVal{";
318 os <<
' '; first =
false;
323 (*I).dumpToStream(os);
328 case nonloc::LazyCompoundValKind: {
330 os <<
"lazyCompoundVal{" <<
const_cast<void *
>(C.
getStore())
335 case nonloc::PointerToMemberKind: {
336 os <<
"pointerToMember{";
338 castAs<nonloc::PointerToMember>();
342 for (
const auto &
I : CastRes) {
344 os <<
' '; first =
false;
349 os << (*I).getType().getAsString();
356 assert (
false &&
"Pretty-printed not implemented for this NonLoc.");
362 switch (getSubKind()) {
363 case loc::ConcreteIntKind:
364 os << castAs<loc::ConcreteInt>().
getValue().getZExtValue() <<
" (Loc)";
366 case loc::GotoLabelKind:
367 os <<
"&&" << castAs<loc::GotoLabel>().getLabel()->getName();
369 case loc::MemRegionValKind:
370 os << '&' << castAs<loc::MemRegionVal>().getRegion()->getString();
373 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
Value representing pointer-to-member.
SymbolRef getAsLocSymbol(bool IncludeBaseRegions=false) const
If this SVal is a location and wraps a symbol, return that SymbolRef.
llvm::ImmutableList< const CXXBaseSpecifier * >::iterator iterator
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
Represents a ValueDecl that came out of a declarator.
const MemRegion * StripCasts(bool StripBaseCasts=true) const
SymbolicRegion - A special, "non-concrete" region.
llvm::PointerUnion< const DeclaratorDecl *, const PointerToMemberData * > PTMDataType
static SVal getValue(SVal val, SValBuilder &svalBuilder)
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
const DeclaratorDecl * getDecl() const
FunctionCodeRegion - A region that represents code texts of function.
SVal evalBinOp(SValBuilder &svalBuilder, BinaryOperator::Opcode Op, const ConcreteInt &R) const
Represents a static or instance method of a struct/union/class.
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
std::string getQualifiedNameAsString() 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 ...
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate.h) and friends (in DeclFriend.h).
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