[clang] [NFC][analyzer] Remove NodeBuilder::iterator (PR #181381)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 13 08:14:35 PST 2026
https://github.com/NagyDonat created https://github.com/llvm/llvm-project/pull/181381
This iterator class was used only once and even there it was easily replaced by a more appropriate solution.
This commit is motivated by the fact that my recent commit 320d0b5467b9586a188e06dd2620126f5cb99318 turned
`IndirectGotoNodeBuilder` and `SwitchNodeBuilder` into subclasses of `NodeBuilder` and those classes have their own (slightly more useful) `::iterator`s with very different behavior.
>From 118eb2484d89b15b0c0c2f4302861b17fd1b1451 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Don=C3=A1t=20Nagy?= <donat.nagy at ericsson.com>
Date: Fri, 13 Feb 2026 17:07:51 +0100
Subject: [PATCH] [NFC][analyzer] Remove NodeBuilder::iterator
This iterator class was used only once and even there it was easily
replaced by a more appropriate solution.
This commit is motivated by the fact that my recent commit
320d0b5467b9586a188e06dd2620126f5cb99318 turned
`IndirectGotoNodeBuilder` and `SwitchNodeBuilder` into subclasses of
`NodeBuilder` and those classes have their own (slightly more useful)
`::iterator`s with very different behavior.
---
.../clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h | 7 -------
clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp | 7 +++----
2 files changed, 3 insertions(+), 11 deletions(-)
diff --git a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
index 217aaba4a00c5..f8d444251ec9f 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h
@@ -293,13 +293,6 @@ class NodeBuilder {
const ExplodedNodeSet &getResults() { return Frontier; }
- using iterator = ExplodedNodeSet::iterator;
-
- /// Iterators through the results frontier.
- iterator begin() { return Frontier.begin(); }
-
- iterator end() { return Frontier.end(); }
-
const NodeBuilderContext &getContext() { return C; }
bool hasGeneratedNodes() { return HasGeneratedNodes; }
diff --git a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
index 00e3ef8311919..99751482dee40 100644
--- a/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
@@ -689,11 +689,10 @@ void ExprEngine::handleConstructor(const Expr *E,
"Prepare for object construction");
ExplodedNodeSet DstPrepare;
StmtNodeBuilder BldrPrepare(Pred, DstPrepare, *currBldrCtx);
- BldrPrepare.generateNode(E, Pred, State, &T, ProgramPoint::PreStmtKind);
- assert(DstPrepare.size() <= 1);
- if (DstPrepare.size() == 0)
+ Pred =
+ BldrPrepare.generateNode(E, Pred, State, &T, ProgramPoint::PreStmtKind);
+ if (!Pred)
return;
- Pred = *BldrPrepare.begin();
}
const MemRegion *TargetRegion = Target.getAsRegion();
More information about the cfe-commits
mailing list