std::string printStmt(
const Stmt*S) {
33llvm::raw_string_ostream
OS(Str);
39 if(
autoS = dyn_cast<SymbolRegionValue>(R->
getSymbol()))
40 if(isa<CXXThisRegion>(S->getRegion()))
48 QualTypeTy = SR->getPointeeStaticType();
50 if(Idx->isZero() && IsNotReinterpretCast)
51 returnisThisObject(SR);
61 return "unknown value";
65 return "undefined value";
71 if(
autoSR = dyn_cast<SymbolicRegion>(R)) {
73 if(!isThisObject(SR))
74 return Visit(SR->getSymbol());
76 return "pointer to "+
Visit(R);
80 constllvm::APSInt &I =
V.getValue();
82llvm::raw_string_ostream
OS(Str);
83 OS<<
"concrete memory address '"<< I <<
"'";
88 return Visit(
V.getSymbol());
92 constllvm::APSInt &I =
V.getValue();
94llvm::raw_string_ostream
OS(Str);
95 OS<< (I.isSigned() ?
"signed ":
"unsigned ") << I.getBitWidth()
96<<
"-bit integer '"<< I <<
"'";
101 return "lazily frozen compound value of "+
Visit(
V.getRegion());
107 if(
auto V= dyn_cast<VarRegion>(R))
108 if(
auto D= dyn_cast<ParmVarDecl>(
V->getDecl()))
109 return "argument '"+
D->getQualifiedNameAsString() +
"'";
110 return "initial value of "+
Visit(R);
114 return "symbol of type '"+ S->getType().getAsString() +
115 "' conjured at statement '"+ printStmt(S->getStmt()) +
"'";
119 return "value derived from ("+
Visit(S->getParentSymbol()) +
120 ") for "+
Visit(S->getRegion());
124 return "extent of "+
Visit(S->getRegion());
128 return "metadata of type '"+ S->getType().getAsString() +
"' tied to "+
129 Visit(S->getRegion());
134llvm::raw_string_ostream
OS(Str);
135 OS<<
"("<<
Visit(S->getLHS()) <<
") " 145 return "("+
Visit(S->getLHS()) +
") "+
147 " ("+
Visit(S->getRHS()) +
")";
152 Visit(S->getOperand()) +
")";
162 return "'this' object";
175 return "region allocated by '"+ printStmt(R->
getExpr()) +
"'";
183 return "string literal "+ R->
getString();
188llvm::raw_string_ostream
OS(Str);
194 return "'this' object";
209 if(isa<ParmVarDecl>(VD))
210 return "parameter '"+ Name +
"'";
211 else if(VD->
hasAttr<BlocksAttr>())
212 return "block variable '"+ Name +
"'";
214 return "local variable '"+ Name +
"'";
216 return "static local variable '"+ Name +
"'";
218 return "global variable '"+ Name +
"'";
220llvm_unreachable(
"A variable is either local or global");
234 return "temporary object constructed at statement '"+
235printStmt(R->
getExpr()) +
"'";
245llvm::raw_string_ostream
OS(Str);
250 OS<<
"parameter '"<< Name <<
"'";
251 returnstd::string(
OS.str());
254 unsignedIndex = R->
getIndex() + 1;
255 OS<< Index << llvm::getOrdinalSuffix(Index) <<
" parameter of ";
257 if(
const auto*FD = dyn_cast<FunctionDecl>(
Parent))
258 OS<<
"function '"<< FD->getQualifiedNameAsString() <<
"()'";
259 else if(
const auto*CD = dyn_cast<CXXConstructorDecl>(
Parent))
260 OS<<
"C++ constructor '"<< CD->getQualifiedNameAsString() <<
"()'";
261 else if(
const auto*MD = dyn_cast<ObjCMethodDecl>(
Parent)) {
262 if(MD->isClassMethod())
263 OS<<
"Objective-C method '+"<< MD->getQualifiedNameAsString() <<
"'";
265 OS<<
"Objective-C method '-"<< MD->getQualifiedNameAsString() <<
"'";
266}
else if(isa<BlockDecl>(
Parent)) {
267 if(cast<BlockDecl>(
Parent)->isConversionFromLambda())
273 returnstd::string(
OS.str());
278llvm::raw_string_ostream
OS(Str);
280 return "a value unsupported by the explainer: ("+
281std::string(
OS.str()) +
")";
286llvm::raw_string_ostream
OS(Str);
287S->dumpToStream(
OS);
288 return "a symbolic expression unsupported by the explainer: ("+
289std::string(
OS.str()) +
")";
294llvm::raw_string_ostream
OS(Str);
296 return "a memory region unsupported by the explainer ("+
297std::string(
OS.str()) +
")";
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
const LangOptions & getLangOpts() const
StringRef getOpcodeStr() const
Decl - This represents one declaration (or definition), e.g.
const Decl * getDecl() const
std::string getQualifiedNameAsString() const
std::string getNameAsString() const
Get a human-readable name for the declaration, even if it is one of the special kinds of names (C++ c...
Represents a pointer to an Objective C object.
Represents a parameter to a function.
A (possibly-)qualified type.
QualType getCanonicalType() const
Stmt - This represents one statement.
const T * getAs() const
Member-template getAs<specific type>'.
static StringRef getOpcodeStr(Opcode Op)
getOpcodeStr - Turn an Opcode enum value into the punctuation char it corresponds to,...
Represents a variable declaration or definition.
bool hasGlobalStorage() const
Returns true for all variables that do not have local storage.
bool isStaticLocal() const
Returns true if a variable with function scope is a static local variable.
bool hasLocalStorage() const
Returns true if a variable with function scope is a non-static local variable.
AllocaRegion - A region that represents an untyped blob of bytes created by a call to 'alloca'.
LLVM_ATTRIBUTE_RETURNS_NONNULL const Expr * getExpr() const
Template implementation for all binary symbolic expressions.
LLVM_ATTRIBUTE_RETURNS_NONNULL const CXXRecordDecl * getDecl() const
LLVM_ATTRIBUTE_RETURNS_NONNULL const Expr * getExpr() const
CompoundLiteralRegion - A memory region representing a compound literal.
LLVM_ATTRIBUTE_RETURNS_NONNULL const CompoundLiteralExpr * getLiteralExpr() const
ElementRegion is used to represent both array elements and casts.
QualType getValueType() const override
QualType getElementType() const
LLVM_ATTRIBUTE_RETURNS_NONNULL const FieldDecl * getDecl() const override
FullSValVisitor - a convenient mixed visitor for all three: SVal, SymExpr and MemRegion subclasses.
MemRegion - The root abstract class for all memory regions.
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemSpaceRegion * getMemorySpace() const
std::string getString() const
Get a string representation of a region for debug use.
const RegionTy * getAs() const
LLVM_ATTRIBUTE_RETURNS_NONNULL const VarDecl * getDecl() const override
LLVM_ATTRIBUTE_RETURNS_NONNULL const ObjCIvarDecl * getDecl() const override
ParamVarRegion - Represents a region for paremters.
const ParmVarDecl * getDecl() const override
TODO: What does this return?
unsigned getIndex() const
std::string VisitSymbolRegionValue(const SymbolRegionValue *S)
std::string VisitFieldRegion(const FieldRegion *R)
std::string VisitConcreteInt(nonloc::ConcreteInt V)
std::string VisitSVal(SVal V)
std::string VisitObjCIvarRegion(const ObjCIvarRegion *R)
std::string VisitParamVarRegion(const ParamVarRegion *R)
std::string VisitSymbolDerived(const SymbolDerived *S)
SValExplainer(ASTContext &Ctx)
std::string VisitUnarySymExpr(const UnarySymExpr *S)
std::string VisitCompoundLiteralRegion(const CompoundLiteralRegion *R)
std::string VisitSymIntExpr(const SymIntExpr *S)
std::string VisitSymExpr(SymbolRef S)
std::string VisitSymbolicRegion(const SymbolicRegion *R)
std::string VisitSymbolVal(nonloc::SymbolVal V)
std::string VisitMemRegion(const MemRegion *R)
std::string VisitUnknownVal(UnknownVal V)
std::string VisitConcreteInt(loc::ConcreteInt V)
std::string VisitCXXTempObjectRegion(const CXXTempObjectRegion *R)
std::string VisitNonParamVarRegion(const NonParamVarRegion *R)
std::string VisitCXXBaseObjectRegion(const CXXBaseObjectRegion *R)
std::string VisitSymbolMetadata(const SymbolMetadata *S)
std::string VisitSymSymExpr(const SymSymExpr *S)
std::string VisitSymbolConjured(const SymbolConjured *S)
std::string VisitSymbolExtent(const SymbolExtent *S)
std::string VisitUndefinedVal(UndefinedVal V)
std::string VisitAllocaRegion(const AllocaRegion *R)
std::string VisitElementRegion(const ElementRegion *R)
std::string VisitMemRegionVal(loc::MemRegionVal V)
std::string VisitLazyCompoundVal(nonloc::LazyCompoundVal V)
std::string VisitStringRegion(const StringRegion *R)
SVal - This represents a symbolic expression, which can be either an L-value or an R-value.
std::optional< T > getAs() const
Convert to the specified SVal type, returning std::nullopt if this SVal is not of the desired type.
const llvm::APSInt * getAsInteger() const
If this SVal is loc::ConcreteInt or nonloc::ConcreteInt, return a pointer to APSInt which is held in ...
StringRegion - Region associated with a StringLiteral.
LLVM_ATTRIBUTE_RETURNS_NONNULL const MemRegion * getSuperRegion() const
virtual QualType getType() const =0
A symbol representing the result of an expression in the case when we do not know anything about what...
A symbol representing the value of a MemRegion whose parent region has symbolic value.
SymbolExtent - Represents the extent (size in bytes) of a bounded region.
A symbol representing the value stored at a MemRegion.
SymbolicRegion - A special, "non-concrete" region.
SymbolRef getSymbol() const
It might return null.
Represents a symbolic expression involving a unary operator.
const StackFrameContext * getStackFrame() const
It might return null.
Value representing integer constant.
While nonloc::CompoundVal covers a few simple use cases, nonloc::LazyCompoundVal is a more performant...
Represents symbolic expression that isn't a location.
@ OS
Indicates that the tracking object is a descendant of a referenced-counted OSObject,...
The JSON file list parser is used to communicate input to InstallAPI.
Describes how types, statements, expressions, and declarations should be printed.
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