[clang] [WIP][analyzer] Refactor `ExplodedGraph::trim()` (PR #139939)
via cfe-commits
cfe-commits at lists.llvm.org
Wed May 14 10:56:22 PDT 2025
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp -- clang/lib/StaticAnalyzer/Core/BugReporter.cpp clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp b/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
index 85f84af41..ee5bebee7 100644
--- a/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
+++ b/clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
@@ -447,7 +447,7 @@ ExplodedGraph::trim(ArrayRef<const NodeTy *> Sinks,
std::unique_ptr<ExplodedGraph> Trimmed = std::make_unique<ExplodedGraph>();
- SmallVector<const ExplodedNode*, 32> Worklist{Sinks};
+ SmallVector<const ExplodedNode *, 32> Worklist{Sinks};
InterExplodedGraphMap Scratch;
if (!ForwardMap)
@@ -465,13 +465,14 @@ ExplodedGraph::trim(ArrayRef<const NodeTy *> Sinks,
// Create the corresponding node in the new graph and record the mapping
// from the old node to the new node.
ExplodedNode *NewN = Trimmed->createUncachedNode(N->getLocation(), N->State,
- N->getID(), N->isSink());
+ N->getID(), N->isSink());
Place->second = NewN;
// Also record the reverse mapping from the new node to the old node.
if (InverseMap) (*InverseMap)[NewN] = N;
- // If this is the root node, designate is as the root in the trimmed graph as well.
+ // If this is the root node, designate is as the root in the trimmed graph
+ // as well.
if (N == getRoot())
Trimmed->designateAsRoot(NewN);
@@ -481,7 +482,8 @@ ExplodedGraph::trim(ArrayRef<const NodeTy *> Sinks,
for (const ExplodedNode *Pred : N->Preds) {
auto Iterator = ForwardMap->find(Pred);
if (Iterator != ForwardMap->end()) {
- NewN->addPredecessor(const_cast<ExplodedNode *>(Iterator->second), *Trimmed);
+ NewN->addPredecessor(const_cast<ExplodedNode *>(Iterator->second),
+ *Trimmed);
} else {
Worklist.push_back(Pred);
}
@@ -495,12 +497,14 @@ ExplodedGraph::trim(ArrayRef<const NodeTy *> Sinks,
for (const ExplodedNode *Succ : N->Succs) {
auto Iterator = ForwardMap->find(Succ);
if (Iterator != ForwardMap->end()) {
- const_cast<ExplodedNode *>(Iterator->second)->addPredecessor(NewN, *Trimmed);
+ const_cast<ExplodedNode *>(Iterator->second)
+ ->addPredecessor(NewN, *Trimmed);
}
}
}
- assert(Trimmed->getRoot() && "The root must be reachable from any nonempty set of sinks!");
+ assert(Trimmed->getRoot() &&
+ "The root must be reachable from any nonempty set of sinks!");
return Trimmed;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/139939
More information about the cfe-commits
mailing list