;
47 if(std::optional<loc::MemRegionVal>
X= getAs<loc::MemRegionVal>()) {
50 if(
const auto*FD = dyn_cast<FunctionDecl>(CTR->getDecl()))
54 if(
auto X= getAs<nonloc::PointerToMember>()) {
55 if(
const auto*MD = dyn_cast_or_null<CXXMethodDecl>(
X->getDecl()))
73: dyn_cast<SymbolicRegion>(R->StripCasts()))
74 returnSymR->getSymbol();
81std::optional<loc::MemRegionVal>
X= getAs<loc::MemRegionVal>();
88 while(
const auto*SR = dyn_cast<SubRegion>(R)) {
89 if(
const auto*SymR = dyn_cast<SymbolicRegion>(SR))
90 returnSymR->getSymbol();
92R = SR->getSuperRegion();
106 if(std::optional<nonloc::SymbolVal>
X= getAs<nonloc::SymbolVal>())
107 return X->getSymbol();
113 if(
autoCI = getAs<nonloc::ConcreteInt>())
114 returnCI->getValue().get();
115 if(
autoCI = getAs<loc::ConcreteInt>())
116 returnCI->getValue().get();
121 if(std::optional<loc::MemRegionVal>
X= getAs<loc::MemRegionVal>())
122 return X->getRegion();
124 if(std::optional<nonloc::LocAsInteger>
X= getAs<nonloc::LocAsInteger>())
125 return X->getLoc().getAsRegion();
131classTypeRetrievingVisitor
137TypeRetrievingVisitor(
const ASTContext&Context) : Context(Context) {}
145 template<
classConcreteInt>
QualTypeVisitConcreteInt(ConcreteInt CI) {
146 constllvm::APSInt &
Value= CI.getValue();
147 if(1 ==
Value.getBitWidth())
153 if(NestedType.
isNull())
182TypeRetrievingVisitor TRV{Context};
183 returnTRV.Visit(*
this);
199 returngetPTMData().isNull();
203 const autoPTMD = this->getPTMData();
208 if(
const auto*NDP = dyn_cast<const NamedDecl *>(PTMD))
211ND = cast<const PointerToMemberData *>(PTMD)->getDeclaratorDecl();
221 returngetValue()->begin();
225 returngetValue()->end();
230 if(isa<const NamedDecl *>(PTMD))
232 returncast<const PointerToMemberData *>(PTMD)->begin();
237 if(isa<const NamedDecl *>(PTMD))
239 returncast<const PointerToMemberData *>(PTMD)->end();
247 returngetAs<nonloc::ConcreteInt>() || getAs<loc::ConcreteInt>();
251 if(std::optional<loc::ConcreteInt> LV = getAs<loc::ConcreteInt>())
252 return*LV->getValue().get() == I;
253 if(std::optional<nonloc::ConcreteInt> NV = getAs<nonloc::ConcreteInt>())
254 return*NV->getValue().get() == I;
259 returnisConstant(0);
268#define BASIC_SVAL(Id, Parent) \ 271#define LOC_SVAL(Id, Parent) \ 272 case Loc##Id##Kind: \ 274#define NONLOC_SVAL(Id, Parent) \ 275 case NonLoc##Id##Kind: \ 277#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.def" 280llvm_unreachable(
"Unkown kind!");
283LLVM_DUMP_METHOD
void SVal::dump()
const{ dumpToStream(llvm::errs()); }
287llvm::raw_string_ostream TempOut(Buf);
289dumpToStream(TempOut);
304castAs<NonLoc>().dumpToStream(os);
308castAs<Loc>().dumpToStream(os);
311llvm_unreachable(
"Unhandled SVal kind!");
316 casenonloc::ConcreteIntKind: {
318os <<
Value<<
' '<< (
Value->isSigned() ?
'S':
'U')
319<<
Value->getBitWidth() <<
'b';
322 casenonloc::SymbolValKind:
323os << castAs<nonloc::SymbolVal>().getSymbol();
326 casenonloc::LocAsIntegerKind: {
328os <<
C.getLoc() <<
" [as "<<
C.getNumBits() <<
" bit integer]";
331 casenonloc::CompoundValKind: {
333os <<
"compoundVal{";
335 for(
const auto&I :
C) {
337os <<
' '; first =
false;
347 casenonloc::LazyCompoundValKind: {
349os <<
"lazyCompoundVal{"<<
const_cast<void*
>(
C.getStore())
350<<
','<<
C.getRegion()
354 casenonloc::PointerToMemberKind: {
355os <<
"pointerToMember{";
357castAs<nonloc::PointerToMember>();
361 for(
const auto&I : CastRes) {
363os <<
' '; first =
false;
375assert(
false&&
"Pretty-printed not implemented for this NonLoc.");
382 caseloc::ConcreteIntKind:
383os << castAs<loc::ConcreteInt>().getValue()->getZExtValue() <<
" (Loc)";
385 caseloc::GotoLabelKind:
386os <<
"&&"<< castAs<loc::GotoLabel>().getLabel()->getName();
388 caseloc::MemRegionValKind:
389os << '&' << castAs<loc::MemRegionVal>().getRegion()->getString();
392llvm_unreachable(
"Pretty-printing not implemented for this Loc.");
Defines the clang::ASTContext interface.
static const MemRegion * getRegion(const CallEvent &Call, const MutexDescriptor &Descriptor, bool IsLock)
static Decl::Kind getKind(const Decl *D)
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
QualType getIntTypeForBitwidth(unsigned DestWidth, unsigned Signed) const
getIntTypeForBitwidth - sets integer QualTy according to specified details: bitwidth,...
Represents a function declaration or definition.
This represents a decl that may have a name.
std::string getQualifiedNameAsString() const
A (possibly-)qualified type.
bool isNull() const
Return true if this QualType doesn't point to a type yet.
bool isSignedIntegerType() const
Return true if this is an integer type that is signed, according to C99 6.2.5p4 [char,...
A safe wrapper around APSInt objects allocated and owned by BasicValueFactory.
AllocaRegion - A region that represents an untyped blob of bytes created by a call to 'alloca'.
FullSValVisitor - a convenient mixed visitor for all three: SVal, SymExpr and MemRegion subclasses.
FunctionCodeRegion - A region that represents code texts of function.
void dumpToStream(raw_ostream &Out) const
static bool classof(SVal V)
MemRegion - The root abstract class for all memory regions.
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemRegion * StripCasts(bool StripBaseAndDerivedCasts=true) const
const SymbolicRegion * getSymbolicBase() const
If this is a symbolic region, returns the region.
const RegionTy * getAs() const
static bool classof(SVal V)
void dumpToStream(raw_ostream &Out) const
bool isZeroConstant() const
void dumpToStream(raw_ostream &OS) const
SymbolRef getAsSymbol(bool IncludeBaseRegions=false) const
If this SVal wraps a symbol return that SymbolRef.
const FunctionDecl * getAsFunctionDecl() const
getAsFunctionDecl - If this SVal is a MemRegionVal and wraps a CodeTextRegion wrapping a FunctionDecl...
void printJson(raw_ostream &Out, bool AddQuotes) const
printJson - Pretty-prints in JSON format.
StringRef getKindStr() const
QualType getType(const ASTContext &) const
Try to get a reasonable type for the given value.
const llvm::APSInt * getAsInteger() const
If this SVal is loc::ConcreteInt or nonloc::ConcreteInt, return a pointer to APSInt which is held in ...
SymbolRef getAsLocSymbol(bool IncludeBaseRegions=false) const
If this SVal is a location and wraps a symbol, return that SymbolRef.
const MemRegion * getAsRegion() const
SymbolRef getLocSymbolInBase() const
Get the symbol in the SVal or its base region.
virtual QualType getType() const =0
SymbolicRegion - A special, "non-concrete" region.
SymbolRef getSymbol() const
It might return null.
TypedRegion - An abstract class representing regions that are typed.
virtual QualType getLocationType() const =0
TypedValueRegion - An abstract class representing regions having a typed value.
virtual QualType getValueType() const =0
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemRegion * stripCasts(bool StripBaseCasts=true) const
Get the underlining region and strip casts.
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemRegion * getRegion() const
Get the underlining region.
The simplest example of a concrete compound value is nonloc::CompoundVal, which represents a concrete...
LLVM_ATTRIBUTE_RETURNS_NONNULL const CompoundValData * getValue() const
llvm::ImmutableList< SVal >::iterator iterator
While nonloc::CompoundVal covers a few simple use cases, nonloc::LazyCompoundVal is a more performant...
LLVM_ATTRIBUTE_RETURNS_NONNULL const TypedValueRegion * getRegion() const
This function itself is immaterial.
const void * getStore() const
It might return null.
unsigned getNumBits() const
Value representing pointer-to-member.
bool isNullMemberPointer() const
llvm::PointerUnion< const NamedDecl *, const PointerToMemberData * > PTMDataType
llvm::ImmutableList< const CXXBaseSpecifier * >::iterator iterator
const NamedDecl * getDecl() const
Represents symbolic expression that isn't a location.
LLVM_ATTRIBUTE_RETURNS_NONNULL SymbolRef getSymbol() const
The JSON file list parser is used to communicate input to InstallAPI.
std::string JsonFormat(StringRef RawSR, bool AddQuotes)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4