aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Support/Path.cpp
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2021-12-07 17:22:44 -0800
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2021-12-08 16:22:37 -0800
commit7df18557791ea1cf8f4f55d97d47ff5008f3bbbb (patch)
tree04caa30a6464414424b65708a501ede77913d104 /llvm/lib/Support/Path.cpp
parent3f3faa36ff3d84af3c3ed84772d7e4278bc44ff1 (diff)
downloadllvm-7df18557791ea1cf8f4f55d97d47ff5008f3bbbb.zip
llvm-7df18557791ea1cf8f4f55d97d47ff5008f3bbbb.tar.gz
llvm-7df18557791ea1cf8f4f55d97d47ff5008f3bbbb.tar.bz2
Support: Avoid using SmallVector::set_size() in sys::path
Stop using `SmallVector::set_size()` in sys::path APIs. In both cases, use `truncate()` instead. Differential Revision: https://reviews.llvm.org/D115391
Diffstat (limited to 'llvm/lib/Support/Path.cpp')
-rw-r--r--llvm/lib/Support/Path.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp
index 3957547..7c99d08 100644
--- a/llvm/lib/Support/Path.cpp
+++ b/llvm/lib/Support/Path.cpp
@@ -474,7 +474,7 @@ StringRef parent_path(StringRef path, Style style) {
void remove_filename(SmallVectorImpl<char> &path, Style style) {
size_t end_pos = parent_path_end(StringRef(path.begin(), path.size()), style);
if (end_pos != StringRef::npos)
- path.set_size(end_pos);
+ path.truncate(end_pos);
}
void replace_extension(SmallVectorImpl<char> &path, const Twine &extension,
@@ -486,7 +486,7 @@ void replace_extension(SmallVectorImpl<char> &path, const Twine &extension,
// Erase existing extension.
size_t pos = p.find_last_of('.');
if (pos != StringRef::npos && pos >= filename_pos(p, style))
- path.set_size(pos);
+ path.truncate(pos);
// Append '.' if needed.
if (ext.size() > 0 && ext[0] != '.')