aboutsummaryrefslogtreecommitdiff
path: root/clang/unittests/AST/CommentParser.cpp
diff options
context:
space:
mode:
authorJoe Loser <joeloser@fastmail.com>2022-09-08 14:26:11 -0600
committerJoe Loser <joeloser@fastmail.com>2022-09-08 17:20:25 -0600
commit1b3a78d1d534550b2f85a81b2e9ac6d7a94a478e (patch)
tree12a1943e51f34291357327f9a9aaa45cb2bf7467 /clang/unittests/AST/CommentParser.cpp
parent4d4ca6c9d036a06bf0723786112dd17e491b2f53 (diff)
downloadllvm-1b3a78d1d534550b2f85a81b2e9ac6d7a94a478e.zip
llvm-1b3a78d1d534550b2f85a81b2e9ac6d7a94a478e.tar.gz
llvm-1b3a78d1d534550b2f85a81b2e9ac6d7a94a478e.tar.bz2
[clang] Use std::size instead of llvm::array_lengthof
LLVM contains a helpful function for getting the size of a C-style array: `llvm::array_lengthof`. This is useful prior to C++17, but not as helpful for C++17 or later: `std::size` already has support for C-style arrays. Change call sites to use `std::size` instead. Leave the few call sites that use a locally defined `array_lengthof` that are meant to test previous bugs with NTTPs in clang analyzer and SemaTemplate. Differential Revision: https://reviews.llvm.org/D133520
Diffstat (limited to 'clang/unittests/AST/CommentParser.cpp')
-rw-r--r--clang/unittests/AST/CommentParser.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/clang/unittests/AST/CommentParser.cpp b/clang/unittests/AST/CommentParser.cpp
index 62c461a..ab2157d 100644
--- a/clang/unittests/AST/CommentParser.cpp
+++ b/clang/unittests/AST/CommentParser.cpp
@@ -664,7 +664,7 @@ TEST_F(CommentParserTest, ParagraphSplitting1) {
"*/"),
};
- for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ for (size_t i = 0, e = std::size(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
ASSERT_TRUE(HasChildCount(FC, 2));
@@ -801,7 +801,7 @@ TEST_F(CommentParserTest, ParamCommand3) {
"// Bbb\n")
};
- for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ for (size_t i = 0, e = std::size(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
ASSERT_TRUE(HasChildCount(FC, 2));
@@ -831,7 +831,7 @@ TEST_F(CommentParserTest, ParamCommand4) {
"// Bbb\n"),
};
- for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ for (size_t i = 0, e = std::size(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
ASSERT_TRUE(HasChildCount(FC, 2));
@@ -861,7 +861,7 @@ TEST_F(CommentParserTest, ParamCommand5) {
"// Bbb\n"),
};
- for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ for (size_t i = 0, e = std::size(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
ASSERT_TRUE(HasChildCount(FC, 2));
@@ -892,7 +892,7 @@ TEST_F(CommentParserTest, ParamCommand6) {
"// Bbb\n"
};
- for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ for (size_t i = 0, e = std::size(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
ASSERT_TRUE(HasChildCount(FC, 2));
@@ -947,7 +947,7 @@ TEST_F(CommentParserTest, TParamCommand1) {
"// Bbb\n"
};
- for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ for (size_t i = 0, e = std::size(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
ASSERT_TRUE(HasChildCount(FC, 2));
@@ -1081,7 +1081,7 @@ TEST_F(CommentParserTest, HTML1) {
"// <a >"
};
- for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ for (size_t i = 0, e = std::size(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
ASSERT_TRUE(HasChildCount(FC, 1));
@@ -1103,7 +1103,7 @@ TEST_F(CommentParserTest, HTML2) {
"// <br />"
};
- for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ for (size_t i = 0, e = std::size(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
ASSERT_TRUE(HasChildCount(FC, 1));
@@ -1127,7 +1127,7 @@ TEST_F(CommentParserTest, HTML3) {
"// <a href >",
};
- for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ for (size_t i = 0, e = std::size(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
ASSERT_TRUE(HasChildCount(FC, 1));
@@ -1149,7 +1149,7 @@ TEST_F(CommentParserTest, HTML4) {
"// <a href=\"bbb\">",
};
- for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ for (size_t i = 0, e = std::size(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
ASSERT_TRUE(HasChildCount(FC, 1));
@@ -1172,7 +1172,7 @@ TEST_F(CommentParserTest, HTML5) {
"// </a >"
};
- for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ for (size_t i = 0, e = std::size(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
ASSERT_TRUE(HasChildCount(FC, 1));
@@ -1285,7 +1285,7 @@ TEST_F(CommentParserTest, VerbatimBlock5) {
" *\\endverbatim*/"
};
- for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ for (size_t i = 0, e = std::size(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
ASSERT_TRUE(HasChildCount(FC, 1));
@@ -1309,7 +1309,7 @@ TEST_F(CommentParserTest, VerbatimBlock6) {
" * \\endverbatim*/"
};
- for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ for (size_t i = 0, e = std::size(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
ASSERT_TRUE(HasChildCount(FC, 2));
@@ -1336,7 +1336,7 @@ TEST_F(CommentParserTest, VerbatimBlock7) {
" * \\endverbatim*/"
};
- for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ for (size_t i = 0, e = std::size(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
ASSERT_TRUE(HasChildCount(FC, 2));
@@ -1364,7 +1364,7 @@ TEST_F(CommentParserTest, VerbatimBlock8) {
" * Bbb\n"
" * \\endverbatim*/"
};
- for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ for (size_t i = 0, e = std::size(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
ASSERT_TRUE(HasChildCount(FC, 2));
@@ -1387,7 +1387,7 @@ TEST_F(CommentParserTest, VerbatimLine1) {
"// \\fn\n"
};
- for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ for (size_t i = 0, e = std::size(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
ASSERT_TRUE(HasChildCount(FC, 2));
@@ -1405,7 +1405,7 @@ TEST_F(CommentParserTest, VerbatimLine2) {
"/** \\fn void *foo(const char *zzz = \"\\$\");*/"
};
- for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ for (size_t i = 0, e = std::size(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
ASSERT_TRUE(HasChildCount(FC, 2));
@@ -1424,7 +1424,7 @@ TEST_F(CommentParserTest, Deprecated) {
"/// @deprecated\n"
};
- for (size_t i = 0, e = array_lengthof(Sources); i != e; i++) {
+ for (size_t i = 0, e = std::size(Sources); i != e; i++) {
FullComment *FC = parseString(Sources[i]);
ASSERT_TRUE(HasChildCount(FC, 2));