Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libc++] Implement P0429R9 std::flat_map #98643

Merged
merged 42 commits into from
Oct 26, 2024
Merged

Conversation

huixie90
Copy link
Contributor

@huixie90 huixie90 commented Jul 12, 2024

Around half of the tests are based on the tests Arthur O'Dwyer's original implementation of std::flat_map, with modifications and removals.

partially implement #105190

Copy link

github-actions bot commented Jul 19, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/flat_map Outdated Show resolved Hide resolved
libcxx/include/flat_map Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
@ldionne ldionne marked this pull request as ready for review August 30, 2024 18:19
@ldionne ldionne requested a review from a team as a code owner August 30, 2024 18:19
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Aug 30, 2024
@llvmbot
Copy link
Member

llvmbot commented Aug 30, 2024

@llvm/pr-subscribers-libcxx

Author: Hui (huixie90)

Changes

The tests are based on Arthur O'Dwyer's original implementation of std::flat_map.

Closes #105190


Patch is 312.18 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/98643.diff

72 Files Affected:

  • (modified) libcxx/docs/Status/Cxx23Papers.csv (+1-1)
  • (modified) libcxx/include/CMakeLists.txt (+3)
  • (added) libcxx/include/__flat_map/flat_map.h (+1367)
  • (added) libcxx/include/__flat_map/sorted_unique.h (+31)
  • (modified) libcxx/include/__iterator/reverse_iterator.h (+8-2)
  • (modified) libcxx/include/__memory/allocator_traits.h (+3)
  • (added) libcxx/include/flat_map (+72)
  • (modified) libcxx/include/module.modulemap (+7)
  • (added) libcxx/test/libcxx/containers/containers.adaptors/flat.map/container_stability.pass.cpp (+68)
  • (added) libcxx/test/std/containers/container.adaptors/NaiveStaticVector.h (+90)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/clear.pass.cpp (+60)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/comp.pass.cpp (+96)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/contains.pass.cpp (+73)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/contains_transparent.pass.cpp (+38)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/count.pass.cpp (+72)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/count_transparent.pass.cpp (+38)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/empty.pass.cpp (+62)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/empty.verify.cpp (+24)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/equal_range.pass.cpp (+89)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/equal_range_transparent.pass.cpp (+42)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/erase_key.pass.cpp (+113)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/erase_key_transparent.pass.cpp (+108)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/find.pass.cpp (+81)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/find_transparent.pass.cpp (+41)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/alloc.pass.cpp (+54)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/assign_initializer_list.pass.cpp (+71)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/compare.pass.cpp (+87)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/containers.pass.cpp (+227)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/containers_compare.pass.cpp (+245)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/copy.pass.cpp (+90)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/copy_alloc.pass.cpp (+77)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/copy_assign.addressof.compile.pass.cpp (+30)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/copy_assign.pass.cpp (+109)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/deduct.pass.cpp (+500)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/deduct.verify.cpp (+97)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/default.pass.cpp (+71)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/default_noexcept.pass.cpp (+57)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/dtor_noexcept.pass.cpp (+53)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/initializer_list.pass.cpp (+86)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/initializer_list_compare.pass.cpp (+80)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/iter_iter.pass.cpp (+92)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/iter_iter_comp.pass.cpp (+102)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/iter_iter_stability.pass.cpp (+65)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/move.pass.cpp (+76)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/move_alloc.pass.cpp (+83)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/move_assign.pass.cpp (+110)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/move_assign_clears.pass.cpp (+91)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/move_assign_noexcept.pass.cpp (+112)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/move_exceptions.pass.cpp (+75)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/move_noexcept.pass.cpp (+112)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/sorted_container.pass.cpp (+128)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.cons/sorted_iter_iter_comp.pass.cpp (+112)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.erasure/erase_if.pass.cpp (+102)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/flat.map.erasure/erase_if_exceptions.pass.cpp (+160)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/helpers.h (+35)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/incomplete_type.pass.cpp (+34)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/insert_range.pass.cpp (+93)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/insert_range_stability.pass.cpp (+53)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/insert_transparent.pass.cpp (+120)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/iterator.pass.cpp (+100)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/iterator_comparison.pass.cpp (+74)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/iterator_concept_conformance.compile.pass.cpp (+142)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/lower_bound.pass.cpp (+81)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/lower_bound_transparent.pass.cpp (+39)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/max_size.pass.cpp (+74)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/op_compare.pass.cpp (+100)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/range_concept_conformance.compile.pass.cpp (+66)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/reverse_iterator.pass.cpp (+107)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/types.pass.cpp (+85)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/upper_bound.pass.cpp (+81)
  • (added) libcxx/test/std/containers/container.adaptors/flat.map/upper_bound_transparent.pass.cpp (+39)
  • (added) libcxx/test/support/MinSequenceContainer.h (+81)
