Fix mapped_index::find_name_components_bounds upper bound computation
authorPedro Alves <palves@redhat.com>
Tue, 21 Nov 2017 00:02:46 +0000 (00:02 +0000)
committerPedro Alves <palves@redhat.com>
Tue, 21 Nov 2017 00:03:27 +0000 (00:03 +0000)
Here we want to find where we'd insert "after", so we want
std::lower_bound, not std::upper_bound.

gdb/ChangeLog:
2017-11-21  Pedro Alves  <palves@redhat.com>

* dwarf2read.c (mapped_index::find_name_components_bounds)
<completion mode, upper bound>: Use std::lower_bound instead of
std::upper_bound.
(test_mapped_index_find_name_component_bounds): Remove incorrect
"t1_fund" from expected symbols.

gdb/ChangeLog
gdb/dwarf2read.c

index 196abc9d5d353c6ded4360fddc304613fff59d46..d3b7b42257f9047101ac79ac6e2fd2ea7deca453 100644 (file)
@@ -1,3 +1,11 @@
+2017-11-21  Pedro Alves  <palves@redhat.com>
+
+       * dwarf2read.c (mapped_index::find_name_components_bounds)
+       <completion mode, upper bound>: Use std::lower_bound instead of
+       std::upper_bound.
+       (test_mapped_index_find_name_component_bounds): Remove incorrect
+       "t1_fund" from expected symbols.
+
 2017-11-21  Pedro Alves  <palves@redhat.com>
 
        * dwarf2read.c (mapped_index::name_components_casing): New field.
index 865e9290e72a836081afebe0cda6e5a535a47486..334d8c2e05501b1ca621a03e9e7fdf1441f3b63f 100644 (file)
@@ -4339,8 +4339,8 @@ mapped_index::find_name_components_bounds
          std::string after = make_sort_after_prefix_name (cplus);
          if (after.empty ())
            return end;
-         return std::upper_bound (lower, end, after.c_str (),
-                                  lookup_compare_upper);
+         return std::lower_bound (lower, end, after.c_str (),
+                                  lookup_compare_lower);
        }
       else
        return std::upper_bound (lower, end, cplus, lookup_compare_upper);
@@ -4680,7 +4680,6 @@ test_mapped_index_find_name_component_bounds ()
     static const char *expected_syms[] = {
       "t1_func",
       "t1_func1",
-      "t1_fund", /* This one's incorrect.  */
     };
 
     SELF_CHECK (check_find_bounds_finds (mock_index.index (),