[clang] [analyzer] Variant checker bindings (PR #87886)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Tue May 14 05:26:04 PDT 2024
================
@@ -681,6 +681,37 @@ ExprEngine::processRegionChanges(ProgramStateRef state,
LCtx, Call);
}
+ProgramStateRef
+ExprEngine::handleCastingBeforeEvalCall(ExplodedNode *Pred, const Expr *Ex,
+ SVal ValueToBind, ProgramStateRef State, StmtNodeBuilder* Bldr) const {
+ // TODO construct new Bldr if Bldr is null
+ bool DeleteAfter = false;
+ if (!Bldr) {
+ ExplodedNodeSet dstEvaluated;
+ Bldr = new StmtNodeBuilder(Pred, dstEvaluated, *currBldrCtx);
+ DeleteAfter = true;
+ }
+
+ if (auto *AsImplCast = dyn_cast_or_null<CastExpr>(Ex);
+ AsImplCast && AsImplCast->getSubExpr() && ValueToBind.isUndef()) {
+ const LocationContext *LCtx = Pred->getLocationContext();
+ if (!isa<CallExpr>(AsImplCast->getSubExpr())) {
+ return State;
+ }
+ SVal V = State->getSVal(AsImplCast->getSubExpr(), LCtx);
+ if (V.isUndef()) {
+ return State;
+ }
+ State = State->BindExpr(Ex, LCtx, V);
+ Bldr->generateNode(Ex, Pred, State);
+ }
+
+ if (DeleteAfter) {
+ delete Bldr;
----------------
NagyDonat wrote:
There are _two_ early return branches where this `delete` is not reached. (I know that this is proof-of-concept and will be cleaned up before merging, but still...)
https://github.com/llvm/llvm-project/pull/87886
More information about the cfe-commits
mailing list