[clang] 8e374db - [NFC][analyzer] Eliminate NodeBuilder in VisitBlockExpr (#211865)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 27 03:41:43 PDT 2026
Author: DonĂ¡t Nagy
Date: 2026-07-27T12:41:38+02:00
New Revision: 8e374dbdf2ef1cc74eac8880786e79b2b2dd0890
URL: https://github.com/llvm/llvm-project/commit/8e374dbdf2ef1cc74eac8880786e79b2b2dd0890
DIFF: https://github.com/llvm/llvm-project/commit/8e374dbdf2ef1cc74eac8880786e79b2b2dd0890.diff
LOG: [NFC][analyzer] Eliminate NodeBuilder in VisitBlockExpr (#211865)
This is part of the commit series that gradually eliminates the class
`NodeBuilder` from the analyzer engine.
This is a straightforward case where `makeNodeWithBinding` can be
clearly applied.
The node set `Tmp` was superfluous because we can directly pass the node
to `runCheckersForPostStmt` where it will be implicitly converted to a
one-element set. (There are many precedents for this.)
Also notice that we explicitly pass the `State` to `makeNodeWithBinding`
because it can be different from `Pred->getState()` (which would have
been used implicitly by the 4-argument form of `makeNodeWithBinding`.)
Added:
Modified:
clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
Removed:
################################################################################
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
index 3e7973769f091..fa177fc2835f0 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngineC.cpp
@@ -214,13 +214,11 @@ void ExprEngine::VisitBlockExpr(const BlockExpr *BE, ExplodedNode *Pred,
}
}
- ExplodedNodeSet Tmp;
- NodeBuilder Bldr(Pred, Tmp, *currBldrCtx);
- Bldr.generateNode(BE, Pred, State->BindExpr(BE, Pred->getStackFrame(), V),
- nullptr, ProgramPoint::PostLValueKind);
+ ExplodedNode *N = Engine.makeNodeWithBinding(Pred, BE, V, State,
+ ProgramPoint::PostLValueKind);
// FIXME: Move all post/pre visits to ::Visit().
- getCheckerManager().runCheckersForPostStmt(Dst, Tmp, BE, *this);
+ getCheckerManager().runCheckersForPostStmt(Dst, N, BE, *this);
}
ProgramStateRef
More information about the cfe-commits
mailing list