]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdbsupport] Add parameterless iterator_range constructor
authorTom de Vries <tdevries@suse.de>
Fri, 24 Apr 2026 12:17:29 +0000 (14:17 +0200)
committerTom de Vries <tdevries@suse.de>
Fri, 24 Apr 2026 12:17:29 +0000 (14:17 +0200)
I noticed that there's no convenient way to create an empty range in
iterator_range.  Add this.

gdb/unittests/iterator-range-selftests.c
gdbsupport/iterator-range.h

index a05531d95e0bc2cab8c60423ed88ca5c2d871b13..7c0f7f57484e000d8bacf9b74f7087be542a33fd 100644 (file)
@@ -67,7 +67,7 @@ test_iterator_range ()
 
   {
     /* Empty range.  */
-    auto r3 = int_array_iterator_range (end, end);
+    auto r3 = int_array_iterator_range ();
     test_iterator_range_1 (r3, nullptr, 0, end, end);
   }
 
index 42185546f5a18a200ca2f71ab42988c319eb801e..02a422852e81e268ad3366b63855091eec0a5a7b 100644 (file)
@@ -27,6 +27,9 @@ struct iterator_range
 {
   using iterator = IteratorType;
 
+  /* Create an empty range.  */
+  iterator_range () = default;
+
   /* Create an iterator_range using BEGIN as the begin iterator.
 
      Assume that the end iterator can be default-constructed.  */