[clang-tools-extra] [clang-move] Avoid repeated hash lookups (NFC) (PR #109374)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 20 07:57:24 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)
----------------
kazutakahirata wrote:

Sure.  I'll take care of it in a subsequent patch.

https://github.com/llvm/llvm-project/pull/109374


More information about the cfe-commits mailing list