[libc++] Qualifies size_t.

This has been done using the following command

  find libcxx/test -type f -exec perl -pi -e 's|^([^/]+?)((?<!::)size_t)|\1std::\2|' \{} \;

And manually removed some false positives in std/depr/depr.c.headers.

The `std` module doesn't export `::size_t`, this is a preparation for that module.

Reviewed By: ldionne, #libc, EricWF, philnik

Differential Revision: https://reviews.llvm.org/D146088
This commit is contained in:
Mark de Wever
2023-03-14 21:27:03 +01:00
parent 00fdd2cb6c
commit fb855eb941
465 changed files with 1636 additions and 1619 deletions

View File

@@ -30,7 +30,7 @@ TEST_CONSTEXPR_CXX20 void
test1(const S& s)
{
S s2(s);
const size_t sz = s2.max_size() - 1;
const std::size_t sz = s2.max_size() - 1;
try { s2.resize(sz, 'x'); }
catch ( const std::bad_alloc & ) { return ; }
assert ( s2.size() == sz );
@@ -41,7 +41,7 @@ TEST_CONSTEXPR_CXX20 void
test2(const S& s)
{
S s2(s);
const size_t sz = s2.max_size();
const std::size_t sz = s2.max_size();
try { s2.resize(sz, 'x'); }
catch ( const std::bad_alloc & ) { return ; }
assert ( s.size() == sz );
@@ -76,7 +76,7 @@ TEST_CONSTEXPR_CXX20 bool test() {
constexpr bool test_constexpr() {
std::string str;
size_t size = str.max_size();
std::size_t size = str.max_size();
assert(size > 0);
return true;

View File

@@ -31,7 +31,7 @@ test(const S& s)
{
assert(s.max_size() >= s.size());
S s2(s);
const size_t sz = s2.max_size() + 1;
const std::size_t sz = s2.max_size() + 1;
try { s2.resize(sz, 'x'); }
catch ( const std::length_error & ) { return ; }
assert ( false );

View File

@@ -21,7 +21,7 @@
#include "test_macros.h"
template <class S>
constexpr void test_appending(size_t k, size_t N, size_t new_capacity) {
constexpr void test_appending(std::size_t k, size_t N, size_t new_capacity) {
assert(N > k);
assert(new_capacity >= N);
auto s = S(k, 'a');
@@ -40,7 +40,7 @@ constexpr void test_appending(size_t k, size_t N, size_t new_capacity) {
}
template <class S>
constexpr void test_truncating(size_t o, size_t N) {
constexpr void test_truncating(std::size_t o, size_t N) {
assert(N < o);
auto s = S(o, 'a');
s.resize_and_overwrite(N, [&](auto* p, auto n) {
@@ -76,10 +76,10 @@ constexpr bool test() {
void test_value_categories() {
std::string s;
s.resize_and_overwrite(10, [](char*&&, size_t&&) { return 0; });
s.resize_and_overwrite(10, [](char* const&, const size_t&) { return 0; });
s.resize_and_overwrite(10, [](char*&&, std::size_t&&) { return 0; });
s.resize_and_overwrite(10, [](char* const&, const std::size_t&) { return 0; });
struct RefQualified {
int operator()(char*, size_t) && { return 0; }
int operator()(char*, std::size_t) && { return 0; }
};
s.resize_and_overwrite(10, RefQualified{});
}

View File

@@ -34,12 +34,12 @@ struct string16_char_traits {
static void assign(char_type&, const char_type&) { }
static bool eq(const char_type&, const char_type&) { return false; }
static bool lt(const char_type&, const char_type&) { return false; }
static int compare(const char_type*, const char_type*, size_t) { return 0; }
static size_t length(const char_type*) { return 0; }
static const char_type* find(const char_type*, size_t, const char_type&) { return nullptr; }
static char_type* move(char_type*, const char_type*, size_t) { return nullptr; }
static char_type* copy(char_type*, const char_type*, size_t) { return nullptr; }
static char_type* assign(char_type*, size_t, char_type) { return nullptr; }
static int compare(const char_type*, const char_type*, std::size_t) { return 0; }
static std::size_t length(const char_type*) { return 0; }
static const char_type* find(const char_type*, std::size_t, const char_type&) { return nullptr; }
static char_type* move(char_type*, const char_type*, std::size_t) { return nullptr; }
static char_type* copy(char_type*, const char_type*, std::size_t) { return nullptr; }
static char_type* assign(char_type*, std::size_t, char_type) { return nullptr; }
static int_type not_eof(const int_type&) { return 0; }
static char_type to_char_type(const int_type&) { return char_type(); }
static int_type to_int_type(const char_type&) { return int_type(); }