diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-01 00:52:28 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2010-12-01 00:52:28 +0000 |
commit | dbfb56bebdb279a2a94096a821d3b7d3345962c2 (patch) | |
tree | 15f5e5c08320b1e9e23c1dbdcb836f2b191069ad /lib/Support/PathV2.cpp | |
parent | a5a42d9b3cd4bae306c2b67ede512420f70dadb3 (diff) |
Support/PathV2: Add remove_filename implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120513 91177308-0d34-0410-b5e6-96231b3b80d8
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); +} + } } } |