From 90518f62d691876ab7cec19c7b14a177b9a80c64 Mon Sep 17 00:00:00 2001 From: Ruowen Qin Date: Thu, 20 Jun 2024 05:46:24 +0000 Subject: [PATCH] rename deprecated startswith() to starts_with() Signed-off-by: Ruowen Qin --- llvm/lib/Target/X86/X86IUFrameSize.cpp | 6 +++--- llvm/lib/Transforms/InnerUnikernels/IUInsertEntry.cpp | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Target/X86/X86IUFrameSize.cpp b/llvm/lib/Target/X86/X86IUFrameSize.cpp index e83d5c1de6aa71..6add64243e66b1 100644 --- a/llvm/lib/Target/X86/X86IUFrameSize.cpp +++ b/llvm/lib/Target/X86/X86IUFrameSize.cpp @@ -206,8 +206,8 @@ uint64_t X86IUFrameSizePassMF::getFrameSize(const MachineFunction &MF) { std::string Demangled; nonMicrosoftDemangle(CalledFunction->getName().data(), Demangled); // skip if the function is a core function - if (StringRef(Demangled).startswith(StringRef("setSection("obj" #ty_name); \ - assert(EntryFn->getSection().startswith(sec) && "invalid section name"); \ + assert(EntryFn->getSection().starts_with(sec) && "invalid section name"); \ break; #define IU_PROG_TYPE_2(ty_enum, ty_name, sec1, sec2) \ case ty_enum: \ ProgObj->setSection("obj" #ty_name); \ - assert((EntryFn->getSection().startswith(sec1) || \ - EntryFn->getSection().startswith(sec2)) && \ + assert((EntryFn->getSection().starts_with(sec1) || \ + EntryFn->getSection().starts_with(sec2)) && \ "invalid section name"); \ break; #include "llvm/Transforms/InnerUnikernels/IUProgType.def" @@ -165,7 +165,7 @@ bool IUEntryInsertion::runOnModule(Module &M) const { // Traverse all Global variables for (GlobalVariable &G : M.globals()) { - if (G.hasSection() && G.getSection().startswith("inner_unikernel")) { + if (G.hasSection() && G.getSection().starts_with("inner_unikernel")) { Constant *Init = G.getInitializer(); auto *CS = cast(Init); @@ -266,7 +266,7 @@ bool IUEntryInsertion::instrumentStack(Module &M, LLVMContext &C) const { for (auto &F : M) { std::string Demangled; nonMicrosoftDemangle(F.getName().data(), Demangled); - if (StringRef(Demangled).startswith(StringRef("inner_unikernel_rt::"))) + if (StringRef(Demangled).starts_with(StringRef("inner_unikernel_rt::"))) continue; for (auto &I : instructions(F)) { if (auto *CI = dyn_cast(&I)) {