[llvm] 5c9d82d - [llvm] Use StringRef::{starts,ends}_with (NFC)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 13 22:46:08 PST 2023


Author: Kazu Hirata
Date: 2023-12-13T22:46:02-08:00
New Revision: 5c9d82de6b72cc0c037daecce452c450870f0034

URL: https://github.com/llvm/llvm-project/commit/5c9d82de6b72cc0c037daecce452c450870f0034
DIFF: https://github.com/llvm/llvm-project/commit/5c9d82de6b72cc0c037daecce452c450870f0034.diff

LOG: [llvm] Use StringRef::{starts,ends}_with (NFC)

This patch replaces uses of StringRef::{starts,ends}with with
StringRef::{starts,ends}_with for consistency with
std::{string,string_view}::{starts,ends}_with in C++20.

I'm planning to deprecate and eventually remove
StringRef::{starts,ends}with.

Added: 
    

Modified: 
    llvm/lib/AsmParser/LLLexer.cpp
    llvm/unittests/Analysis/CFGTest.cpp
    llvm/unittests/Analysis/TBAATest.cpp
    llvm/unittests/CodeGen/MachineInstrTest.cpp
    llvm/unittests/DebugInfo/LogicalView/CodeViewReaderTest.cpp
    llvm/unittests/DebugInfo/LogicalView/ELFReaderTest.cpp
    llvm/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h
    llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
    llvm/unittests/FileCheck/FileCheckTest.cpp
    llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
    llvm/unittests/IR/VerifierTest.cpp
    llvm/unittests/Support/MemoryBufferTest.cpp
    llvm/unittests/Support/ProgramTest.cpp
    llvm/unittests/Support/TarWriterTest.cpp
    llvm/unittests/Support/TypeNameTest.cpp
    llvm/unittests/Support/VirtualFileSystemTest.cpp
    llvm/unittests/TargetParser/CSKYTargetParserTest.cpp
    llvm/unittests/TargetParser/TargetParserTest.cpp
    llvm/unittests/Transforms/Coroutines/ExtraRematTest.cpp
    llvm/unittests/Transforms/Utils/CloningTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/AsmParser/LLLexer.cpp b/llvm/lib/AsmParser/LLLexer.cpp
