================
@@ -1393,6 +1395,46 @@ void ExprEngine::ProcessAutomaticObjDtor(const
CFGAutomaticObjDtor Dtor,
/*IsBase=*/false, Pred, Dst, CallOpts);
}
+void ExprEngine::ProcessCleanupFunction(const CFGCleanupFunction Cleanup,
+ ExplodedNode *Pred) {
+ const VarDecl *VD = Cleanup.getVarDecl();
+ const FunctionDecl *FD = Cleanup.getFunctionDecl();
+
+ ProgramStateRef State = Pred->getState();
+ const StackFrame *SF = Pred->getStackFrame();
+
+ // The implicit f(&var) call is not written in the source; anchor it at the
+ // function name in the cleanup attribute.
+ static SimpleProgramPointTag PT("ExprEngine",
+ "Prepare for cleanup function call");
+ PreImplicitCall PP(FD, VD->getAttr<CleanupAttr>()->getLoc(), SF,
+ getCFGElementRef(), &PT);
+ Pred = Engine.makeNode(PP, State, Pred);
+
+ if (!Pred)
+ return;
+
+ CallEventManager &CEMgr = getStateManager().getCallEventManager();
+ CallEventRef<CleanupFunctionCall> Call = CEMgr.getCleanupFunctionCall(
+ FD, VD, Pred->getState(), SF, getCFGElementRef());
+
+ PrettyStackTraceLoc CrashInfo(getContext().getSourceManager(),
+ Call->getSourceRange().getBegin(),
+ "Error evaluating cleanup function");
+
+ ExplodedNodeSet Dst;
----------------
necto wrote:
`Dst` appears to be used for the first time 8 lines below, why not declare it
there?
https://github.com/llvm/llvm-project/pull/221110
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits