[clang] [NFC][analyzer] Refactor processCFGBlockEntrance (PR #215284)
Donát Nagy via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 11 05:56:24 PDT 2026
================
@@ -325,18 +325,12 @@ void CoreEngine::HandleBlockEdge(const BlockEdge &L, ExplodedNode *Pred) {
// Call into the ExprEngine to process entering the CFGBlock.
BlockEntrance BE(L.getSrc(), L.getDst(), Pred->getStackFrame());
- ExplodedNodeSet DstNodes;
- NodeBuilder Builder(Pred, DstNodes, ExprEng.getBuilderContext());
- ExprEng.processCFGBlockEntrance(BE, Builder, Pred);
-
- // Auto-generate a node.
- if (!Builder.hasGeneratedNodes()) {
- Builder.generateNode(BE, Pred->State, Pred);
- }
+ ExplodedNode *Processed = ExprEng.processCFGBlockEntrance(BE, Pred);
ExplodedNodeSet CheckerNodes;
- for (auto *N : DstNodes) {
- ExprEng.runCheckersForBlockEntrance(BE, N, CheckerNodes);
+
+ if (Processed && !Processed->isSink()) {
----------------
NagyDonat wrote:
In fact I realized that when a `makeNode`-like method makes a node that becomes a sink due to its `PosteriorlyOverconstrained` state, then the method should return `nullptr` instead of the sink node (because these sinks – with a state that does not represent a real possibility – are never useful).
This would simplify lots of engine code by getting rid of all the `&& !Node->isSink()` checks from situations where the node can be sink only due to its `PosteriorlyOverconstrained` state.
I also wrote a discourse topic about this and a related (but more complex) issue: https://discourse.llvm.org/t/simplifying-failure-modes-in-explodednode-creation/91542
https://github.com/llvm/llvm-project/pull/215284
More information about the cfe-commits
mailing list