[clang] [WIP][analyzer] Refactor `ExplodedGraph::trim()` (PR #139939)
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Thu May 15 05:17:56 PDT 2025
=?utf-8?q?DonĂ¡t?= Nagy <donat.nagy at ericsson.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/139939 at github.com>
================
@@ -479,25 +479,20 @@ ExplodedGraph::trim(ArrayRef<const NodeTy *> Sinks,
// in the trimmed graph, then add the corresponding edges with
// `addPredecessor()`, otherwise add them to the worklist.
for (const ExplodedNode *Pred : N->Preds) {
- auto Iterator = ForwardMap->find(Pred);
- if (Iterator != ForwardMap->end()) {
- NewN->addPredecessor(const_cast<ExplodedNode *>(Iterator->second), *Trimmed);
- } else {
+ if (const ExplodedNode *Mapped = ForwardMap->lookup(Pred))
+ NewN->addPredecessor(const_cast<ExplodedNode *>(Mapped), *Trimmed);
----------------
steakhal wrote:
Given these const_cast, I wonder if we could just put mutable pointers to the `ForwardMap` so that we wouldn't need to cast it away from these places. WDYT? but its really bikeshedding at this point. I'm happy as we have this already.
https://github.com/llvm/llvm-project/pull/139939
More information about the cfe-commits
mailing list