[llvm] [llvm-xray] Use llvm::make_second_range (NFC) (PR #135989)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 16 09:55:20 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-xray

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/135989.diff


1 Files Affected:

- (modified) llvm/tools/llvm-xray/xray-stacks.cpp (+1-8) 


``````````diff
diff --git a/llvm/tools/llvm-xray/xray-stacks.cpp b/llvm/tools/llvm-xray/xray-stacks.cpp
index cbf6faeb32960..b11d732a4fcc0 100644
--- a/llvm/tools/llvm-xray/xray-stacks.cpp
+++ b/llvm/tools/llvm-xray/xray-stacks.cpp
@@ -495,15 +495,8 @@ class StackTrie {
   void printIgnoringThreads(raw_ostream &OS, FuncIdConversionHelper &FN) {
     RootVector RootValues;
 
-    // Function to pull the values out of a map iterator.
-    using RootsType = decltype(Roots.begin())::value_type;
-    auto MapValueFn = [](const RootsType &Value) { return Value.second; };
-
-    for (const auto &RootNodeRange :
-         make_range(map_iterator(Roots.begin(), MapValueFn),
-                    map_iterator(Roots.end(), MapValueFn))) {
+    for (const auto &RootNodeRange : make_second_range(Roots))
       llvm::append_range(RootValues, RootNodeRange);
-    }
 
     print(OS, FN, RootValues);
   }

``````````

</details>


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


More information about the llvm-commits mailing list