diff options
author | Kazu Hirata <kazu@google.com> | 2024-08-27 06:46:20 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-27 06:46:20 -0700 |
commit | 71eebe9daaf5d2068606640a6040775020bc36e9 (patch) | |
tree | 1aee9b3f8b62407ee4e3b6ea09d3058fd59ea8e5 /llvm/lib/Object/COFFObjectFile.cpp | |
parent | 78505ade2c2e7d4d180e110442e0b074217877c8 (diff) | |
download | llvm-71eebe9daaf5d2068606640a6040775020bc36e9.zip llvm-71eebe9daaf5d2068606640a6040775020bc36e9.tar.gz llvm-71eebe9daaf5d2068606640a6040775020bc36e9.tar.bz2 |
[llvm] Prefer StringRef::substr to StringRef::slice (NFC) (#106190)
S.substr(N, M) is simpler than S.slice(N, N + M). Also, substr is
probably better recognizable than slice thanks to
std::string_view::substr.
Diffstat (limited to 'llvm/lib/Object/COFFObjectFile.cpp')
-rw-r--r-- | llvm/lib/Object/COFFObjectFile.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Object/COFFObjectFile.cpp b/llvm/lib/Object/COFFObjectFile.cpp index ff7129b..5fdf3ba 100644 --- a/llvm/lib/Object/COFFObjectFile.cpp +++ b/llvm/lib/Object/COFFObjectFile.cpp @@ -2369,7 +2369,7 @@ ResourceSectionRef::getContents(const coff_resource_data_entry &Entry) { Expected<StringRef> Contents = S.getContents(); if (!Contents) return Contents.takeError(); - return Contents->slice(Offset, Offset + Entry.DataSize); + return Contents->substr(Offset, Entry.DataSize); } } return createStringError(object_error::parse_failed, |