Skip to content

Commit

Permalink
rename deprecated startswith() to starts_with()
Browse files Browse the repository at this point in the history
Signed-off-by: Ruowen Qin <chinqrw@gmail.com>
  • Loading branch information
chinrw committed Jun 20, 2024
1 parent 31bdea8 commit 90518f6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions llvm/lib/Target/X86/X86IUFrameSize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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("<core::")) ||
StringRef(Demangled).startswith(StringRef("core::"))) {
if (StringRef(Demangled).starts_with(StringRef("<core::")) ||
StringRef(Demangled).starts_with(StringRef("core::"))) {
AccumulatedSize += 24;
continue;
}
Expand All @@ -220,4 +220,4 @@ uint64_t X86IUFrameSizePassMF::getFrameSize(const MachineFunction &MF) {
}
}
return MaxFrameSize;
}
}
10 changes: 5 additions & 5 deletions llvm/lib/Transforms/InnerUnikernels/IUInsertEntry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ void IUEntryInsertion::validateAndFinalizeSection(Function *EntryFn,
#define IU_PROG_TYPE_1(ty_enum, ty_name, sec) \
case ty_enum: \
ProgObj->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"
Expand Down Expand Up @@ -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<ConstantStruct>(Init);

Expand Down Expand Up @@ -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<CallBase>(&I)) {
Expand Down

0 comments on commit 90518f6

Please sign in to comment.