diff options
Diffstat (limited to 'lib/Support/PathV2.cpp')
-rw-r--r-- | lib/Support/PathV2.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Support/PathV2.cpp b/lib/Support/PathV2.cpp index a97f3ec711..df401bd46b 100644 --- a/lib/Support/PathV2.cpp +++ b/lib/Support/PathV2.cpp @@ -503,6 +503,14 @@ error_code parent_path(const StringRef &path, StringRef &result) { return make_error_code(errc::success); } +error_code remove_filename(SmallVectorImpl<char> &path) { + size_t end_pos = parent_path_end(StringRef(path.begin(), path.size())); + if (end_pos == StringRef::npos) + return make_error_code(errc::success); + path.set_size(end_pos); + return make_error_code(errc::success); +} + } } } |