aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-08-28 01:13:46 -0700
committerGitHub <noreply@github.com>2024-08-28 01:13:46 -0700
commit22e55ba3293f72df84de509db821b4d8a2c4c55e (patch)
tree16afbe92c0c6513e07f19c767aec28bb9124ecb8 /llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
parent6332c36bc846e7cba5c8cc1f865ca506539692fc (diff)
downloadllvm-22e55ba3293f72df84de509db821b4d8a2c4c55e.zip
llvm-22e55ba3293f72df84de509db821b4d8a2c4c55e.tar.gz
llvm-22e55ba3293f72df84de509db821b4d8a2c4c55e.tar.bz2
[llvm] Prefer StringRef::substr to StringRef::slice (NFC) (#106330)
S.substr(N) is simpler than S.slice(N, StringRef::npos). Also, substr is probably better recognizable than slice thanks to std::string_view::substr.
Diffstat (limited to 'llvm/tools/llvm-objcopy/ObjcopyOptions.cpp')
-rw-r--r--llvm/tools/llvm-objcopy/ObjcopyOptions.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp b/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
index d82ecc8..26a888c 100644
--- a/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
+++ b/llvm/tools/llvm-objcopy/ObjcopyOptions.cpp
@@ -556,9 +556,9 @@ static Expected<int64_t> parseChangeSectionLMA(StringRef ArgValue,
StringRef OptionName) {
StringRef StringValue;
if (ArgValue.starts_with("*+")) {
- StringValue = ArgValue.slice(2, StringRef::npos);
+ StringValue = ArgValue.substr(2);
} else if (ArgValue.starts_with("*-")) {
- StringValue = ArgValue.slice(1, StringRef::npos);
+ StringValue = ArgValue.substr(1);
} else if (ArgValue.contains("=")) {
return createStringError(errc::invalid_argument,
"bad format for " + OptionName +
@@ -608,7 +608,7 @@ parseChangeSectionAddr(StringRef ArgValue, StringRef OptionName,
SectionPattern, SectionMatchStyle, ErrorCallback)))
return std::move(E);
- StringRef Value = ArgValue.slice(LastSymbolIndex + 1, StringRef::npos);
+ StringRef Value = ArgValue.substr(LastSymbolIndex + 1);
if (Value.empty()) {
switch (UpdateSymbol) {
case '+':