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;
231 const llvm::APSInt*
X =
285 case UndefinedValKind:
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.");
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.");
An instance of this class is created to represent a function declaration or definition.
TypedValueRegion - An abstract class representing regions having a typed value.
nonloc::ConcreteInt makeIntVal(const IntegerLiteral *integer)
MemRegion - The root abstract class for all memory regions.
SymbolRef getLocSymbolInBase() const
Get the symbol in the SVal or its base region.
Value representing integer constant.
const DeclaratorDecl * getDecl() const
SymbolRef getAsLocSymbol(bool IncludeBaseRegions=false) const
If this SVal is a location and wraps a symbol, return that SymbolRef.
const SymbolicRegion * getSymbolicBase() const
If this is a symbolic region, returns the region.
void dumpToStream(raw_ostream &OS) const
ConcreteInt evalComplement(SValBuilder &svalBuilder) const
Value representing pointer-to-member.
unsigned getNumBits() const
llvm::ImmutableList< const CXXBaseSpecifier * >::iterator iterator
const SymExpr * getAsSymbolicExpression() const
getAsSymbolicExpression - If this Sval wraps a symbolic expression then return that expression...
void dumpToStream(raw_ostream &Out) const
void dumpToStream(raw_ostream &Out) const
SymbolRef getAsSymbol(bool IncludeBaseRegions=false) const
If this SVal wraps a symbol return that SymbolRef.
bool hasConjuredSymbol() const
hasConjuredSymbol - If this SVal wraps a conjured symbol, return true;
llvm::ImmutableList< SVal >::iterator iterator
Represents a ValueDecl that came out of a declarator.
unsigned getSubKind() const
const RegionTy * getAs() const
SymbolicRegion - A special, "non-concrete" region.
const MemRegion * stripCasts(bool StripBaseCasts=true) const
Get the underlining region and strip casts.
llvm::PointerUnion< const DeclaratorDecl *, const PointerToMemberData * > PTMDataType
static SVal getValue(SVal val, SValBuilder &svalBuilder)
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
bool isComparisonOp() const
const MemRegion * StripCasts(bool StripBaseCasts=true) const
FunctionCodeRegion - A region that represents code texts of function.
const MemRegion * getAsRegion() const
Represents a static or instance method of a struct/union/class.
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)
BaseKind getBaseKind() const
Dataflow Directional Tag Classes.
bool isZeroConstant() const
const void * getStore() const
SVal evalBinOp(BasicValueFactory &BasicVals, BinaryOperator::Opcode Op, const ConcreteInt &R) const
const llvm::APSInt & getValue() const
const FunctionDecl * getAsFunctionDecl() const
getAsFunctionDecl - If this SVal is a MemRegionVal and wraps a CodeTextRegion wrapping a FunctionDecl...
BasicValueFactory & getBasicValueFactory()
SubRegion - A region that subsets another larger region.
SVal evalBinOp(SValBuilder &svalBuilder, BinaryOperator::Opcode Op, const ConcreteInt &R) const
const SymExpr * getAsSymExpr() 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).
const TypedValueRegion * getRegion() const
std::string getQualifiedNameAsString() const
ConcreteInt evalMinus(SValBuilder &svalBuilder) const
const llvm::APSInt & getValue() const