aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/PathV2.cpp
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-12-01 00:52:28 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-12-01 00:52:28 +0000
commitdbfb56bebdb279a2a94096a821d3b7d3345962c2 (patch)
tree15f5e5c08320b1e9e23c1dbdcb836f2b191069ad /lib/Support/PathV2.cpp
parenta5a42d9b3cd4bae306c2b67ede512420f70dadb3 (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.cpp8
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);
+}
+
}
}
}