[llvm] [ADT] Use structured bindings in CoalescingBitVector.h (NFC) (PR #160976)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 26 22:29:58 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/160976

None

>From 8d9f6b7f19c23a1289da41f05187aadd3f6a2cfc Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 22 Sep 2025 13:11:39 -0700
Subject: [PATCH] [ADT] Use structured bindings in CoalescingBitVector.h (NFC)

---
 llvm/include/llvm/ADT/CoalescingBitVector.h | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/llvm/include/llvm/ADT/CoalescingBitVector.h b/llvm/include/llvm/ADT/CoalescingBitVector.h
index 4940bc1c2c18b..b126fc699ad87 100644
--- a/llvm/include/llvm/ADT/CoalescingBitVector.h
+++ b/llvm/include/llvm/ADT/CoalescingBitVector.h
@@ -194,10 +194,7 @@ template <typename IndexT> class CoalescingBitVector {
 
     // Delete the overlapping intervals. Split up intervals that only partially
     // intersect an overlap.
-    for (IntervalT Overlap : Overlaps) {
-      IndexT OlapStart, OlapStop;
-      std::tie(OlapStart, OlapStop) = Overlap;
-
+    for (auto [OlapStart, OlapStop] : Overlaps) {
       auto It = Intervals.find(OlapStart);
       IndexT CurrStart = It.start();
       IndexT CurrStop = It.stop();
@@ -420,10 +417,7 @@ template <typename IndexT> class CoalescingBitVector {
                               const SmallVectorImpl<IntervalT> &Overlaps,
                               SmallVectorImpl<IntervalT> &NonOverlappingParts) {
     IndexT NextUncoveredBit = Start;
-    for (IntervalT Overlap : Overlaps) {
-      IndexT OlapStart, OlapStop;
-      std::tie(OlapStart, OlapStop) = Overlap;
-
+    for (auto [OlapStart, OlapStop] : Overlaps) {
       // [Start;Stop] and [OlapStart;OlapStop] overlap iff OlapStart <= Stop
       // and Start <= OlapStop.
       bool DoesOverlap = OlapStart <= Stop && Start <= OlapStop;



More information about the llvm-commits mailing list