[llvm] f7cd619 - [IR] IntrinsicInst.cpp - use StringRef::starts_with/ends_with instead of startswith/endswith. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 3 11:19:42 PDT 2023
Author: Simon Pilgrim
Date: 2023-11-03T18:19:32Z
New Revision: f7cd6194a2320429b1569172b868b21947c37efa
URL: https://github.com/llvm/llvm-project/commit/f7cd6194a2320429b1569172b868b21947c37efa
DIFF: https://github.com/llvm/llvm-project/commit/f7cd6194a2320429b1569172b868b21947c37efa.diff
LOG: [IR] IntrinsicInst.cpp - use StringRef::starts_with/ends_with instead of startswith/endswith. NFC.
startswith/endswith wrap starts_with/ends_with and will eventually go away (to more closely match string_view)
Also add missing assert message
Added:
Modified:
llvm/lib/IR/IntrinsicInst.cpp
Removed:
################################################################################
diff --git a/llvm/lib/IR/IntrinsicInst.cpp b/llvm/lib/IR/IntrinsicInst.cpp
index 20ae08dd1283000..a24ca8d100527d5 100644
--- a/llvm/lib/IR/IntrinsicInst.cpp
+++ b/llvm/lib/IR/IntrinsicInst.cpp
@@ -235,7 +235,7 @@ void DbgAssignIntrinsic::setValue(Value *V) {
int llvm::Intrinsic::lookupLLVMIntrinsicByName(ArrayRef<const char *> NameTable,
StringRef Name) {
- assert(Name.startswith("llvm."));
+ assert(Name.starts_with("llvm.") && "Unexpected intrinsic prefix");
// Do successive binary searches of the dotted name components. For
// "llvm.gc.experimental.statepoint.p1i8.p1i32", we will find the range of
@@ -265,7 +265,7 @@ int llvm::Intrinsic::lookupLLVMIntrinsicByName(ArrayRef<const char *> NameTable,
return -1;
StringRef NameFound = *LastLow;
if (Name == NameFound ||
- (Name.startswith(NameFound) && Name[NameFound.size()] == '.'))
+ (Name.starts_with(NameFound) && Name[NameFound.size()] == '.'))
return LastLow - NameTable.begin();
return -1;
}
More information about the llvm-commits
mailing list