index fcb25f5f1d49df..c8da3efbb68aff 100644
--- a/llvm/lib/AsmParser/LLLexer.cpp
+++ b/llvm/lib/AsmParser/LLLexer.cpp
@@ -906,7 +906,7 @@ lltok::Kind LLLexer::LexIdentifier() {
 
 #define DWKEYWORD(TYPE, TOKEN)                                                 \
   do {                                                                         \
-    if (Keyword.startswith("DW_" #TYPE "_")) {                                 \
+    if (Keyword.starts_with("DW_" #TYPE "_")) {                                \
       StrVal.assign(Keyword.begin(), Keyword.end());                           \
       return lltok::TOKEN;                                                     \
     }                                                                          \

diff  --git a/llvm/unittests/Analysis/CFGTest.cpp b/llvm/unittests/Analysis/CFGTest.cpp
index 3ffad1c3238029..46164268468628 100644
--- a/llvm/unittests/Analysis/CFGTest.cpp
+++ b/llvm/unittests/Analysis/CFGTest.cpp
@@ -61,7 +61,7 @@ class IsPotentiallyReachableTest : public testing::Test {
 
     assert(ExclusionSet.empty());
     for (auto I = F->begin(), E = F->end(); I != E; ++I) {
-      if (I->hasName() && I->getName().startswith("excluded"))
+      if (I->hasName() && I->getName().starts_with("excluded"))
         ExclusionSet.insert(&*I);
     }
   }

diff  --git a/llvm/unittests/Analysis/TBAATest.cpp b/llvm/unittests/Analysis/TBAATest.cpp
index 3367aefcd608f0..3e81968b483568 100644
--- a/llvm/unittests/Analysis/TBAATest.cpp
+++ b/llvm/unittests/Analysis/TBAATest.cpp
@@ -59,7 +59,7 @@ TEST_F(TBAATest, checkVerifierBehaviorForOldTBAA) {
 
   EXPECT_TRUE(verifyFunction(*F, &Outs));
   EXPECT_TRUE(StringRef(ErrorMsg.begin(), ErrorMsg.size())
-                  .startswith(ExpectedFailureMsg));
+                  .starts_with(ExpectedFailureMsg));
 }
 
 TEST_F(TBAATest, checkTBAAMerging) {

diff  --git a/llvm/unittests/CodeGen/MachineInstrTest.cpp b/llvm/unittests/CodeGen/MachineInstrTest.cpp
index 0841cd3a7fb04f..7c45d9784bb8e7 100644
--- a/llvm/unittests/CodeGen/MachineInstrTest.cpp
+++ b/llvm/unittests/CodeGen/MachineInstrTest.cpp
@@ -222,9 +222,8 @@ TEST(MachineInstrPrintingTest, DebugLocPrinting) {
   MI->print(OS, /*IsStandalone*/true, /*SkipOpers*/false, /*SkipDebugLoc*/false,
             /*AddNewLine*/false);
   ASSERT_TRUE(
-      StringRef(OS.str()).startswith("$noreg = UNKNOWN debug-location "));
-  ASSERT_TRUE(
-      StringRef(OS.str()).endswith("filename:1:5"));
+      StringRef(OS.str()).starts_with("$noreg = UNKNOWN debug-location "));
+  ASSERT_TRUE(StringRef(OS.str()).ends_with("filename:1:5"));
 }
 
 TEST(MachineInstrSpan, DistanceBegin) {

diff  --git a/llvm/unittests/DebugInfo/LogicalView/CodeViewReaderTest.cpp b/llvm/unittests/DebugInfo/LogicalView/CodeViewReaderTest.cpp
index eb9477e40ed90b..125bc17a006711 100644
--- a/llvm/unittests/DebugInfo/LogicalView/CodeViewReaderTest.cpp
+++ b/llvm/unittests/DebugInfo/LogicalView/CodeViewReaderTest.cpp
@@ -73,7 +73,7 @@ void checkElementPropertiesClangCodeview(LVReader *Reader) {
   EXPECT_EQ(Root->getName(), CodeViewClang);
 
   EXPECT_EQ(CompileUnit->getBaseAddress(), 0u);
-  EXPECT_TRUE(CompileUnit->getProducer().startswith("clang"));
+  EXPECT_TRUE(CompileUnit->getProducer().starts_with("clang"));
   EXPECT_EQ(CompileUnit->getName(), "test.cpp");
 
   EXPECT_EQ(Function->lineCount(), 16u);
@@ -139,7 +139,7 @@ void checkElementPropertiesMsvcCodeview(LVReader *Reader) {
   EXPECT_EQ(Root->getName(), CodeViewMsvc);
 
   EXPECT_EQ(CompileUnit->getBaseAddress(), 0u);
-  EXPECT_TRUE(CompileUnit->getProducer().startswith("Microsoft"));
+  EXPECT_TRUE(CompileUnit->getProducer().starts_with("Microsoft"));
   EXPECT_EQ(CompileUnit->getName(), "test.cpp");
 
   EXPECT_EQ(Function->lineCount(), 14u);
@@ -205,7 +205,7 @@ void checkElementPropertiesMsvcCodeviewPdb(LVReader *Reader) {
   EXPECT_EQ(Root->getName(), CodeViewPdbMsvc);
 
   EXPECT_EQ(CompileUnit->getBaseAddress(), 0u);
-  EXPECT_TRUE(CompileUnit->getProducer().startswith("Microsoft"));
+  EXPECT_TRUE(CompileUnit->getProducer().starts_with("Microsoft"));
   EXPECT_EQ(CompileUnit->getName(), "test.cpp");
 
   EXPECT_EQ(Function->lineCount(), 14u);

diff  --git a/llvm/unittests/DebugInfo/LogicalView/ELFReaderTest.cpp b/llvm/unittests/DebugInfo/LogicalView/ELFReaderTest.cpp
index f6db28afef20f7..bd278befbc642f 100644
--- a/llvm/unittests/DebugInfo/LogicalView/ELFReaderTest.cpp
+++ b/llvm/unittests/DebugInfo/LogicalView/ELFReaderTest.cpp
@@ -70,7 +70,7 @@ void checkElementProperties(LVReader *Reader) {
   EXPECT_EQ(Root->getName(), DwarfClang);
 
   EXPECT_EQ(CompileUnit->getBaseAddress(), 0u);
-  EXPECT_TRUE(CompileUnit->getProducer().startswith("clang"));
+  EXPECT_TRUE(CompileUnit->getProducer().starts_with("clang"));
   EXPECT_EQ(CompileUnit->getName(), "test.cpp");
 
   EXPECT_EQ(CompileUnit->lineCount(), 0u);

diff  --git a/llvm/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h b/llvm/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h
index 7071681c26aaed..13484e1bd9029a 100644
--- a/llvm/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h
+++ b/llvm/unittests/ExecutionEngine/MCJIT/MCJITTestAPICommon.h
@@ -73,7 +73,7 @@ class MCJITTestAPICommon {
     // If ARCH has sub-arch support, find it
     SmallVectorImpl<std::string>::const_iterator I = SupportedSubArchs.begin();
     for(; I != SupportedSubArchs.end(); ++I)
-      if (Host.getArchName().startswith(*I))
+      if (Host.getArchName().starts_with(*I))
         return true;
 
     return false;

diff  --git a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
index d62973f30add90..12f42633d03728 100644
--- a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
@@ -124,7 +124,7 @@ class OrcCAPITestBase : public testing::Test {
     // TODO: Print error messages in failure logs, use them to audit this list.
     // Some architectures may be unsupportable or missing key components, but
     // some may just be failing due to bugs in this testcase.
-    if (Triple.startswith("armv7") || Triple.startswith("armv8l"))
+    if (Triple.starts_with("armv7") || Triple.starts_with("armv8l"))
       return false;
     return true;
   }

diff  --git a/llvm/unittests/FileCheck/FileCheckTest.cpp b/llvm/unittests/FileCheck/FileCheckTest.cpp
index 317fc4493cb5d4..91fce69b9a6c4b 100644
--- a/llvm/unittests/FileCheck/FileCheckTest.cpp
+++ b/llvm/unittests/FileCheck/FileCheckTest.cpp
@@ -172,7 +172,7 @@ struct ExpressionFormatParameterisedFixture
   }
 
   std::string padWithLeadingZeros(StringRef NumStr) const {
-    bool Negative = NumStr.startswith("-");
+    bool Negative = NumStr.starts_with("-");
     if (NumStr.size() - unsigned(Negative) >= Precision)
       return NumStr.str();
 

diff  --git a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
index 193ada3a4ea327..e79d0bb2f65aea 100644
--- a/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
+++ b/llvm/unittests/Frontend/OpenMPIRBuilderTest.cpp
@@ -5821,7 +5821,7 @@ TEST_F(OpenMPIRBuilderTest, TargetRegion) {
   Function *KernelLaunchFunc = Call->getCalledFunction();
   EXPECT_NE(KernelLaunchFunc, nullptr);
   StringRef FunctionName = KernelLaunchFunc->getName();
-  EXPECT_TRUE(FunctionName.startswith("__tgt_target_kernel"));
+  EXPECT_TRUE(FunctionName.starts_with("__tgt_target_kernel"));
 
   // Check the fallback call
   BasicBlock *FallbackBlock = Branch->getSuccessor(0);
@@ -5838,7 +5838,7 @@ TEST_F(OpenMPIRBuilderTest, TargetRegion) {
   Function *OutlinedFunc = FCall->getCalledFunction();
   EXPECT_NE(OutlinedFunc, nullptr);
   StringRef FunctionName2 = OutlinedFunc->getName();
-  EXPECT_TRUE(FunctionName2.startswith("__omp_offloading"));
+  EXPECT_TRUE(FunctionName2.starts_with("__omp_offloading"));
 
   EXPECT_FALSE(verifyModule(*M, &errs()));
 }

diff  --git a/llvm/unittests/IR/VerifierTest.cpp b/llvm/unittests/IR/VerifierTest.cpp
index 2e14bfc42670eb..31e3b9dfab4bfd 100644
--- a/llvm/unittests/IR/VerifierTest.cpp
+++ b/llvm/unittests/IR/VerifierTest.cpp
@@ -105,8 +105,10 @@ TEST(VerifierTest, InvalidRetAttribute) {
   std::string Error;
   raw_string_ostream ErrorOS(Error);
   EXPECT_TRUE(verifyModule(M, &ErrorOS));
-  EXPECT_TRUE(StringRef(ErrorOS.str()).startswith(
-      "Attribute 'uwtable' does not apply to function return values"));
+  EXPECT_TRUE(
+      StringRef(ErrorOS.str())
+          .starts_with(
+              "Attribute 'uwtable' does not apply to function return values"));
 }
 
 /// Test the verifier rejects invalid nofpclass values that the assembler may
@@ -134,11 +136,11 @@ TEST(VerifierTest, InvalidNoFPClassAttribute) {
     StringRef ErrMsg(ErrorOS.str());
 
     if (InvalidMask == 0) {
-      EXPECT_TRUE(ErrMsg.startswith(
+      EXPECT_TRUE(ErrMsg.starts_with(
           "Attribute 'nofpclass' must have at least one test bit set"))
           << ErrMsg;
     } else {
-      EXPECT_TRUE(ErrMsg.startswith("Invalid value for 'nofpclass' test mask"))
+      EXPECT_TRUE(ErrMsg.starts_with("Invalid value for 'nofpclass' test mask"))
           << ErrMsg;
     }
   }
@@ -195,8 +197,9 @@ TEST(VerifierTest, CrossModuleRef) {
 
   Error.clear();
   EXPECT_TRUE(verifyModule(M3, &ErrorOS));
-  EXPECT_TRUE(StringRef(ErrorOS.str()).startswith(
-      "Referencing personality function in another module!"));
+  EXPECT_TRUE(
+      StringRef(ErrorOS.str())
+          .starts_with("Referencing personality function in another module!"));
 
   // Erase bad methods to avoid triggering an assertion failure on destruction
   F1->eraseFromParent();
@@ -211,9 +214,9 @@ TEST(VerifierTest, InvalidVariableLinkage) {
   std::string Error;
   raw_string_ostream ErrorOS(Error);
   EXPECT_TRUE(verifyModule(M, &ErrorOS));
-  EXPECT_TRUE(
-      StringRef(ErrorOS.str()).startswith("Global is external, but doesn't "
-                                          "have external or weak linkage!"));
+  EXPECT_TRUE(StringRef(ErrorOS.str())
+                  .starts_with("Global is external, but doesn't "
+                               "have external or weak linkage!"));
 }
 
 TEST(VerifierTest, InvalidFunctionLinkage) {
@@ -225,9 +228,9 @@ TEST(VerifierTest, InvalidFunctionLinkage) {
   std::string Error;
   raw_string_ostream ErrorOS(Error);
   EXPECT_TRUE(verifyModule(M, &ErrorOS));
-  EXPECT_TRUE(
-      StringRef(ErrorOS.str()).startswith("Global is external, but doesn't "
-                                          "have external or weak linkage!"));
+  EXPECT_TRUE(StringRef(ErrorOS.str())
+                  .starts_with("Global is external, but doesn't "
+                               "have external or weak linkage!"));
 }
 
 TEST(VerifierTest, DetectInvalidDebugInfo) {
@@ -284,8 +287,9 @@ TEST(VerifierTest, MDNodeWrongContext) {
   std::string Error;
   raw_string_ostream ErrorOS(Error);
   EXPECT_TRUE(verifyModule(M, &ErrorOS));
-  EXPECT_TRUE(StringRef(ErrorOS.str())
-                  .startswith("MDNode context does not match Module context!"));
+  EXPECT_TRUE(
+      StringRef(ErrorOS.str())
+          .starts_with("MDNode context does not match Module context!"));
 }
 
 TEST(VerifierTest, AttributesWrongContext) {

diff  --git a/llvm/unittests/Support/MemoryBufferTest.cpp b/llvm/unittests/Support/MemoryBufferTest.cpp
index bfabd734f02ef8..cfee3e477d2ede 100644
--- a/llvm/unittests/Support/MemoryBufferTest.cpp
+++ b/llvm/unittests/Support/MemoryBufferTest.cpp
@@ -432,7 +432,7 @@ TEST_F(MemoryBufferTest, mmapVolatileNoNull) {
   OwningBuffer MB = std::move(*MBOrError);
   EXPECT_EQ(MB->getBufferKind(), MemoryBuffer::MemoryBuffer_MMap);
   EXPECT_EQ(MB->getBufferSize(), std::size_t(FileWrites * 8));
-  EXPECT_TRUE(MB->getBuffer().startswith("01234567"));
+  EXPECT_TRUE(MB->getBuffer().starts_with("01234567"));
 }
 
 // Test that SmallVector without a null terminator gets one.

diff  --git a/llvm/unittests/Support/ProgramTest.cpp b/llvm/unittests/Support/ProgramTest.cpp
index ca301dc3cc9633..91dbb57fbdeca6 100644
--- a/llvm/unittests/Support/ProgramTest.cpp
+++ b/llvm/unittests/Support/ProgramTest.cpp
@@ -96,7 +96,7 @@ class ProgramEnvTest : public testing::Test {
 
     while (*EnvP != nullptr) {
       auto S = prepareEnvVar(*EnvP);
-      if (!StringRef(S).startswith("GTEST_"))
+      if (!StringRef(S).starts_with("GTEST_"))
         EnvTable.emplace_back(S);
       ++EnvP;
     }

diff  --git a/llvm/unittests/Support/TarWriterTest.cpp b/llvm/unittests/Support/TarWriterTest.cpp
index b5f072431fd15f..d640470ba63657 100644
--- a/llvm/unittests/Support/TarWriterTest.cpp
+++ b/llvm/unittests/Support/TarWriterTest.cpp
@@ -119,7 +119,7 @@ TEST_F(TarWriterTest, Pax) {
   EXPECT_EQ("", StringRef(Hdr->Name));
 
   StringRef Pax = StringRef((char *)(Buf.data() + 512), 512);
-  EXPECT_TRUE(Pax.startswith("211 path=/" + std::string(200, 'x')));
+  EXPECT_TRUE(Pax.starts_with("211 path=/" + std::string(200, 'x')));
 }
 
 TEST_F(TarWriterTest, SingleFile) {

diff  --git a/llvm/unittests/Support/TypeNameTest.cpp b/llvm/unittests/Support/TypeNameTest.cpp
index c8962933e9cee6..e0d9ac5ee7e380 100644
--- a/llvm/unittests/Support/TypeNameTest.cpp
+++ b/llvm/unittests/Support/TypeNameTest.cpp
@@ -29,11 +29,11 @@ TEST(TypeNameTest, Names) {
 
 #if defined(__clang__) || defined(__GNUC__) || defined(__INTEL_COMPILER) ||    \
     defined(_MSC_VER)
-  EXPECT_TRUE(S1Name.endswith("::N1::S1")) << S1Name.str();
-  EXPECT_TRUE(C1Name.endswith("::N1::C1")) << C1Name.str();
-  EXPECT_TRUE(U1Name.endswith("::N1::U1")) << U1Name.str();
+  EXPECT_TRUE(S1Name.ends_with("::N1::S1")) << S1Name.str();
+  EXPECT_TRUE(C1Name.ends_with("::N1::C1")) << C1Name.str();
+  EXPECT_TRUE(U1Name.ends_with("::N1::U1")) << U1Name.str();
 #ifdef __clang__
-  EXPECT_TRUE(S2Name.endswith("S2")) << S2Name.str();
+  EXPECT_TRUE(S2Name.ends_with("S2")) << S2Name.str();
 #else
   EXPECT_TRUE(S2Name.endswith("::S2")) << S2Name.str();
 #endif

diff  --git a/llvm/unittests/Support/VirtualFileSystemTest.cpp b/llvm/unittests/Support/VirtualFileSystemTest.cpp
index bd4048f025c0de..15f5204e7e8043 100644
--- a/llvm/unittests/Support/VirtualFileSystemTest.cpp
+++ b/llvm/unittests/Support/VirtualFileSystemTest.cpp
@@ -452,11 +452,11 @@ TEST(VirtualFileSystemTest, BasicRealFSIteration) {
   ASSERT_FALSE(EC);
   ASSERT_NE(vfs::directory_iterator(), I);
   // Check either a or c, since we can't rely on the iteration order.
-  EXPECT_TRUE(I->path().endswith("a") || I->path().endswith("c"));
+  EXPECT_TRUE(I->path().ends_with("a") || I->path().ends_with("c"));
   I.increment(EC);
   ASSERT_FALSE(EC);
   ASSERT_NE(vfs::directory_iterator(), I);
-  EXPECT_TRUE(I->path().endswith("a") || I->path().endswith("c"));
+  EXPECT_TRUE(I->path().ends_with("a") || I->path().ends_with("c"));
   I.increment(EC);
   EXPECT_EQ(vfs::directory_iterator(), I);
 }

diff  --git a/llvm/unittests/TargetParser/CSKYTargetParserTest.cpp b/llvm/unittests/TargetParser/CSKYTargetParserTest.cpp
index 4f0b52616b78b0..f28a2a33eb90c8 100644
--- a/llvm/unittests/TargetParser/CSKYTargetParserTest.cpp
+++ b/llvm/unittests/TargetParser/CSKYTargetParserTest.cpp
@@ -28,7 +28,7 @@ std::string FormatExtensionFlags(uint64_t Flags) {
 
   Features.erase(std::remove_if(Features.begin(), Features.end(),
                                 [](StringRef extension) {
-                                  return extension.startswith("-");
+                                  return extension.starts_with("-");
                                 }),
                  Features.end());
 

diff  --git a/llvm/unittests/TargetParser/TargetParserTest.cpp b/llvm/unittests/TargetParser/TargetParserTest.cpp
index 687b56cc5aa20b..e2b9712b511eca 100644
--- a/llvm/unittests/TargetParser/TargetParserTest.cpp
+++ b/llvm/unittests/TargetParser/TargetParserTest.cpp
@@ -55,7 +55,7 @@ std::string FormatExtensionFlags(int64_t Flags) {
   // E.g. if AEK_CRC is not set then it adds "-crc". Not useful here.
   Features.erase(std::remove_if(Features.begin(), Features.end(),
                                 [](StringRef extension) {
-                                  return extension.startswith("-");
+                                  return extension.starts_with("-");
                                 }),
                  Features.end());
 
@@ -75,7 +75,7 @@ std::string FormatExtensionFlags(AArch64::ExtensionBitset Flags) {
   // E.g. if AEK_CRC is not set then it adds "-crc". Not useful here.
   Features.erase(std::remove_if(Features.begin(), Features.end(),
                                 [](StringRef extension) {
-                                  return extension.startswith("-");
+                                  return extension.starts_with("-");
                                 }),
                  Features.end());
 

diff  --git a/llvm/unittests/Transforms/Coroutines/ExtraRematTest.cpp b/llvm/unittests/Transforms/Coroutines/ExtraRematTest.cpp
index df4d6c383abe6e..da78c151e7f68d 100644
--- a/llvm/unittests/Transforms/Coroutines/ExtraRematTest.cpp
+++ b/llvm/unittests/Transforms/Coroutines/ExtraRematTest.cpp
@@ -126,7 +126,7 @@ bool ExtraMaterializable(Instruction &I) {
 
   if (auto *CI = dyn_cast<CallInst>(&I)) {
     auto *CalledFunc = CI->getCalledFunction();
-    if (CalledFunc && CalledFunc->getName().startswith("should.remat"))
+    if (CalledFunc && CalledFunc->getName().starts_with("should.remat"))
       return true;
   }
 

diff  --git a/llvm/unittests/Transforms/Utils/CloningTest.cpp b/llvm/unittests/Transforms/Utils/CloningTest.cpp
index e083c75bf9c92d..025771f07ce5d4 100644
--- a/llvm/unittests/Transforms/Utils/CloningTest.cpp
+++ b/llvm/unittests/Transforms/Utils/CloningTest.cpp
@@ -440,11 +440,11 @@ for.end:
         EXPECT_NE(NewLoop, nullptr);
         EXPECT_EQ(NewLoop->getSubLoops().size(), 1u);
         Loop::block_iterator BI = NewLoop->block_begin();
-        EXPECT_TRUE((*BI)->getName().startswith("for.outer"));
-        EXPECT_TRUE((*(++BI))->getName().startswith("for.inner.preheader"));
-        EXPECT_TRUE((*(++BI))->getName().startswith("for.inner"));
-        EXPECT_TRUE((*(++BI))->getName().startswith("for.inner.exit"));
-        EXPECT_TRUE((*(++BI))->getName().startswith("for.outer.latch"));
+        EXPECT_TRUE((*BI)->getName().starts_with("for.outer"));
+        EXPECT_TRUE((*(++BI))->getName().starts_with("for.inner.preheader"));
+        EXPECT_TRUE((*(++BI))->getName().starts_with("for.inner"));
+        EXPECT_TRUE((*(++BI))->getName().starts_with("for.inner.exit"));
+        EXPECT_TRUE((*(++BI))->getName().starts_with("for.outer.latch"));
       });
 }
 


        


More information about the llvm-commits mailing list