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++][modules] Refactor poisoned_hash_helper #108296

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion libcxx/include/type_traits
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,6 @@ namespace std
*/

#include <__config>
#include <__fwd/functional.h> // This is https://llvm.org/PR56938
#include <__type_traits/add_const.h>
#include <__type_traits/add_cv.h>
#include <__type_traits/add_lvalue_reference.h>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
#include "min_allocator.h"

TEST_CONSTEXPR_CXX20 bool test() {
test_hash_enabled_for_type<std::vector<bool> >();
test_hash_enabled_for_type<std::vector<bool, min_allocator<bool>>>();
test_hash_enabled<std::vector<bool> >();
test_hash_enabled<std::vector<bool, min_allocator<bool>>>();

return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
int main(int, char**) {
test_library_hash_specializations_available();
{
test_hash_enabled_for_type<std::error_code>();
test_hash_enabled_for_type<std::error_condition>();
test_hash_enabled<std::error_code>();
test_hash_enabled<std::error_condition>();
}

return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void test_hash() {
assert(h == std::hash<T*>()(&obj));
}

test_hash_enabled_for_type<std::experimental::observer_ptr<T>>();
test_hash_enabled<std::experimental::observer_ptr<T>>();
}

struct Bar {};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace fs = std::filesystem;

int main(int, char**) {
test_library_hash_specializations_available();
test_hash_enabled_for_type<fs::path>();
test_hash_enabled<fs::path>();

return 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ struct std::char_traits<MyChar> {
int main(int, char**) {
test_library_hash_specializations_available();
{
test_hash_enabled_for_type<std::string>();
test_hash_enabled<std::string>();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test_hash_enabled_for_type<std::wstring>();
test_hash_enabled<std::wstring>();
#endif
#ifndef TEST_HAS_NO_CHAR8_T
test_hash_enabled_for_type<std::u8string>();
test_hash_enabled<std::u8string>();
#endif
test_hash_enabled_for_type<std::u16string>();
test_hash_enabled_for_type<std::u32string>();
test_hash_enabled_for_type<std::basic_string<char, std::char_traits<char>, test_allocator<char>>>();
test_hash_disabled_for_type<std::basic_string<MyChar, std::char_traits<MyChar>, std::allocator<MyChar>>>();
test_hash_disabled_for_type<std::basic_string<char, constexpr_char_traits<char>, std::allocator<char>>>();
test_hash_enabled<std::u16string>();
test_hash_enabled<std::u32string>();
test_hash_enabled<std::basic_string<char, std::char_traits<char>, test_allocator<char>>>();
test_hash_disabled<std::basic_string<MyChar, std::char_traits<MyChar>, std::allocator<MyChar>>>();
test_hash_disabled<std::basic_string<char, constexpr_char_traits<char>, std::allocator<char>>>();
}

return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ struct std::char_traits<MyChar> {
int main(int, char**) {
test_library_hash_specializations_available();
{
test_hash_enabled_for_type<std::string_view>();
test_hash_enabled<std::string_view>();
#ifndef TEST_HAS_NO_WIDE_CHARACTERS
test_hash_enabled_for_type<std::wstring_view>();
test_hash_enabled<std::wstring_view>();
#endif
#ifndef TEST_HAS_NO_CHAR8_T
test_hash_enabled_for_type<std::u8string_view>();
test_hash_enabled<std::u8string_view>();
#endif
test_hash_enabled_for_type<std::u16string_view>();
test_hash_enabled_for_type<std::u32string_view>();
test_hash_disabled_for_type<std::basic_string_view<MyChar, std::char_traits<MyChar>>>();
test_hash_disabled_for_type<std::basic_string_view<char, constexpr_char_traits<char>>>();
test_hash_enabled<std::u16string_view>();
test_hash_enabled<std::u32string_view>();
test_hash_disabled<std::basic_string_view<MyChar, std::char_traits<MyChar>>>();
test_hash_disabled<std::basic_string_view<char, constexpr_char_traits<char>>>();
}

return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
int main(int, char**) {
test_library_hash_specializations_available();
{
test_hash_enabled_for_type<std::thread::id>();
test_hash_enabled<std::thread::id>();
}

return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ int main(int, char**)
}
#if TEST_STD_VER >= 11
{
test_hash_enabled_for_type<std::shared_ptr<int>>();
test_hash_enabled_for_type<std::shared_ptr<A>>();
test_hash_enabled<std::shared_ptr<int>>();
test_hash_enabled<std::shared_ptr<A>>();
}
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ void test_enabled_with_deleter() {
using RawDel = typename std::decay<Del>::type;
RawDel d(1);
UPtr p(nullptr, std::forward<Del>(d));
test_hash_enabled_for_type<UPtr>(p);
test_hash_enabled_for_type<pointer>();
test_hash_enabled<UPtr>(p);
test_hash_enabled<pointer>();
}

template <class ValueT, class Del>
void test_disabled_with_deleter() {
using UPtr = std::unique_ptr<ValueT, Del>;
using pointer = typename UPtr::pointer;
test_hash_disabled_for_type<UPtr>();
test_hash_disabled_for_type<pointer>();
test_hash_disabled<UPtr>();
test_hash_disabled<pointer>();
}

template <class T>
Expand Down
16 changes: 8 additions & 8 deletions libcxx/test/std/utilities/optional/optional.hash/hash.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,16 @@ int main(int, char**)
assert(std::hash<optional<T>>{}(opt) == std::hash<T>{}(*opt));
}
{
test_hash_enabled_for_type<std::optional<int> >();
test_hash_enabled_for_type<std::optional<int*> >();
test_hash_enabled_for_type<std::optional<const int> >();
test_hash_enabled_for_type<std::optional<int* const> >();
test_hash_enabled<std::optional<int> >();
test_hash_enabled<std::optional<int*> >();
test_hash_enabled<std::optional<const int> >();
test_hash_enabled<std::optional<int* const> >();

test_hash_disabled_for_type<std::optional<A>>();
test_hash_disabled_for_type<std::optional<const A>>();
test_hash_disabled<std::optional<A>>();
test_hash_disabled<std::optional<const A>>();

test_hash_enabled_for_type<std::optional<B>>();
test_hash_enabled_for_type<std::optional<const B>>();
test_hash_enabled<std::optional<B>>();
test_hash_enabled<std::optional<const B>>();
}

return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
int main(int, char**) {
test_library_hash_specializations_available();
{
test_hash_enabled_for_type<std::bitset<0> >();
test_hash_enabled_for_type<std::bitset<1> >();
test_hash_enabled_for_type<std::bitset<1024> >();
test_hash_enabled_for_type<std::bitset<100000> >();
test_hash_enabled<std::bitset<0> >();
test_hash_enabled<std::bitset<1> >();
test_hash_enabled<std::bitset<1024> >();
test_hash_enabled<std::bitset<100000> >();
}

return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ int main(int, char**)
}
#if TEST_STD_VER >= 11
{
test_hash_enabled_for_type<std::type_index>(std::type_index(typeid(int)));
test_hash_enabled<std::type_index>(std::type_index(typeid(int)));
}
#endif

Expand Down
14 changes: 7 additions & 7 deletions libcxx/test/std/utilities/variant/variant.hash/hash.pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ void test_hash_monostate() {
static_assert(std::is_copy_constructible<H>::value, "");
}
{
test_hash_enabled_for_type<std::monostate>();
test_hash_enabled<std::monostate>();
}
}

Expand Down Expand Up @@ -131,16 +131,16 @@ struct std::hash<B> {

void test_hash_variant_enabled() {
{
test_hash_enabled_for_type<std::variant<int> >();
test_hash_enabled_for_type<std::variant<int*, long, double, const int> >();
test_hash_enabled<std::variant<int> >();
test_hash_enabled<std::variant<int*, long, double, const int> >();
}
{
test_hash_disabled_for_type<std::variant<int, A>>();
test_hash_disabled_for_type<std::variant<const A, void*>>();
test_hash_disabled<std::variant<int, A>>();
test_hash_disabled<std::variant<const A, void*>>();
}
{
test_hash_enabled_for_type<std::variant<int, B>>();
test_hash_enabled_for_type<std::variant<const B, int>>();
test_hash_enabled<std::variant<int, B>>();
test_hash_enabled<std::variant<const B, int>>();
}
}

Expand Down
Loading
Loading