aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/ADT/StringRefTest.cpp
diff options
context:
space:
mode:
authorserge-sans-paille <sguelton@redhat.com>2022-01-26 10:11:12 -0500
committerserge-sans-paille <sguelton@redhat.com>2022-01-26 16:17:45 +0100
commitef8206320769ad31422a803a0d6de6077fd231d2 (patch)
tree06ca6445f38939d6a543e0a64c2ede55497a06cd /llvm/unittests/ADT/StringRefTest.cpp
parent99ae5c13f64e138d6b17c00bd01c87c3ce58cb6b (diff)
downloadllvm-ef8206320769ad31422a803a0d6de6077fd231d2.zip
llvm-ef8206320769ad31422a803a0d6de6077fd231d2.tar.gz
llvm-ef8206320769ad31422a803a0d6de6077fd231d2.tar.bz2
Rename llvm::array_lengthof into llvm::size to match std::size from C++17
As a conquence move llvm::array_lengthof from STLExtras.h to STLForwardCompat.h (which is included by STLExtras.h so no build breakage expected).
Diffstat (limited to 'llvm/unittests/ADT/StringRefTest.cpp')
-rw-r--r--llvm/unittests/ADT/StringRefTest.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/unittests/ADT/StringRefTest.cpp b/llvm/unittests/ADT/StringRefTest.cpp
index e80a25a..114c097 100644
--- a/llvm/unittests/ADT/StringRefTest.cpp
+++ b/llvm/unittests/ADT/StringRefTest.cpp
@@ -659,7 +659,7 @@ TEST(StringRefTest, getAsInteger) {
uint32_t U32;
uint64_t U64;
- for (size_t i = 0; i < array_lengthof(Unsigned); ++i) {
+ for (size_t i = 0; i < size(Unsigned); ++i) {
bool U8Success = StringRef(Unsigned[i].Str).getAsInteger(0, U8);
if (static_cast<uint8_t>(Unsigned[i].Expected) == Unsigned[i].Expected) {
ASSERT_FALSE(U8Success);
@@ -691,7 +691,7 @@ TEST(StringRefTest, getAsInteger) {
int32_t S32;
int64_t S64;
- for (size_t i = 0; i < array_lengthof(Signed); ++i) {
+ for (size_t i = 0; i < size(Signed); ++i) {
bool S8Success = StringRef(Signed[i].Str).getAsInteger(0, S8);
if (static_cast<int8_t>(Signed[i].Expected) == Signed[i].Expected) {
ASSERT_FALSE(S8Success);
@@ -737,7 +737,7 @@ static const char* BadStrings[] = {
TEST(StringRefTest, getAsUnsignedIntegerBadStrings) {
unsigned long long U64;
- for (size_t i = 0; i < array_lengthof(BadStrings); ++i) {
+ for (size_t i = 0; i < size(BadStrings); ++i) {
bool IsBadNumber = StringRef(BadStrings[i]).getAsInteger(0, U64);
ASSERT_TRUE(IsBadNumber);
}
@@ -820,7 +820,7 @@ TEST(StringRefTest, consumeIntegerUnsigned) {
uint32_t U32;
uint64_t U64;
- for (size_t i = 0; i < array_lengthof(ConsumeUnsigned); ++i) {
+ for (size_t i = 0; i < size(ConsumeUnsigned); ++i) {
StringRef Str = ConsumeUnsigned[i].Str;
bool U8Success = Str.consumeInteger(0, U8);
if (static_cast<uint8_t>(ConsumeUnsigned[i].Expected) ==
@@ -868,7 +868,7 @@ TEST(StringRefTest, consumeIntegerSigned) {
int32_t S32;
int64_t S64;
- for (size_t i = 0; i < array_lengthof(ConsumeSigned); ++i) {
+ for (size_t i = 0; i < size(ConsumeSigned); ++i) {
StringRef Str = ConsumeSigned[i].Str;
bool S8Success = Str.consumeInteger(0, S8);
if (static_cast<int8_t>(ConsumeSigned[i].Expected) ==
@@ -945,7 +945,7 @@ static const char join_result3[] = "a::b::c";
TEST(StringRefTest, joinStrings) {
std::vector<StringRef> v1;
std::vector<std::string> v2;
- for (size_t i = 0; i < array_lengthof(join_input); ++i) {
+ for (size_t i = 0; i < size(join_input); ++i) {
v1.push_back(join_input[i]);
v2.push_back(join_input[i]);
}