summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Windows/Path.inc
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-11-13 18:23:32 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-11-13 18:23:32 +0000
commitb23f430ec9d09e9bef611a393f0aeab86b063217 (patch)
tree9a5284fec47fd118d4082b4aec714789e877b4c5 /llvm/lib/Support/Windows/Path.inc
parent7716ddf18d967018c62b2c1dd20a1efda756fed9 (diff)
downloadbcm5719-llvm-b23f430ec9d09e9bef611a393f0aeab86b063217.tar.gz
bcm5719-llvm-b23f430ec9d09e9bef611a393f0aeab86b063217.zip
[FileSystem] Add expand_tilde function
In D54435 there was some discussion about the expand_tilde flag for real_path that I wanted to expose through the VFS. The consensus is that these two things should be separate functions. Since we already have the code for this I went ahead and added a function expand_tilde that does just that. Differential revision: https://reviews.llvm.org/D54448 llvm-svn: 346776
Diffstat (limited to 'llvm/lib/Support/Windows/Path.inc')
-rw-r--r--llvm/lib/Support/Windows/Path.inc11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Support/Windows/Path.inc b/llvm/lib/Support/Windows/Path.inc
index 45d73ae3dfe..678c9a819d8 100644
--- a/llvm/lib/Support/Windows/Path.inc
+++ b/llvm/lib/Support/Windows/Path.inc
@@ -1253,6 +1253,17 @@ static void expandTildeExpr(SmallVectorImpl<char> &Path) {
Path.insert(Path.begin() + 1, HomeDir.begin() + 1, HomeDir.end());
}
+void expand_tilde(const Twine &path, SmallVectorImpl<char> &dest) {
+ dest.clear();
+ if (path.isTriviallyEmpty())
+ return;
+
+ path.toVector(dest);
+ expandTildeExpr(dest);
+
+ return;
+}
+
std::error_code real_path(const Twine &path, SmallVectorImpl<char> &dest,
bool expand_tilde) {
dest.clear();
OpenPOWER on IntegriCloud