[clang-tools-extra] [clang-move] Avoid repeated hash lookups (NFC) (PR #109374)
Nikita Popov via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 20 00:09:32 PDT 2024
================
@@ -76,9 +76,8 @@ HelperDeclRefGraph::getReachableNodes(const Decl *Root) const {
llvm::DenseSet<const CallGraphNode *> ConnectedNodes;
std::function<void(const CallGraphNode *)> VisitNode =
[&](const CallGraphNode *Node) {
- if (ConnectedNodes.count(Node))
+ if (!ConnectedNodes.insert(Node).second)
return;
- ConnectedNodes.insert(Node);
for (auto It = Node->begin(), End = Node->end(); It != End; ++It)
----------------
nikic wrote:
Side-note: Can use range-based for loop here.
https://github.com/llvm/llvm-project/pull/109374
More information about the cfe-commits
mailing list