diff --git a/libcxx/docs/Status/Cxx23Papers.csv b/libcxx/docs/Status/Cxx23Papers.csv
index 36d7f78285aa9c..88ff1d557c1b34 100644
--- a/libcxx/docs/Status/Cxx23Papers.csv
+++ b/libcxx/docs/Status/Cxx23Papers.csv
@@ -52,7 +52,7 @@
 "`P2443R1 <https://wg21.link/P2443R1>`__","LWG","``views::chunk_by``","February 2022","|Complete|","18.0","|ranges|"
 "","","","","","",""
 "`P0009R18 <https://wg21.link/P0009R18>`__","LWG","mdspan: A Non-Owning Multidimensional Array Reference","July 2022","|Complete|","18.0"
-"`P0429R9 <https://wg21.link/P0429R9>`__","LWG","A Standard ``flat_map``","July 2022","",""
+"`P0429R9 <https://wg21.link/P0429R9>`__","LWG","A Standard ``flat_map``","July 2022","|In progress|",""
 "`P1169R4 <https://wg21.link/P1169R4>`__","LWG","``static operator()``","July 2022","|Complete|","16.0"
 "`P1222R4 <https://wg21.link/P1222R4>`__","LWG","A Standard ``flat_set``","July 2022","",""
 "`P1223R5 <https://wg21.link/P1223R5>`__","LWG","``ranges::find_last()``, ``ranges::find_last_if()``, and ``ranges::find_last_if_not()``","July 2022","","","|ranges|"
diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 8d0ffd6ed725bd..24a7f69f2328f3 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -351,6 +351,8 @@ set(files
   __filesystem/recursive_directory_iterator.h
   __filesystem/space_info.h
   __filesystem/u8path.h
+  __flat_map/flat_map.h
+  __flat_map/sorted_unique.h
   __format/buffer.h
   __format/concepts.h
   __format/container_adaptor.h
@@ -938,6 +940,7 @@ set(files
   ext/hash_set
   fenv.h
   filesystem
+  flat_map
   float.h
   format
   forward_list
diff --git a/libcxx/include/__flat_map/flat_map.h b/libcxx/include/__flat_map/flat_map.h
new file mode 100644
index 00000000000000..540ab0984e6c55
--- /dev/null
+++ b/libcxx/include/__flat_map/flat_map.h
@@ -0,0 +1,1367 @@
+// -*- C++ -*-
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP___FLAT_MAP_FLAT_MAP_H
+#define _LIBCPP___FLAT_MAP_FLAT_MAP_H
+
+#include <__algorithm/lexicographical_compare_three_way.h>
+#include <__algorithm/ranges_equal.h>
+#include <__algorithm/ranges_lower_bound.h>
+#include <__algorithm/ranges_partition_point.h>
+#include <__algorithm/ranges_stable_sort.h>
+#include <__algorithm/ranges_unique.h>
+#include <__algorithm/ranges_upper_bound.h>
+#include <__compare/synth_three_way.h>
+#include <__concepts/convertible_to.h>
+#include <__config>
+#include <__flat_map/sorted_unique.h>
+#include <__functional/invoke.h>
+#include <__functional/is_transparent.h>
+#include <__functional/operations.h>
+#include <__iterator/concepts.h>
+#include <__iterator/distance.h>
+#include <__iterator/iterator_traits.h>
+#include <__iterator/ranges_iterator_traits.h>
+#include <__iterator/reverse_iterator.h>
+#include <__memory/allocator_traits.h>
+#include <__memory/uses_allocator.h>
+#include <__memory/uses_allocator_construction.h>
+#include <__ranges/concepts.h>
+#include <__ranges/container_compatible_range.h>
+#include <__ranges/ref_view.h>
+#include <__ranges/subrange.h>
+#include <__ranges/zip_view.h>
+#include <__type_traits/conjunction.h>
+#include <__type_traits/invoke.h>
+#include <__type_traits/is_allocator.h>
+#include <__type_traits/is_nothrow_constructible.h>
+#include <__type_traits/maybe_const.h>
+#include <__utility/pair.h>
+#include <initializer_list>
+#include <stdexcept>
+#include <string>
+#include <vector>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 23
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+template <class _Key,
+          class _Tp,
+          class _Compare         = less<_Key>,
+          class _KeyContainer    = vector<_Key>,
+          class _MappedContainer = vector<_Tp>>
+class flat_map {
+  template <bool _Const>
+  struct __iterator;
+
+  template <class, class, class, class, class>
+  friend class flat_map;
+
+public:
+  // types
+  using key_type    = _Key;
+  using mapped_type = _Tp;
+  using value_type  = pair<key_type, mapped_type>;
+  using key_compare = _Compare;
+  // TODO : the following is the spec, but not implementable for vector<bool>
+  // using reference              = pair<const key_type&, mapped_type&>;
+  // using const_reference        = pair<const key_type&, const mapped_type&>;
+  using reference = pair<ranges::range_reference_t<const _KeyContainer>, ranges::range_reference_t<_MappedContainer>>;
+  using const_reference =
+      pair<ranges::range_reference_t<const _KeyContainer>, ranges::range_reference_t<const _MappedContainer>>;
+  using size_type              = size_t;
+  using difference_type        = ptrdiff_t;
+  using iterator               = __iterator<false>; // see [container.requirements]
+  using const_iterator         = __iterator<true>;  // see [container.requirements]
+  using reverse_iterator       = std::reverse_iterator<iterator>;
+  using const_reverse_iterator = std::reverse_iterator<const_iterator>;
+  using key_container_type     = _KeyContainer;
+  using mapped_container_type  = _MappedContainer;
+
+  class value_compare {
+  private:
+    key_compare __comp_;
+    value_compare(key_compare __c) : __comp_(__c) {}
+    friend flat_map;
+
+  public:
+    _LIBCPP_HIDE_FROM_ABI bool operator()(const_reference __x, const_reference __y) const {
+      return __comp_(__x.first, __y.first);
+    }
+  };
+
+  struct containers {
+    key_container_type keys;
+    mapped_container_type values;
+  };
+
+private:
+  template <class _Allocator>
+  _LIBCPP_HIDE_FROM_ABI static constexpr bool __allocator_ctor_constraint =
+      _And<uses_allocator<key_container_type, _Allocator>, uses_allocator<mapped_container_type, _Allocator>>::value;
+
+  _LIBCPP_HIDE_FROM_ABI static constexpr bool __is_compare_transparent = __is_transparent_v<_Compare, _Compare>;
+
+  template <bool _Const>
+  struct __iterator {
+  private:
+    using __key_iterator    = ranges::iterator_t<const key_container_type>;
+    using __mapped_iterator = ranges::iterator_t<__maybe_const<_Const, mapped_container_type>>;
+    using __reference       = pair<iter_reference_t<__key_iterator>, iter_reference_t<__mapped_iterator>>;
+
+    struct __arrow_proxy {
+      __reference __ref_;
+      _LIBCPP_HIDE_FROM_ABI __reference* operator->() { return std::addressof(__ref_); }
+    };
+
+    __key_iterator __key_iter_;
+    __mapped_iterator __mapped_iter_;
+
+    friend flat_map;
+
+  public:
+    using iterator_concept  = random_access_iterator_tag;
+    using iterator_category = input_iterator_tag;
+    using value_type        = flat_map::value_type;
+    using difference_type   = flat_map::difference_type;
+
+    _LIBCPP_HIDE_FROM_ABI __iterator() = default;
+
+    _LIBCPP_HIDE_FROM_ABI __iterator(__iterator<!_Const> __i)
+      requires _Const && convertible_to<ranges::iterator_t<key_container_type>, __key_iterator> &&
+                   convertible_to<ranges::iterator_t<mapped_container_type>, __mapped_iterator>
+        : __key_iter_(std::move(__i.__key_iter_)), __mapped_iter_(std::move(__i.__mapped_iter_)) {}
+
+    _LIBCPP_HIDE_FROM_ABI __iterator(__key_iterator __key_iter, __mapped_iterator __mapped_iter)
+        : __key_iter_(std::move(__key_iter)), __mapped_iter_(std::move(__mapped_iter)) {}
+
+    _LIBCPP_HIDE_FROM_ABI __reference operator*() const { return __reference(*__key_iter_, *__mapped_iter_); }
+    _LIBCPP_HIDE_FROM_ABI __arrow_proxy operator->() const { return __arrow_proxy(**this); }
+
+    _LIBCPP_HIDE_FROM_ABI __iterator& operator++() {
+      ++__key_iter_;
+      ++__mapped_iter_;
+      return *this;
+    }
+
+    _LIBCPP_HIDE_FROM_ABI __iterator operator++(int) {
+      __iterator __tmp(*this);
+      ++*this;
+      return __tmp;
+    }
+
+    _LIBCPP_HIDE_FROM_ABI __iterator& operator--() {
+      --__key_iter_;
+      --__mapped_iter_;
+      return *this;
+    }
+
+    _LIBCPP_HIDE_FROM_ABI __iterator operator--(int) {
+      __iterator __tmp(*this);
+      --*this;
+      return __tmp;
+    }
+
+    _LIBCPP_HIDE_FROM_ABI __iterator& operator+=(difference_type __x) {
+      __key_iter_ += __x;
+      __mapped_iter_ += __x;
+      return *this;
+    }
+
+    _LIBCPP_HIDE_FROM_ABI __iterator& operator-=(difference_type __x) {
+      __key_iter_ -= __x;
+      __mapped_iter_ -= __x;
+      return *this;
+    }
+
+    _LIBCPP_HIDE_FROM_ABI __reference operator[](difference_type __n) const { return *(*this + __n); }
+
+    _LIBCPP_HIDE_FROM_ABI friend constexpr bool operator==(const __iterator& __x, const __iterator& __y) {
+      return __x.__key_iter_ == __y.__key_iter_;
+    }
+
+    _LIBCPP_HIDE_FROM_ABI friend bool operator<(const __iterator& __x, const __iterator& __y) {
+      return __x.__key_iter_ < __y.__key_iter_;
+    }
+
+    _LIBCPP_HIDE_FROM_ABI friend bool operator>(const __iterator& __x, const __iterator& __y) { return __y < __x; }
+
+    _LIBCPP_HIDE_FROM_ABI friend bool operator<=(const __iterator& __x, const __iterator& __y) { return !(__y < __x); }
+
+    _LIBCPP_HIDE_FROM_ABI friend bool operator>=(const __iterator& __x, const __iterator& __y) { return !(__x < __y); }
+
+    _LIBCPP_HIDE_FROM_ABI friend auto operator<=>(const __iterator& __x, const __iterator& __y)
+      requires three_way_comparable<__key_iterator>
+    {
+      return __x.__key_iter_ <=> __y.__key_iter_;
+    }
+
+    _LIBCPP_HIDE_FROM_ABI friend __iterator operator+(const __iterator& __i, difference_type __n) {
+      auto __tmp = __i;
+      __tmp += __n;
+      return __tmp;
+    }
+
+    _LIBCPP_HIDE_FROM_ABI friend __iterator operator+(difference_type __n, const __iterator& __i) { return __i + __n; }
+
+    _LIBCPP_HIDE_FROM_ABI friend __iterator operator-(const __iterator& __i, difference_type __n) {
+      auto __tmp = __i;
+      __tmp -= __n;
+      return __tmp;
+    }
+
+    _LIBCPP_HIDE_FROM_ABI friend difference_type operator-(const __iterator& __x, const __iterator& __y) {
+      return difference_type(__x.__key_iter_ - __y.__key_iter_);
+    }
+  };
+
+public:
+  // [flat.map.cons], construct/copy/destroy
+  _LIBCPP_HIDE_FROM_ABI flat_map() noexcept(
+      is_nothrow_default_constructible_v<_KeyContainer> && is_nothrow_default_constructible_v<_MappedContainer> &&
+      is_nothrow_default_constructible_v<_Compare>)
+      : __containers_(), __compare_() {}
+
+  template <class _Allocator>
+    requires __allocator_ctor_constraint<_Allocator>
+  _LIBCPP_HIDE_FROM_ABI flat_map(const flat_map& __other, const _Allocator& __alloc)
+      : flat_map(__ctor_uses_allocator_tag{},
+                 __alloc,
+                 __other.__containers_.keys,
+                 __other.__containers_.values,
+                 __other.__compare_) {}
+
+  template <class _Allocator>
+    requires __allocator_ctor_constraint<_Allocator>
+  _LIBCPP_HIDE_FROM_ABI flat_map(flat_map&& __other, const _Allocator& __alloc)
+      : flat_map(__ctor_uses_allocator_tag{},
+                 __alloc,
+                 std::move(__other.__containers_.keys),
+                 std::move(__other.__containers_.values),
+                 std::move(__other.__compare_)) {}
+
+  _LIBCPP_HIDE_FROM_ABI flat_map(
+      key_container_type __key_cont, mapped_container_type __mapped_cont, const key_compare& __comp = key_compare())
+      : __containers_{.keys = std::move(__key_cont), .values = std::move(__mapped_cont)}, __compare_(__comp) {
+    __sort_and_unique();
+  }
+
+  template <class _Allocator>
+    requires __allocator_ctor_constraint<_Allocator>
+  _LIBCPP_HIDE_FROM_ABI
+  flat_map(const key_container_type& __key_cont, const mapped_container_type& __mapped_cont, const _Allocator& __alloc)
+      : flat_map(__ctor_uses_allocator_tag{}, __alloc, __key_cont, __mapped_cont) {
+    __sort_and_unique();
+  }
+
+  template <class _Allocator>
+    requires __allocator_ctor_constraint<_Allocator>
+  _LIBCPP_HIDE_FROM_ABI
+  flat_map(const key_container_type& __key_cont,
+           const mapped_container_type& __mapped_cont,
+           const key_compare& __comp,
+           const _Allocator& __alloc)
+      : flat_map(__ctor_uses_allocator_tag{}, __alloc, __key_cont, __mapped_cont, __comp) {
+    __sort_and_unique();
+  }
+
+  _LIBCPP_HIDE_FROM_ABI
+  flat_map(sorted_unique_t,
+           key_container_type __key_cont,
+           mapped_container_type __mapped_cont,
+           const key_compare& __comp = key_compare())
+      : __containers_{.keys = std::move(__key_cont), .values = std::move(__mapped_cont)}, __compare_(__comp) {}
+
+  template <class _Allocator>
+    requires __allocator_ctor_constraint<_Allocator>
+  _LIBCPP_HIDE_FROM_ABI
+  flat_map(sorted_unique_t,
+           const key_container_type& __key_cont,
+           const mapped_container_type& __mapped_cont,
+           const _Allocator& __alloc)
+      : flat_map(__ctor_uses_allocator_tag{}, __alloc, __key_cont, __mapped_cont) {}
+
+  template <class _Allocator>
+    requires __allocator_ctor_constraint<_Allocator>
+  _LIBCPP_HIDE_FROM_ABI
+  flat_map(sorted_unique_t,
+           const key_container_type& __key_cont,
+           const mapped_container_type& __mapped_cont,
+           const key_compare& __comp,
+           const _Allocator& __alloc)
+      : flat_map(__ctor_uses_allocator_tag{}, __alloc, __key_cont, __mapped_cont, __comp) {}
+
+  _LIBCPP_HIDE_FROM_ABI explicit flat_map(const key_compare& __comp) : __containers_(), __compare_(__comp) {}
+
+  template <class _Allocator>
+    requires __allocator_ctor_constraint<_Allocator>
+  _LIBCPP_HIDE_FROM_ABI flat_map(const key_compare& __comp, const _Allocator& __alloc)
+      : flat_map(__ctor_uses_allocator_empty_tag{}, __alloc, __comp) {}
+
+  template <class _Allocator>
+    requires __allocator_ctor_constraint<_Allocator>
+  _LIBCPP_HIDE_FROM_ABI explicit flat_map(const _Allocator& __alloc)
+      : flat_map(__ctor_uses_allocator_empty_tag{}, __alloc) {}
+
+  template <input_iterator _InputIterator>
+  _LIBCPP_HIDE_FROM_ABI
+  flat_map(_InputIterator __first, _InputIterator __last, const key_compare& __comp = key_compare())
+      : __containers_(), __compare_(__comp) {
+    insert(__first, __last);
+  }
+
+  template <input_iterator _InputIterator, class _Allocator>
+    requires __allocator_ctor_constraint<_Allocator>
+  _LIBCPP_HIDE_FROM_ABI
+  flat_map(_InputIterator __first, _InputIterator __last, const key_compare& __comp, const _Allocator& __alloc)
+      : flat_map(__ctor_uses_allocator_empty_tag{}, __alloc, __comp) {
+    insert(__first, __last);
+  }
+
+  template <input_iterator _InputIterator, class _Allocator>
+    requires __allocator_ctor_constraint<_Allocator>
+  _LIBCPP_HIDE_FROM_ABI flat_map(_InputIterator __first, _InputIterator __last, const _Allocator& __alloc)
+      : flat_map(__ctor_uses_allocator_empty_tag{}, __alloc) {
+    insert(__first, __last);
+  }
+
+  template <_ContainerCompatibleRange<value_type> _Range>
+  _LIBCPP_HIDE_FROM_ABI flat_map(from_range_t __fr, _Range&& __rg)
+      : flat_map(__fr, std::forward<_Range>(__rg), key_compare()) {}
+
+  template <_ContainerCompatibleRange<value_type> _Range, class _Allocator>
+    requires __allocator_ctor_constraint<_Allocator>
+  _LIBCPP_HIDE_FROM_ABI flat_map(from_range_t, _Range&& __rg, const _Allocator& __alloc)
+      : flat_map(__ctor_uses_allocator_empty_tag{}, __alloc) {
+    insert_range(std::forward<_Range>(__rg));
+  }
+
+  template <_ContainerCompatibleRange<value_type> _Range>
+  _LIBCPP_HIDE_FROM_ABI flat_map(from_range_t, _Range&& __rg, const key_compare& __comp) : flat_map(__comp) {
+    insert_range(std::forward<_Range>(__rg));
+  }
+
+  template <_ContainerCompatibleRange<value_type> _Range, class _Allocator>
+  _LIBCPP_HIDE_FROM_ABI flat_map(from_range_t, _Range&& __rg, const key_compare& __comp, const _Allocator& __alloc)
+      : flat_map(__ctor_uses_allocator_empty_tag{}, __alloc, __comp) {
+    insert_range(std::forward<_Range>(__rg));
+  }
+
+  template <input_iterator _InputIterator>
+  _LIBCPP_HIDE_FROM_ABI flat_map(
+      sorted_unique_t __s, _InputIterator __first, _InputIterator __last, const key_compare& __comp = key_compare())
+      : __containers_(), __compare_(__comp) {
+    insert(__s, __first, __last);
+  }
+  template <input_iterator _InputIterator, class _Allocator>
+    requires __allocator_ctor_constraint<_Allocator>
+  _LIBCPP_HIDE_FROM_ABI
+  flat_map(sorted_unique_t __s,
+           _InputIterator __first,
+           _InputIterator __last,
+           const key_compare& __comp,
+           const _Allocator& __alloc)
+      : flat_map(__ctor_uses_allocator_empty_tag{}, __alloc, __comp) {
+    insert(__s, __first, __last);
+  }
+
+  template <input_iterator _InputIterator, class _Allocator>
+    requires __allocator_ctor_constraint<_Allocator>
+  _LIBCPP_HIDE_FROM_ABI
+  flat_map(sorted_unique_t __s, _InputIterator __first, _InputIterator __last, const _Allocator& __alloc)
+      : flat_map(__ctor_uses_allocator_empty_tag{}, __alloc) {
+    insert(__s, __first, __last);
+  }
+
+  _LIBCPP_HIDE_FROM_ABI flat_map(initializer_list<value_type> __il, const key_compare& __comp = key_compare())
+      : flat_map(__il.begin(), __il.end(), __comp) {}
+
+  template <class _Allocator>
+    requires __allocator_ctor_constraint<_Allocator>
+  _LIBCPP_HIDE_FROM_ABI
+  flat_map(initializer_list<value_type> __il, const key_compare& __comp, const _Allocator& __alloc)
+      : flat_map(__il.begin(), __il.end(), __comp, __alloc) {}
+
+  template <class _Allocator>
+    requires __allocator_ctor_constraint<_Allocator>
+  _LIBCPP_HIDE_FROM_ABI flat_map(initializer_list<value_type> __il, const _Allocator& __alloc)
+      : flat_map(__il.begin(), __il.end(), __alloc) {}
+
+  _LIBCPP_HIDE_FROM_ABI
+  flat_map(sorted_unique_t __s, initializer_list<value_type> __il, const key_compare& __comp = key_compare())
+      : flat_map(__s, __il.begin(), __il.end(), __comp) {}
+
+  template <class _Allocator>
+    requires __allocator_ctor_constraint<_Allocator>
+  _LIBCPP_HIDE_FROM_ABI
+  flat_map(sorted_unique_t __s, initializer_list<value_type> __il, const key_compare& __comp, const _Allocator& __alloc)
+      : flat_map(__s, __il.begin(), __il.end(), __comp, __alloc) {}
+
+  template <class _Allocator>
+    requires __allocator_ctor_constraint<_Allocator>
+  _LIBCPP_HIDE_FROM_ABI flat_map(sorted_unique_t __s, initializer_list<value_type> __il, const _Allocator& __alloc)
+      : flat_map(__s, __il.begin(), __il.end(), __alloc) {}
+
+  _LIBCPP_HIDE_FROM_ABI flat_map& operator=(initializer_list<value_type> __il) {
+    clear();
+    insert(__il);
+    return *this;
+  }
+
+  // iterators
+  _LIBCPP_HIDE_FROM_ABI iterator begin() noexcept {
+    return iterator(__containers_.keys.begin(), __containers_.values.begin());
+  }
+
+  _LIBCPP_HIDE_FROM_ABI const_iterator begin() const noexcept {
+    return const_iterator(__containers_.keys.begin(), __containers_.values.begin());
+  }
+
+  _LIBCPP_HIDE_FROM_ABI iterator end() noexcept {
+    return iterator(__containers_.keys.end(), __containers_.values.end());
+  }
+
+  _LIBCPP_HIDE_FROM_ABI const_iterator end() const noexcept {
+    return const_iterator(__containers_.keys.end(), __containers_.values.end());
+  }
+
+  _LIBCPP_HIDE_FROM_ABI reverse_iterator rbegin() noexcept { return reverse_iterator(end()); }
+  _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rbegin() const noexcept { const_reverse_iterator(end()); }
+  _LIBCPP_HIDE_FROM_ABI reverse_iterator rend() noexcept { return reverse_iterator(begin()); }
+  _LIBCPP_HIDE_FROM_ABI const_reverse_iterator rend() const noexcept { return const_reverse_iterator(begin()); }
+
+  _LIBCPP_HIDE_FROM_ABI const_iterator cbegin() const noexcept { return begin(); }
+  _LIBCPP_HIDE_FROM_ABI const_iterator cend() const noexcept { return end(); }
+  _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crbegin() const noexcept { return const_reverse_iterator(end()); }
+  _LIBCPP_HIDE_FROM_ABI const_reverse_iterator crend() const noexcept { return const_reverse_iterator(begin()); }
+
+  // [flat.map.capacity], capacity
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI bool empty() const noexcept { return __containers_.keys.empty(); }
+
+  _LIBCPP_HIDE_FROM_ABI size_type size() cons...
[truncated]

Copy link
Contributor

@nicovank nicovank left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this! Just some questions/comments. I'm not familiar with libc++ development but am somewhat familiar with flat_map implementations.

libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Show resolved Hide resolved
Comment on lines +940 to +979
value_type __kv = *__first;
__containers_.keys.insert(__containers_.keys.end(), std::move(__kv.first));
__containers_.values.insert(__containers_.values.end(), std::move(__kv.second));
++__num_of_appended;
Copy link
Member

@ldionne ldionne Sep 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we materialize the iterator's value_type and we insert the elements one by one. If we had some kind of "protocol" that allows us to detect that an iterator is in fact a product of other iterators, we could decompose it to get the underlying iterators in the product and pass that directly to the containers. That way, we could call the underlying container's range-based insert method instead of inserting elements one-by-one.

This would apply to e.g. a zip view over two vectors, or when inserting into a flat_map from another flat_map. And given that we have significant optimizations in e.g. std::vector::insert(first, last) for contiguous iterators, this could end up making a big difference.

Example idea:

template <class _InputIterator, class _Sentinel>
  requires __is_product_iterator<_InputIterator>
_LIBCPP_HIDE_FROM_ABI size_type __append_no_check(_InputIterator __first, _Sentinel __last) {
  auto __first1 = std::__get_product_iterator_element<0>(__first);
  auto __first2 = std::__get_product_iterator_element<1>(__first);

  auto __last1 = std::__get_product_iterator_element<0>(__last);
  auto __last2 = std::__get_product_iterator_element<1>(__last);

  size_type __before = __containers_.keys.size();
  __containers_.keys.insert(__containers_.keys.end(), __first1, __last1);
  size_type __after = __containers_.keys.size();
  __containers_.values.insert(__containers_.values.end(), __first2, __last2);

  size_type __num_of_appended = __after - __before; // can we do better than that?

  // We could also have some kind of check like this, but we'd need to do that without making
  // the assumption that __first & __last are random access.
  _LIBCPP_ASSERT_INTERNAL((__last1 - __first1) == (__last2 - __first2), "something went horribly wrong");

  return __num_of_appended;
}

This makes me think about segmented iterator. It's not a category by itself, but it provides a (very useful) side channel to provide additional information to various places in the library. We don't have to implement this optimization day one (in fact we probably shouldn't for simplicity), but I think we really should consider doing it as a follow-up.

CC @philnik777 since this is the kind of stuff you generally like

See #108624

libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
@AaronBallman
Copy link
Collaborator

Thank you for this!

The tests are based on Arthur O'Dwyer's original implementation of std::flat_map.

Are these test cases you wrote yourself or are they test cases you pulled from the original implementation?

@ldionne
Copy link
Member

ldionne commented Sep 16, 2024

Are these test cases you wrote yourself or are they test cases you pulled from the original implementation?

The test cases were taken as-is and are now being modified as we see fit for this implementation.

libcxx/include/__flat_map/container_traits.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a lot of comments on the tests, many of which are nitpicks. Consider taking them as a batch in the Github UI -- that's probably easier than going over all of my diffs and applying them manually.

huixie90 added a commit that referenced this pull request Oct 12, 2024
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
DanielCChen pushed a commit to DanielCChen/llvm-project that referenced this pull request Oct 16, 2024
bricknerb pushed a commit to bricknerb/llvm-project that referenced this pull request Oct 17, 2024
Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the CI issues, go to libcxx/utils/libcxx/header_information.py and edit headers_not_available to remove flat_map. Then run the libcxx-generate-files target.

libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Show resolved Hide resolved
EricWF pushed a commit to efcs/llvm-project that referenced this pull request Oct 22, 2024
Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM! Thank you so much for this patch, I think this is amazing work.

libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Show resolved Hide resolved
libcxx/include/__flat_map/flat_map.h Outdated Show resolved Hide resolved
@ldionne
Copy link
Member

ldionne commented Oct 25, 2024

And we should also add a release note mentioning that PXXXX is partially implemented and that we provide flat_map.

@huixie90 huixie90 merged commit 0be1883 into llvm:main Oct 26, 2024
63 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Oct 26, 2024

LLVM Buildbot has detected a new failure on builder sanitizer-x86_64-linux-bootstrap-asan running on sanitizer-buildbot1 while building libcxx at step 2 "annotate".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/52/builds/3245

Here is the relevant piece of the build log for the reference
Step 2 (annotate) failure: 'python ../sanitizer_buildbot/sanitizers/zorg/buildbot/builders/sanitizers/buildbot_selector.py' (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 86533 of 86534 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
FAIL: lld :: ELF/linkerscript/overwrite-sections.test (85082 of 86533)
******************** TEST 'lld :: ELF/linkerscript/overwrite-sections.test' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: rm -rf /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp && split-file --leading-lines /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp
+ rm -rf /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp
+ split-file --leading-lines /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp
RUN: at line 3: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-mc -filetype=obj -triple=x86_64 /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.s -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-mc -filetype=obj -triple=x86_64 /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.s -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o
RUN: at line 8: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp1
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp1
RUN: at line 9: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-readelf -S /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp1 | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test --check-prefix=CHECK1
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-readelf -S /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp1
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test --check-prefix=CHECK1
RUN: at line 18: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /dev/null 2>&1 | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test --check-prefix=WARN1
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /dev/null
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test --check-prefix=WARN1
RUN: at line 25: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite2.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp2
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite2.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp2
RUN: at line 26: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-readelf -S -s /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp2 | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test --check-prefix=CHECK2
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-readelf -S -s /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp2
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test --check-prefix=CHECK2
RUN: at line 46: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld -T /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/main.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp3 2>&1 | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/count 0
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld -T /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/main.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp3
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/count 0
RUN: at line 47: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-readelf -S /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp3 | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test --check-prefix=CHECK3
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test --check-prefix=CHECK3
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-readelf -S /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp3
RUN: at line 48: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds -T /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/main.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp3 2>&1 | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/count 0
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds -T /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/main.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp3
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/count 0
Expected 0 lines, got 1.

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 
Step 10 (stage2/asan check) failure: stage2/asan check (failure)
...
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using lld-link: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/lld-link
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using ld64.lld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld64.lld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/llvm/config.py:506: note: using wasm-ld: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/wasm-ld
llvm-lit: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/llvm/utils/lit/lit/main.py:72: note: The test suite configuration requested an individual test timeout of 0 seconds but a timeout of 900 seconds was requested on the command line. Forcing timeout to be 900 seconds.
-- Testing: 86533 of 86534 tests, 88 workers --
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90..
FAIL: lld :: ELF/linkerscript/overwrite-sections.test (85082 of 86533)
******************** TEST 'lld :: ELF/linkerscript/overwrite-sections.test' FAILED ********************
Exit Code: 1

Command Output (stderr):
--
RUN: at line 2: rm -rf /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp && split-file --leading-lines /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp
+ rm -rf /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp
+ split-file --leading-lines /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp
RUN: at line 3: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-mc -filetype=obj -triple=x86_64 /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.s -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-mc -filetype=obj -triple=x86_64 /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.s -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o
RUN: at line 8: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp1
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp1
RUN: at line 9: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-readelf -S /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp1 | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test --check-prefix=CHECK1
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-readelf -S /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp1
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test --check-prefix=CHECK1
RUN: at line 18: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /dev/null 2>&1 | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test --check-prefix=WARN1
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /dev/null
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test --check-prefix=WARN1
RUN: at line 25: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite2.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp2
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite2.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp2
RUN: at line 26: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-readelf -S -s /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp2 | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test --check-prefix=CHECK2
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-readelf -S -s /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp2
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test --check-prefix=CHECK2
RUN: at line 46: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld -T /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/main.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp3 2>&1 | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/count 0
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld -T /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/main.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp3
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/count 0
RUN: at line 47: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-readelf -S /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp3 | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test --check-prefix=CHECK3
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/FileCheck /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm-project/lld/test/ELF/linkerscript/overwrite-sections.test --check-prefix=CHECK3
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/llvm-readelf -S /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp3
RUN: at line 48: /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds -T /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/main.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp3 2>&1 | /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/count 0
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/ld.lld /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/overwrite1.lds -T /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/main.lds /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp/a.o -o /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/tools/lld/test/ELF/linkerscript/Output/overwrite-sections.test.tmp3
+ /home/b/sanitizer-x86_64-linux-bootstrap-asan/build/llvm_build_asan/bin/count 0
Expected 0 lines, got 1.

--

********************
Testing:  0.. 10.. 20.. 30.. 40.. 50.. 60.. 70.. 80.. 90.. 

NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this pull request Nov 4, 2024
Around half of the tests are based on the tests Arthur O'Dwyer's
original implementation of std::flat_map, with modifications and
removals.

partially implement llvm#105190
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants