diff options
author | Joe Loser <joeloser@fastmail.com> | 2022-09-08 14:26:11 -0600 |
---|---|---|
committer | Joe Loser <joeloser@fastmail.com> | 2022-09-08 17:20:25 -0600 |
commit | 1b3a78d1d534550b2f85a81b2e9ac6d7a94a478e (patch) | |
tree | 12a1943e51f34291357327f9a9aaa45cb2bf7467 /clang/unittests/Tooling/CompilationDatabaseTest.cpp | |
parent | 4d4ca6c9d036a06bf0723786112dd17e491b2f53 (diff) | |
download | llvm-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/Tooling/CompilationDatabaseTest.cpp')
-rw-r--r-- | clang/unittests/Tooling/CompilationDatabaseTest.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/unittests/Tooling/CompilationDatabaseTest.cpp b/clang/unittests/Tooling/CompilationDatabaseTest.cpp index 8194dd3..3314ecd 100644 --- a/clang/unittests/Tooling/CompilationDatabaseTest.cpp +++ b/clang/unittests/Tooling/CompilationDatabaseTest.cpp @@ -642,7 +642,7 @@ TEST(ParseFixedCompilationDatabase, HandlesPositionalArgsSyntaxOnly) { // Adjust the given command line arguments to ensure that any positional // arguments in them are stripped. const char *Argv[] = {"--", "somefile.cpp", "-fsyntax-only", "-DDEF3"}; - int Argc = llvm::array_lengthof(Argv); + int Argc = std::size(Argv); std::string ErrorMessage; std::unique_ptr<CompilationDatabase> Database = FixedCompilationDatabase::loadFromCommandLine(Argc, Argv, ErrorMessage); |