[clang] 86f543d - [NFC][analyzer] Refactor VisitReturnStmt (#202675)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 9 09:13:05 PDT 2026
Author: DonĂ¡t Nagy
Date: 2026-06-09T18:13:00+02:00
New Revision: 86f543d6e809fc8de6772aa29fca98e4276bd5c8
URL: https://github.com/llvm/llvm-project/commit/86f543d6e809fc8de6772aa29fca98e4276bd5c8
DIFF: https://github.com/llvm/llvm-project/commit/86f543d6e809fc8de6772aa29fca98e4276bd5c8.diff
LOG: [NFC][analyzer] Refactor VisitReturnStmt (#202675)
Simplify an old-style for loop that used explicit iterator manipulation,
and clarify the manipulation of the exploded nodes by removing the
`NodeBuilder`.
This is part of my commit series that gradually removes the class
`NodeBuilder`.
Added:
Modified:
clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
Removed:
################################################################################
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
index 7ecca2af626f3..4cbcaa2721639 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
@@ -1310,15 +1310,14 @@ void ExprEngine::BifurcateCall(const MemRegion *BifurReg,
void ExprEngine::VisitReturnStmt(const ReturnStmt *RS, ExplodedNode *Pred,
ExplodedNodeSet &Dst) {
- ExplodedNodeSet dstPreVisit;
- getCheckerManager().runCheckersForPreStmt(dstPreVisit, Pred, RS, *this);
-
- NodeBuilder B(dstPreVisit, Dst, *currBldrCtx);
+ ExplodedNodeSet DstPreVisit;
+ getCheckerManager().runCheckersForPreStmt(DstPreVisit, Pred, RS, *this);
if (RS->getRetValue()) {
- for (ExplodedNodeSet::iterator it = dstPreVisit.begin(),
- ei = dstPreVisit.end(); it != ei; ++it) {
- B.generateNode(RS, *it, (*it)->getState());
+ for (ExplodedNode *N : DstPreVisit) {
+ Dst.insert(Engine.makePostStmtNode(RS, N->getState(), N));
}
+ } else {
+ Dst.insert(DstPreVisit);
}
}
More information about the cfe-commits
mailing list