libc++ test: update MinSequenceContainer.h to make some tests pass on MSVC STL#140287
libc++ test: update MinSequenceContainer.h to make some tests pass on MSVC STL#140287frederick-vs-ja merged 15 commits intollvm:mainfrom AlexGuteniev:patch-1
Conversation
|
@llvm/pr-subscribers-libcxx Author: Alex Guteniev (AlexGuteniev) ChangesPer [sequence.reqmts] there are these member functions. I did not audit if any other member functions are missing. Adding these is enough for MSVC STL Full diff: https://github.com/llvm/llvm-project/pull/140287.diff 1 Files Affected:
diff --git a/libcxx/test/support/MinSequenceContainer.h b/libcxx/test/support/MinSequenceContainer.h
index 6e61aff06344b..b17ced6dfc2ff 100644
--- a/libcxx/test/support/MinSequenceContainer.h
+++ b/libcxx/test/support/MinSequenceContainer.h
@@ -28,6 +28,13 @@ struct MinSequenceContainer {
template <class It>
explicit MinSequenceContainer(It first, It last) : data_(first, last) {}
MinSequenceContainer(std::initializer_list<T> il) : data_(il) {}
+
+ template <class It>
+ void assign(It first, It last) {
+ data_.assign(first, last);
+ }
+ void assign(std::initializer_list<T> il) { data_.assign(il); }
+ void assign(size_type n, value_type t) { data_.assign(n, t); }
iterator begin() { return iterator(data_.data()); }
const_iterator begin() const { return const_iterator(data_.data()); }
const_iterator cbegin() const { return const_iterator(data_.data()); }
@@ -47,6 +54,8 @@ struct MinSequenceContainer {
return from_vector_iterator(data_.insert(to_vector_iterator(p), std::move(value)));
}
+ iterator insert_range(const_iterator p, auto rg) { return data_.insert_range((to_vector_iterator(p), rg); }
+
iterator erase(const_iterator first, const_iterator last) {
return from_vector_iterator(data_.erase(to_vector_iterator(first), to_vector_iterator(last)));
}
|
|
✅ With the latest revision this PR passed the C/C++ code formatter. |
|
thanks for the fix. actually i made a commit recently which relies on this helper type's absence of this means i need to refactor the test not to use MinSenquenceContainer to make CI green. |
Maybe we can solve this with prerocessor then |
Or maybe we should consider supporting this too. @StephanTLavavej , please confirm if supporting pre-C++23 containers in |
|
@AlexGuteniev I fixed my tests not relying on |
I'd say yes, that's a non-goal. It seems to me that if someone wants to use a new container adaptor, they can be expected to provide a sufficiently modern container. |
Thanks, but I don't think it is a path forward. The goal of my PR is to make the tests, including yours, pass with MSVC STL, so with your fix my PR does not make sense. I think we should instead use preprocessor and make |
No I don't think you should guard against libc++. Your original fix looks good to me. the helper type in the test/std folder is meant to be used for all implementations. not just libc++. Anything that is libc++ specific is our extension and should be put into test/libcxx folder. and this is what I was doing in #140372 |
Ok, will revert that |
frederick-vs-ja
left a comment
There was a problem hiding this comment.
I did not audit if any other member functions are missing. Adding these is enough for MSVC STL
The following member functions are still missing:
from_range_tconstructor (since C++23),- constructor from
(n, t), operator=frominitializer_list,inserttaking(p, n, t),inserttaking(p, il),assign_range(since C++23).
No change requested. I think they can be added in a following-up PR.
The affected tests are relying on the fact that `MinSequenceContainer` does not have `insert_range`. This prevents landing of #140287. This PR creates a new helper class to allow the change in MinSequenceContainer.
|
btw, the CI looks OK to me. the msan failure has nothing to do with your patch
This failure seems happen all the time now. |
… MSVC STL (llvm#140287) Per [sequence.reqmts] there are these member functions. I did not audit if any other member functions are missing. Adding these is enough for MSVC STL
…pass on MSVC STL (#158344) Continues #140287 `from_range_t` constructor is needed by MSVC STL to pass `std/containers/container.adaptors/flat.set/flat.set.cons/range.pass.cpp`. The rest are added to complete the container according to #140287 (review).
… more test pass on MSVC STL (#158344) Continues #140287 `from_range_t` constructor is needed by MSVC STL to pass `std/containers/container.adaptors/flat.set/flat.set.cons/range.pass.cpp`. The rest are added to complete the container according to llvm/llvm-project#140287 (review).
Per [sequence.reqmts] there are these member functions.
I did not audit if any other member functions are missing. Adding these is enough for MSVC STL