[clang] [NFC][analyzer] Remove NodeBuilder::iterator (PR #181381)
via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 13 08:15:14 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-static-analyzer-1
Author: DonĂ¡t Nagy (NagyDonat)
<details>
<summary>Changes</summary>
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.
---
Full diff: https://github.com/llvm/llvm-project/pull/181381.diff
2 Files Affected:
- (modified) clang/include/clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h (-7)
- (modified) clang/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp (+3-4)
``````````diff
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();
``````````
</details>
https://github.com/llvm/llvm-project/pull/181381
More information about the cfe-commits
mailing list