diff options
author | Kazu Hirata <kazu@google.com> | 2022-11-26 13:47:32 -0800 |
---|---|---|
committer | Kazu Hirata <kazu@google.com> | 2022-11-26 13:47:32 -0800 |
commit | 589725f6e803d77adedc3fb5a1cbeaddb99f439a (patch) | |
tree | 947cebe2b683e28094d5a224533782f7bc6f5f9a /llvm/unittests/Support/CommandLineTest.cpp | |
parent | 25f01d593ce296078f57e872778b77d074ae5888 (diff) | |
download | llvm-589725f6e803d77adedc3fb5a1cbeaddb99f439a.zip llvm-589725f6e803d77adedc3fb5a1cbeaddb99f439a.tar.gz llvm-589725f6e803d77adedc3fb5a1cbeaddb99f439a.tar.bz2 |
[llvm] 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 'llvm/unittests/Support/CommandLineTest.cpp')
-rw-r--r-- | llvm/unittests/Support/CommandLineTest.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/unittests/Support/CommandLineTest.cpp b/llvm/unittests/Support/CommandLineTest.cpp index df33e53..0d0b6ec 100644 --- a/llvm/unittests/Support/CommandLineTest.cpp +++ b/llvm/unittests/Support/CommandLineTest.cpp @@ -740,7 +740,7 @@ TEST(CommandLineTest, DefaultOptions) { StackOption<std::string> SC2_Foo("foo", cl::sub(SC2)); const char *args0[] = {"prog", "-b", "args0 bar string", "-f"}; - EXPECT_TRUE(cl::ParseCommandLineOptions(sizeof(args0) / sizeof(char *), args0, + EXPECT_TRUE(cl::ParseCommandLineOptions(std::size(args0), args0, StringRef(), &llvm::nulls())); EXPECT_EQ(Bar, "args0 bar string"); EXPECT_TRUE(Foo); @@ -750,7 +750,7 @@ TEST(CommandLineTest, DefaultOptions) { cl::ResetAllOptionOccurrences(); const char *args1[] = {"prog", "sc1", "-b", "-bar", "args1 bar string", "-f"}; - EXPECT_TRUE(cl::ParseCommandLineOptions(sizeof(args1) / sizeof(char *), args1, + EXPECT_TRUE(cl::ParseCommandLineOptions(std::size(args1), args1, StringRef(), &llvm::nulls())); EXPECT_EQ(Bar, "args1 bar string"); EXPECT_TRUE(Foo); @@ -766,7 +766,7 @@ TEST(CommandLineTest, DefaultOptions) { const char *args2[] = {"prog", "sc2", "-b", "args2 bar string", "-f", "-foo", "foo string"}; - EXPECT_TRUE(cl::ParseCommandLineOptions(sizeof(args2) / sizeof(char *), args2, + EXPECT_TRUE(cl::ParseCommandLineOptions(std::size(args2), args2, StringRef(), &llvm::nulls())); EXPECT_EQ(Bar, "args2 bar string"); EXPECT_TRUE(Foo); |