diff options
author | Kazu Hirata <kazu@google.com> | 2022-11-26 13:58:48 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-11-26 13:58:48 -0800 |
commit | e2138ecc72a99cb04fc7d02e57fadcc2b7c85ad9 (patch) | |
tree | ef305c3adaf032a516e48e0b36eafb91ab2d322c /clang/unittests/Tooling/CompilationDatabaseTest.cpp | |
parent | 589725f6e803d77adedc3fb5a1cbeaddb99f439a (diff) | |
download | llvm-e2138ecc72a99cb04fc7d02e57fadcc2b7c85ad9.zip llvm-e2138ecc72a99cb04fc7d02e57fadcc2b7c85ad9.tar.gz llvm-e2138ecc72a99cb04fc7d02e57fadcc2b7c85ad9.tar.bz2 |
[clang] Use std::size (NFC)
std::size, introduced in C++17, allows us to directly obtain the
number of elements of an array.
Diffstat (limited to 'clang/unittests/Tooling/CompilationDatabaseTest.cpp')
-rw-r--r-- | clang/unittests/Tooling/CompilationDatabaseTest.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/unittests/Tooling/CompilationDatabaseTest.cpp b/clang/unittests/Tooling/CompilationDatabaseTest.cpp index fb8c10d..ee91af7a 100644 --- a/clang/unittests/Tooling/CompilationDatabaseTest.cpp +++ b/clang/unittests/Tooling/CompilationDatabaseTest.cpp @@ -642,7 +642,7 @@ TEST(ParseFixedCompilationDatabase, ReturnsEmptyCommandLine) { TEST(ParseFixedCompilationDatabase, HandlesPositionalArgs) { const char *Argv[] = {"1", "2", "--", "-c", "somefile.cpp", "-DDEF3"}; - int Argc = sizeof(Argv) / sizeof(char*); + int Argc = std::size(Argv); std::string ErrorMsg; std::unique_ptr<FixedCompilationDatabase> Database = FixedCompilationDatabase::loadFromCommandLine(Argc, Argv, ErrorMsg); @@ -677,7 +677,7 @@ TEST(ParseFixedCompilationDatabase, HandlesPositionalArgsSyntaxOnly) { TEST(ParseFixedCompilationDatabase, HandlesArgv0) { const char *Argv[] = {"1", "2", "--", "mytool", "somefile.cpp"}; - int Argc = sizeof(Argv) / sizeof(char*); + int Argc = std::size(Argv); std::string ErrorMsg; std::unique_ptr<FixedCompilationDatabase> Database = FixedCompilationDatabase::loadFromCommandLine(Argc, Argv, ErrorMsg); |