aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/Path.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2023-12-09 14:28:45 -0800
committerGitHub <noreply@github.com>2023-12-09 14:28:45 -0800
commitcc4ecfd68b79a44f101fe9924d088a83477797c0 (patch)
tree4d63911ccc3d757fc04a6706d6726e6ae765bd60 /llvm/unittests/Support/Path.cpp
parent5c8755f9f40e5b5f4e26a9a0fdb4993cb8a57202 (diff)
downloadllvm-cc4ecfd68b79a44f101fe9924d088a83477797c0.zip
llvm-cc4ecfd68b79a44f101fe9924d088a83477797c0.tar.gz
llvm-cc4ecfd68b79a44f101fe9924d088a83477797c0.tar.bz2
[ADT] Rename SmallString::{starts,ends}with to {starts,ends}_with (#74916)
This patch renames {starts,ends}with to {starts,ends}_with for consistency with std::{string,string_view}::{starts,ends}_with in C++20. Since there are only a handful of occurrences, this patch skips the deprecation phase and simply renames them.
Diffstat (limited to 'llvm/unittests/Support/Path.cpp')
-rw-r--r--llvm/unittests/Support/Path.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index 35a01aa..a7b7e6a 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -882,7 +882,7 @@ TEST_F(FileSystemTest, TempFiles) {
int FD2;
SmallString<64> TempPath2;
ASSERT_NO_ERROR(fs::createTemporaryFile("prefix", "temp", FD2, TempPath2));
- ASSERT_TRUE(TempPath2.endswith(".temp"));
+ ASSERT_TRUE(TempPath2.ends_with(".temp"));
ASSERT_NE(TempPath.str(), TempPath2.str());
fs::file_status A, B;
@@ -908,7 +908,7 @@ TEST_F(FileSystemTest, TempFiles) {
SmallString<64> TempPath3;
ASSERT_NO_ERROR(fs::createTemporaryFile("prefix", "", TempPath3));
- ASSERT_FALSE(TempPath3.endswith("."));
+ ASSERT_FALSE(TempPath3.ends_with("."));
FileRemover Cleanup3(TempPath3);
// Create a hard link to Temp1.
@@ -1515,13 +1515,13 @@ TEST(Support, NormalizePath) {
const char *Path7a = "~/aaa";
SmallString<64> Path7(Path7a);
path::native(Path7, path::Style::windows_backslash);
- EXPECT_TRUE(Path7.endswith("\\aaa"));
- EXPECT_TRUE(Path7.startswith(PathHome));
+ EXPECT_TRUE(Path7.ends_with("\\aaa"));
+ EXPECT_TRUE(Path7.starts_with(PathHome));
EXPECT_EQ(Path7.size(), PathHome.size() + strlen(Path7a + 1));
Path7 = Path7a;
path::native(Path7, path::Style::windows_slash);
- EXPECT_TRUE(Path7.endswith("/aaa"));
- EXPECT_TRUE(Path7.startswith(PathHome));
+ EXPECT_TRUE(Path7.ends_with("/aaa"));
+ EXPECT_TRUE(Path7.starts_with(PathHome));
EXPECT_EQ(Path7.size(), PathHome.size() + strlen(Path7a + 1));
const char *Path8a = "~";