23#include "llvm/ADT/STLExtras.h"
24#include "llvm/ADT/Sequence.h"
38 state = createTemporaryRegionIfNeeded(state, LCtx, tempExpr, ME);
47 bool AlwaysReturnsLValue;
50 assert(Ctor->getDecl()->isTrivial());
51 assert(Ctor->getDecl()->isCopyOrMoveConstructor());
52 ThisVal = Ctor->getCXXThisVal();
54 AlwaysReturnsLValue =
false;
56 assert(cast<CXXMethodDecl>(
Call.getDecl())->isTrivial());
57 assert(cast<CXXMethodDecl>(
Call.getDecl())->getOverloadedOperator() ==
59 ThisVal = cast<CXXInstanceCall>(
Call).getCXXThisVal();
61 AlwaysReturnsLValue =
true;
80 if (std::optional<Loc> L =
V.getAs<
Loc>())
83 assert(
V.isUnknownOrUndef());
84 evalBind(Dst,
CallExpr, Pred, ThisVal,
V,
true);
92 if (AlwaysReturnsLValue)
93 State = State->BindExpr(
CallExpr, LCtx, ThisVal);
101 QualType &Ty,
bool &IsArray,
unsigned Idx) {
102 SValBuilder &SVB = State->getStateManager().getSValBuilder();
107 Ty = AT->getElementType();
108 AT = dyn_cast<ArrayType>(AT->getElementType());
135 const auto *DSCC = cast<VariableConstructionContext>(CC);
136 const auto *DS = DSCC->getDeclStmt();
137 const auto *Var = cast<VarDecl>(DS->getSingleDecl());
139 return makeElementRegion(State, State->getLValue(Var, LCtx), Ty,
144 const auto *ICC = cast<ConstructorInitializerConstructionContext>(CC);
145 const auto *
Init = ICC->getCXXCtorInitializer();
148 SVal ThisVal = State->getSVal(ThisPtr);
149 if (
Init->isBaseInitializer()) {
150 const auto *ThisReg = cast<SubRegion>(ThisVal.
getAsRegion());
152 Init->getBaseClass()->getAsCXXRecordDecl();
153 const auto *BaseReg =
155 Init->isBaseVirtual());
158 if (
Init->isDelegatingInitializer())
163 if (
Init->isIndirectMemberInitializer()) {
164 Field =
Init->getIndirectMember();
165 FieldVal = State->getLValue(
Init->getIndirectMember(), ThisVal);
167 Field =
Init->getMember();
168 FieldVal = State->getLValue(
Init->getMember(), ThisVal);
177 const auto *NECC = cast<NewAllocatedObjectConstructionContext>(CC);
178 const auto *NE = NECC->getCXXNewExpr();
181 dyn_cast_or_null<SubRegion>(
V.getAsRegion())) {
185 auto Ty = NE->getType()->getPointeeType();
186 while (
const auto *AT =
getContext().getAsArrayType(Ty))
187 Ty = AT->getElementType();
216 if (isa<BlockInvocationContext>(CallerLCtx)) {
219 CallerLCtx = CallerLCtx->getParent();
220 assert(!isa<BlockInvocationContext>(CallerLCtx));
226 cast<Expr>(SFC->
getCallSite()), State, &CallerBldrCtx, CallerLCtx,
227 RTC->getConstructionContext(), CallOpts);
238 const auto *RCC = cast<ReturnedValueConstructionContext>(CC);
241 static const int TopLevelSymRegionTag = 0;
242 const Expr *RetE = RCC->getReturnStmt()->getRetValue();
243 assert(RetE &&
"Void returns should not have a construction context");
249 llvm_unreachable(
"Unhandled return value construction context!");
253 const auto *TCC = cast<ElidedTemporaryObjectConstructionContext>(CC);
266 TCC->getConstructorAfterElision(), State, BldrCtx, LCtx,
267 TCC->getConstructionContextAfterElision(), CallOpts);
277 CallOpts = PreElideCallOpts;
282 const auto *TCC = cast<TemporaryObjectConstructionContext>(CC);
290 if (!VD->getType()->isReferenceType()) {
314 const auto *LCC = cast<LambdaCaptureConstructionContext>(CC);
319 const auto *CE = dyn_cast_or_null<CXXConstructExpr>(
E);
332 const auto *ACC = cast<ArgumentConstructionContext>(CC);
333 const Expr *
E = ACC->getCallLikeExpr();
334 unsigned Idx = ACC->getIndex();
337 auto getArgLoc = [&](
CallEventRef<> Caller) -> std::optional<SVal> {
339 Caller->getCalleeStackFrame(BldrCtx->
blockCount());
358 *Caller->getAdjustedParameterIndex(Idx), BldrCtx->
blockCount());
365 if (
const auto *CE = dyn_cast<CallExpr>(
E)) {
368 if (std::optional<SVal>
V = getArgLoc(Caller))
372 }
else if (
const auto *CCE = dyn_cast<CXXConstructExpr>(
E)) {
377 if (std::optional<SVal>
V = getArgLoc(Caller))
381 }
else if (
const auto *ME = dyn_cast<ObjCMessageExpr>(
E)) {
384 if (std::optional<SVal>
V = getArgLoc(Caller))
410 assert(CC &&
"Computed target region without construction context?");
414 const auto *DSCC = cast<VariableConstructionContext>(CC);
415 return addObjectUnderConstruction(State, DSCC->getDeclStmt(), LCtx,
V);
419 const auto *ICC = cast<ConstructorInitializerConstructionContext>(CC);
420 const auto *
Init = ICC->getCXXCtorInitializer();
422 assert(
Init->isAnyMemberInitializer() &&
423 "Base and delegating initializers should have been handled by"
424 "computeObjectUnderConstruction()");
425 return addObjectUnderConstruction(State,
Init, LCtx,
V);
441 assert(RTC &&
"Could not have had a target region without it");
442 if (isa<BlockInvocationContext>(CallerLCtx)) {
446 assert(!isa<BlockInvocationContext>(CallerLCtx));
451 RTC->getConstructionContext(), CallOpts);
456 const auto *TCC = cast<ElidedTemporaryObjectConstructionContext>(CC);
458 V, TCC->getConstructorAfterElision(), State, LCtx,
459 TCC->getConstructionContextAfterElision(), CallOpts);
462 State = addObjectUnderConstruction(
463 State, TCC->getConstructorAfterElision(), LCtx,
V);
466 if (
const auto *BTE = TCC->getCXXBindTemporaryExpr())
467 State = elideDestructor(State, BTE, LCtx);
471 if (
const auto *MTE = TCC->getMaterializedTemporaryExpr())
472 State = addObjectUnderConstruction(State, MTE, LCtx,
V);
481 const auto *TCC = cast<TemporaryObjectConstructionContext>(CC);
482 if (
const auto *BTE = TCC->getCXXBindTemporaryExpr())
483 State = addObjectUnderConstruction(State, BTE, LCtx,
V);
485 if (
const auto *MTE = TCC->getMaterializedTemporaryExpr())
486 State = addObjectUnderConstruction(State, MTE, LCtx,
V);
491 const auto *LCC = cast<LambdaCaptureConstructionContext>(CC);
495 if (
const auto *EL = dyn_cast_or_null<ElementRegion>(
V.getAsRegion()))
498 return addObjectUnderConstruction(
499 State, {LCC->getLambdaExpr(), LCC->getIndex()}, LCtx,
V);
502 const auto *ACC = cast<ArgumentConstructionContext>(CC);
503 if (
const auto *BTE = ACC->getCXXBindTemporaryExpr())
504 State = addObjectUnderConstruction(State, BTE, LCtx,
V);
506 return addObjectUnderConstruction(
507 State, {ACC->getCallLikeExpr(), ACC->getIndex()}, LCtx,
V);
510 llvm_unreachable(
"Unhandled construction context!");
570 if (
const auto *ME = dyn_cast<MemberExpr>(OVESrc))
571 Base = State->getSVal(ME, LCtx);
572 else if (
const auto *DRE = dyn_cast<DeclRefExpr>(OVESrc))
573 Base = State->getLValue(cast<VarDecl>(DRE->getDecl()), LCtx);
575 llvm_unreachable(
"ArrayInitLoopExpr contains unexpected source expression");
577 SVal NthElem = State->getLValue(CE->getType(), Idx,
Base);
579 return State->BindExpr(CE->getArg(0), LCtx, NthElem);
582void ExprEngine::handleConstructor(
const Expr *
E,
585 const auto *CE = dyn_cast<CXXConstructExpr>(
E);
586 const auto *CIE = dyn_cast<CXXInheritedCtorInitExpr>(
E);
595 if (std::optional<SVal> ElidedTarget =
602 State = finishObjectConstruction(State, CE, LCtx);
604 State = State->BindExpr(CE, LCtx, State->getSVal(*L, CE->getType()));
616 CE ? CE->getConstructionKind() : CIE->getConstructionKind();
620 assert(CE && !CIE &&
"A complete constructor is inherited?!");
627 if (CE->getType()->isArrayType() || AILE) {
629 auto isZeroSizeArray = [&] {
632 if (
const auto *CAT = dyn_cast<ConstantArrayType>(CE->getType()))
641 if (isZeroSizeArray()) {
644 "Skipping 0 size array construction"};
650 State = setIndexOfElementToConstruct(State, CE, LCtx, Idx + 1);
656 State = setPendingInitLoop(
658 getContext().getArrayInitLoopExprElementCount(AILE));
666 CE, State, currBldrCtx, LCtx, CC, CallOpts, Idx);
672 const auto *OuterCtor = dyn_cast_or_null<CXXConstructExpr>(
678 (
"This virtual base should have already been initialized by "
679 "the most derived class!"));
706 SVal ThisVal = State->getSVal(ThisPtr);
723 "Prepare for object construction");
727 assert(DstPrepare.
size() <= 1);
728 if (DstPrepare.
size() == 0)
730 Pred = *BldrPrepare.begin();
750 if (CE->requiresZeroInitialization()) {
763 State = State->bindDefaultZero(
Target, LCtx);
770 PreInitialized = DstPreVisit;
779 if (CE && CE->getConstructor()->isTrivial() &&
780 CE->getConstructor()->isCopyOrMoveConstructor() &&
785 performTrivialCopy(Bldr, N, *
Call);
801 StmtNodeBuilder Bldr(DstEvaluated, DstEvaluatedPostProcessed, *currBldrCtx);
806 cast<CXXConstructorDecl>(
Call->getDecl())
808 ->isAnyDestructorNoReturn()) {
817 assert(!DstEvaluated.
empty() &&
818 "We should not have inlined this constructor!");
833 finishArgumentConstruction(DstPostArgumentCleanup, I, *
Call);
839 DstPostArgumentCleanup,
847 handleConstructor(CE, Pred, Dst);
853 handleConstructor(CE, Pred, Dst);
863 assert(S &&
"A destructor without a trigger!");
868 assert(
RecordDecl &&
"Only CXXRecordDecls should have destructors");
891 if (
const Expr *
E = dyn_cast_or_null<Expr>(S)) {
907 Call->getSourceRange().getBegin(),
908 "Error evaluating destructor");
930 "Error evaluating New Allocator Call");
962 SVal RetVal = State->getSVal(CNE, LCtx);
967 State = State->bindDefaultInitial(RetVal,
UndefinedVal{}, LCtx);
979 if (!ProtoType->isNothrow())
984 CNE, I, addObjectUnderConstruction(State, CNE, LCtx, RetVal));
989 DstPostValue, *
Call, *
this);
1002 unsigned blockCount = currBldrCtx->
blockCount();
1007 bool IsStandardGlobalOpNewFunction =
1015 State = finishObjectConstruction(State, CNE, LCtx);
1022 if (IsStandardGlobalOpNewFunction)
1038 State =
Call->invalidateRegions(blockCount);
1050 if (!ProtoType->isNothrow())
1052 State = State->assume(*dSymVal,
true);
1061 if (
const auto *NewReg = cast_or_null<SubRegion>(symVal.
getAsRegion())) {
1066 bool isInitList = isa_and_nonnull<InitListExpr>(
Init);
1083 evalBind(evaluated, CNE, Pred,
Result,
V,
true);
1088 Pred = *evaluated.
begin();
1110 State = State->BindExpr(CNE, LCtx,
Result);
1118 if (!isa<CXXConstructExpr>(
Init)) {
1121 evalBind(Dst, CNE, NewN,
Result, State->getSVal(
Init, LCtx),
1122 IsStandardGlobalOpNewFunction);
1144 DstPostCall = DstPreCall;
1161 state = state->bindLoc(state->getLValue(VD, LCtx),
V, LCtx);
1196 for (
auto const [Idx, FieldForCapture, InitExpr] :
1197 llvm::zip(llvm::seq<unsigned>(0, -1), LE->getLambdaClass()->fields(),
1198 LE->capture_inits())) {
1199 SVal FieldLoc = State->getLValue(FieldForCapture,
V);
1202 if (!FieldForCapture->hasCapturedVLAType()) {
1203 assert(InitExpr &&
"Capture missing initialization expression");
1209 const auto FTy = FieldForCapture->getType();
1210 if (FTy->isConstantArrayType() &&
1212 getContext().getAsConstantArrayType(FTy)) == 0)
1218 if (
const auto OUC =
1220 InitVal = State->getSVal(OUC->getAsRegion());
1222 State = finishObjectConstruction(State, {LE, Idx}, LocCtxt);
1224 InitVal = State->getSVal(InitExpr, LocCtxt);
1229 "VLA capture by value is a compile time error!");
1234 Expr *SizeExpr = FieldForCapture->getCapturedVLAType()->getSizeExpr();
1235 InitVal = State->getSVal(SizeExpr, LocCtxt);
1238 State = State->bindLoc(FieldLoc, InitVal, LocCtxt);
1244 SVal LambdaRVal = State->getSVal(R);
1250 State->BindExpr(LE, LocCtxt, LambdaRVal),
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
static ProgramStateRef bindRequiredArrayElementToEnvironment(ProgramStateRef State, const ArrayInitLoopExpr *AILE, const LocationContext *LCtx, SVal Idx)
llvm::MachO::Target Target
Defines the PrettyStackTraceEntry class, which is used to make crashes give more contextual informati...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
QualType getPointerType(QualType T) const
Return the uniqued reference to the type for a pointer to the specified type.
const ArrayType * getAsArrayType(QualType T) const
Type Query functions.
uint64_t getConstantArrayElementCount(const ConstantArrayType *CA) const
Return number of constant array elements.
uint64_t getArrayInitLoopExprElementCount(const ArrayInitLoopExpr *AILE) const
Return number of elements initialized in an ArrayInitLoopExpr.
AnalysisDeclContext contains the context data for the function, method or block under analysis.
CFG::BuildOptions & getCFGBuildOptions()
Represents a loop initializing the elements of an array.
OpaqueValueExpr * getCommonExpr() const
Get the common subexpression shared by all initializations (the source array).
Represents an array type, per C99 6.7.5.2 - Array Declarators.
Represents a function call that returns a C++ object by value.
Represents C++ constructor call.
std::optional< T > getAs() const
Convert to the specified CFGElement type, returning std::nullopt if this CFGElement is not of the des...
CXXCatchStmt - This represents a C++ catch block.
VarDecl * getExceptionDecl() const
Represents a call to a C++ constructor.
Represents a delete expression for memory deallocation and destructor calls, e.g.
Represents a C++ destructor within a class.
Represents a call to an inherited base class constructor from an inheriting constructor.
Represents a static or instance method of a struct/union/class.
Represents a new-expression for memory allocation and constructor calls, e.g: "new CXXNewExpr(foo)".
Expr * getPlacementArg(unsigned I)
SourceLocation getBeginLoc() const
FunctionDecl * getOperatorNew() const
Expr * getInitializer()
The initializer of this new-expression.
Represents a C++ struct/union/class.
bool isEmpty() const
Determine whether this is an empty class in the sense of (C++11 [meta.unary.prop]).
Represents the this expression in C++.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
ConstructionContext's subclasses describe different ways of constructing an object in C++.
virtual const ArrayInitLoopExpr * getArrayInitLoop() const
@ CXX17ElidedCopyVariableKind
@ ElidedTemporaryObjectKind
@ SimpleTemporaryObjectKind
@ CXX17ElidedCopyConstructorInitializerKind
@ SimpleConstructorInitializerKind
@ SimpleReturnedValueKind
@ CXX17ElidedCopyReturnedValueKind
DeclContext * getParent()
getParent - Returns the containing DeclContext.
Decl - This represents one declaration (or definition), e.g.
This represents one expression.
Expr * IgnoreParens() LLVM_READONLY
Skip past any parentheses which might surround this expression until reaching a fixed point.
Represents a function declaration or definition.
bool isReservedGlobalPlacementOperator() const
Determines whether this operator new or delete is one of the reserved global placement operators: voi...
bool isReplaceableGlobalAllocationFunction(std::optional< unsigned > *AlignmentParam=nullptr, bool *IsNothrow=nullptr) const
Determines whether this function is one of the replaceable global allocation functions: void *operato...
Represents a prototype with parameter type info, e.g.
A C++ lambda expression, which produces a function object (of unspecified type) that can be invoked l...
It wraps the AnalysisDeclContext to represent both the call stack with the help of StackFrameContext ...
const Decl * getDecl() const
const ParentMap & getParentMap() const
LLVM_ATTRIBUTE_RETURNS_NONNULL AnalysisDeclContext * getAnalysisDeclContext() const
const LocationContext * getParent() const
It might return null.
const StackFrameContext * getStackFrame() const
Represents a prvalue temporary that is written into memory so that a reference can bind to it.
StorageDuration getStorageDuration() const
Retrieve the storage duration for the materialized temporary.
Expr * getSubExpr() const
Retrieve the temporary-generating subexpression whose value will be materialized into a glvalue.
ValueDecl * getExtendingDecl()
Get the declaration which triggered the lifetime-extension of this temporary, if any.
Expr * getSourceExpr() const
The source expression of an opaque value expression is the expression which originally generated the ...
Stmt * getParent(Stmt *) const
Represents a program point just after an implicit call event.
If a crash happens while one of these objects are live, the message is printed out along with the spe...
ProgramPoint withTag(const ProgramPointTag *tag) const
Create a new ProgramPoint object that is the same as the original except for using the specified tag ...
A (possibly-)qualified type.
Represents a struct/union/class.
It represents a stack frame of the call stack (based on CallEvent).
unsigned getIndex() const
const Stmt * getCallSite() const
const CFGBlock * getCallSiteBlock() const
Stmt - This represents one statement.
CXXRecordDecl * getAsCXXRecordDecl() const
Retrieves the CXXRecordDecl that this type refers to, either because the type is a RecordType or beca...
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
const T * getAs() const
Member-template getAs<specific type>'.
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
AnalyzerOptions & getAnalyzerOptions() override
Represents a call to a C++ constructor.
Manages the lifetime of CallEvent objects.
CallEventRef< CXXDestructorCall > getCXXDestructorCall(const CXXDestructorDecl *DD, const Stmt *Trigger, const MemRegion *Target, bool IsBase, ProgramStateRef State, const LocationContext *LCtx, CFGBlock::ConstCFGElementRef ElemRef)
CallEventRef< CXXDeallocatorCall > getCXXDeallocatorCall(const CXXDeleteExpr *E, ProgramStateRef State, const LocationContext *LCtx, CFGBlock::ConstCFGElementRef ElemRef)
CallEventRef getSimpleCall(const CallExpr *E, ProgramStateRef State, const LocationContext *LCtx, CFGBlock::ConstCFGElementRef ElemRef)
CallEventRef< ObjCMethodCall > getObjCMethodCall(const ObjCMessageExpr *E, ProgramStateRef State, const LocationContext *LCtx, CFGBlock::ConstCFGElementRef ElemRef)
CallEventRef< CXXAllocatorCall > getCXXAllocatorCall(const CXXNewExpr *E, ProgramStateRef State, const LocationContext *LCtx, CFGBlock::ConstCFGElementRef ElemRef)
CallEventRef< CXXConstructorCall > getCXXConstructorCall(const CXXConstructExpr *E, const MemRegion *Target, ProgramStateRef State, const LocationContext *LCtx, CFGBlock::ConstCFGElementRef ElemRef)
CallEventRef< CXXInheritedConstructorCall > getCXXInheritedConstructorCall(const CXXInheritedCtorInitExpr *E, const MemRegion *Target, ProgramStateRef State, const LocationContext *LCtx, CFGBlock::ConstCFGElementRef ElemRef)
Represents an abstract call to a function or method along a particular path.
static bool isVariadic(const Decl *D)
Returns true if the given decl is known to be variadic.
void runCheckersForPreCall(ExplodedNodeSet &Dst, const ExplodedNodeSet &Src, const CallEvent &Call, ExprEngine &Eng)
Run checkers for pre-visiting obj-c messages.
void runCheckersForEvalCall(ExplodedNodeSet &Dst, const ExplodedNodeSet &Src, const CallEvent &CE, ExprEngine &Eng, const EvalCallOptions &CallOpts)
Run checkers for evaluating a call.
void runCheckersForPostStmt(ExplodedNodeSet &Dst, const ExplodedNodeSet &Src, const Stmt *S, ExprEngine &Eng, bool wasInlined=false)
Run checkers for post-visiting Stmts.
void runCheckersForNewAllocator(const CXXAllocatorCall &Call, ExplodedNodeSet &Dst, ExplodedNode *Pred, ExprEngine &Eng, bool wasInlined=false)
Run checkers between C++ operator new and constructor calls.
void runCheckersForPreStmt(ExplodedNodeSet &Dst, const ExplodedNodeSet &Src, const Stmt *S, ExprEngine &Eng)
Run checkers for pre-visiting Stmts.
void runCheckersForPostCall(ExplodedNodeSet &Dst, const ExplodedNodeSet &Src, const CallEvent &Call, ExprEngine &Eng, bool wasInlined=false)
Run checkers for post-visiting obj-c messages.
ElementRegion is used to represent both array elements and casts.
void Add(ExplodedNode *N)
const ProgramStateRef & getState() const
ProgramPoint getLocation() const
getLocation - Returns the edge associated with the given node.
const LocationContext * getLocationContext() const
ProgramStateManager & getStateManager()
std::pair< ProgramStateRef, SVal > handleConstructionContext(const Expr *E, ProgramStateRef State, const NodeBuilderContext *BldrCtx, const LocationContext *LCtx, const ConstructionContext *CC, EvalCallOptions &CallOpts, unsigned Idx=0)
A convenient wrapper around computeObjectUnderConstruction and updateObjectsUnderConstruction.
void VisitCXXDestructor(QualType ObjectType, const MemRegion *Dest, const Stmt *S, bool IsBaseDtor, ExplodedNode *Pred, ExplodedNodeSet &Dst, EvalCallOptions &Options)
const CoreEngine & getCoreEngine() const
void VisitCXXNewExpr(const CXXNewExpr *CNE, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void VisitLambdaExpr(const LambdaExpr *LE, ExplodedNode *Pred, ExplodedNodeSet &Dst)
VisitLambdaExpr - Transfer function logic for LambdaExprs.
static std::optional< SVal > getObjectUnderConstruction(ProgramStateRef State, const ConstructionContextItem &Item, const LocationContext *LC)
By looking at a certain item that may be potentially part of an object's ConstructionContext,...
CFGElement getCurrentCFGElement()
Return the CFG element corresponding to the worklist element that is currently being processed by Exp...
SVal computeObjectUnderConstruction(const Expr *E, ProgramStateRef State, const NodeBuilderContext *BldrCtx, const LocationContext *LCtx, const ConstructionContext *CC, EvalCallOptions &CallOpts, unsigned Idx=0)
Find location of the object that is being constructed by a given constructor.
static std::optional< unsigned > getIndexOfElementToConstruct(ProgramStateRef State, const CXXConstructExpr *E, const LocationContext *LCtx)
Retreives which element is being constructed in a non-POD type array.
ASTContext & getContext() const
getContext - Return the ASTContext associated with this analysis.
StoreManager & getStoreManager()
void VisitCXXNewAllocatorCall(const CXXNewExpr *CNE, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void CreateCXXTemporaryObject(const MaterializeTemporaryExpr *ME, ExplodedNode *Pred, ExplodedNodeSet &Dst)
Create a C++ temporary object for an rvalue.
CFGBlock::ConstCFGElementRef getCFGElementRef() const
CheckerManager & getCheckerManager() const
ProgramStateRef bindReturnValue(const CallEvent &Call, const LocationContext *LCtx, ProgramStateRef State)
Create a new state in which the call return value is binded to the call origin expression.
void VisitCXXThisExpr(const CXXThisExpr *TE, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void VisitCXXDeleteExpr(const CXXDeleteExpr *CDE, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void VisitCXXConstructExpr(const CXXConstructExpr *E, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void VisitCXXInheritedCtorInitExpr(const CXXInheritedCtorInitExpr *E, ExplodedNode *Pred, ExplodedNodeSet &Dst)
void defaultEvalCall(NodeBuilder &B, ExplodedNode *Pred, const CallEvent &Call, const EvalCallOptions &CallOpts={})
Default implementation of call evaluation.
void VisitCXXCatchStmt(const CXXCatchStmt *CS, ExplodedNode *Pred, ExplodedNodeSet &Dst)
SValBuilder & getSValBuilder()
ProgramStateRef updateObjectsUnderConstruction(SVal V, const Expr *E, ProgramStateRef State, const LocationContext *LCtx, const ConstructionContext *CC, const EvalCallOptions &CallOpts)
Update the program state with all the path-sensitive information that's necessary to perform construc...
static std::optional< unsigned > getPendingInitLoop(ProgramStateRef State, const CXXConstructExpr *E, const LocationContext *LCtx)
Retreives the size of the array in the pending ArrayInitLoopExpr.
const CXXThisRegion * getCXXThisRegion(QualType thisPointerTy, const LocationContext *LC)
getCXXThisRegion - Retrieve the [artificial] region associated with the parameter 'this'.
const ElementRegion * getElementRegion(QualType elementType, NonLoc Idx, const SubRegion *superRegion, const ASTContext &Ctx)
getElementRegion - Retrieve the memory region associated with the associated element type,...
const CXXLifetimeExtendedObjectRegion * getCXXLifetimeExtendedObjectRegion(Expr const *Ex, ValueDecl const *VD, LocationContext const *LC)
Create a CXXLifetimeExtendedObjectRegion for temporaries which are lifetime-extended by local referen...
const CXXTempObjectRegion * getCXXTempObjectRegion(Expr const *Ex, LocationContext const *LC)
const CXXBaseObjectRegion * getCXXBaseObjectRegion(const CXXRecordDecl *BaseClass, const SubRegion *Super, bool IsVirtual)
Create a CXXBaseObjectRegion with the given base class for region Super.
const CXXLifetimeExtendedObjectRegion * getCXXStaticLifetimeExtendedObjectRegion(const Expr *Ex, ValueDecl const *VD)
Create a CXXLifetimeExtendedObjectRegion for temporaries which are lifetime-extended by static refere...
MemRegion - The root abstract class for all memory regions.
unsigned blockCount() const
Returns the number of times the current basic block has been visited on the exploded graph path.
This is the simplest builder which generates nodes in the ExplodedGraph.
ExplodedNode * generateNode(const ProgramPoint &PP, ProgramStateRef State, ExplodedNode *Pred)
Generates a node in the ExplodedGraph.
void takeNodes(const ExplodedNodeSet &S)
ExplodedNode * generateSink(const ProgramPoint &PP, ProgramStateRef State, ExplodedNode *Pred)
Generates a sink in the ExplodedGraph.
void addNodes(const ExplodedNodeSet &S)
const ExplodedNodeSet & getResults()
CallEventManager & getCallEventManager()
MemRegionManager & getRegionManager()
NonLoc makeArrayIndex(uint64_t idx)
ASTContext & getContext()
loc::MemRegionVal makeLoc(SymbolRef sym)
SVal evalCast(SVal V, QualType CastTy, QualType OriginalTy)
Cast a given SVal to another SVal using given QualType's.
DefinedOrUnknownSVal conjureSymbolVal(const void *symbolTag, const Expr *expr, const LocationContext *LCtx, unsigned count)
Create a new symbol with a unique 'name'.
loc::MemRegionVal getCXXThis(const CXXMethodDecl *D, const StackFrameContext *SFC)
Return a memory region for the 'this' object reference.
DefinedOrUnknownSVal getConjuredHeapSymbolVal(const Expr *E, const LocationContext *LCtx, unsigned Count)
Conjure a symbol representing heap allocated memory region.
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 MemRegion * getAsRegion() const
T castAs() const
Convert to the specified SVal type, asserting that this SVal is of the desired type.
This builder class is useful for generating nodes that resulted from visiting a statement.
ExplodedNode * generateNode(const Stmt *S, ExplodedNode *Pred, ProgramStateRef St, const ProgramPointTag *tag=nullptr, ProgramPoint::Kind K=ProgramPoint::PostStmtKind)
SVal evalDerivedToBase(SVal Derived, const CastExpr *Cast)
Evaluates a chain of derived-to-base casts through the path specified in Cast.
SubRegion - A region that subsets another larger region.
TypedValueRegion - An abstract class representing regions having a typed value.
The JSON file list parser is used to communicate input to InstallAPI.
StorageDuration
The storage duration for an object (per C++ [basic.stc]).
@ SD_Thread
Thread storage duration.
@ SD_Static
Static storage duration.
@ SD_FullExpression
Full-expression storage duration (for temporaries).
@ Result
The result type of a method or function.
const FunctionProtoType * T
Expr * extractElementInitializerFromNestedAILE(const ArrayInitLoopExpr *AILE)
Hints for figuring out of a call should be inlined during evalCall().
bool IsTemporaryLifetimeExtendedViaAggregate
This call is a constructor for a temporary that is lifetime-extended by binding it to a reference-typ...
bool IsTemporaryCtorOrDtor
This call is a constructor or a destructor of a temporary value.
bool IsArrayCtorOrDtor
This call is a constructor or a destructor for a single element within an array, a part of array cons...
bool IsElidableCtorThatHasNotBeenElided
This call is a pre-C++17 elidable constructor that we failed to elide because we failed to compute th...
bool IsCtorOrDtorWithImproperlyModeledTargetRegion
This call is a constructor or a destructor for which we do not currently compute the this-region corr...