summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix/PathV2.inc
diff options
context:
space:
mode:
authorMichael J. Spencer <bigcheesegs@gmail.com>2010-12-03 07:41:25 +0000
committerMichael J. Spencer <bigcheesegs@gmail.com>2010-12-03 07:41:25 +0000
commit7ee6d5d6a1b66fe5c53d742484f88e2626d0a0b3 (patch)
treeec4e0070731eb76dee6d9891e1085ec1fd8c0088 /llvm/lib/Support/Unix/PathV2.inc
parent515d87ff9578b544b11a3d3ce8770050536ac55f (diff)
downloadbcm5719-llvm-7ee6d5d6a1b66fe5c53d742484f88e2626d0a0b3.tar.gz
bcm5719-llvm-7ee6d5d6a1b66fe5c53d742484f88e2626d0a0b3.zip
Support/FileSystem: Add create_symlink implementation.
llvm-svn: 120800
Diffstat (limited to 'llvm/lib/Support/Unix/PathV2.inc')
-rw-r--r--llvm/lib/Support/Unix/PathV2.inc13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Support/Unix/PathV2.inc b/llvm/lib/Support/Unix/PathV2.inc
index 2bde7805f09..985dde7426a 100644
--- a/llvm/lib/Support/Unix/PathV2.inc
+++ b/llvm/lib/Support/Unix/PathV2.inc
@@ -173,6 +173,19 @@ error_code create_hard_link(const Twine &to, const Twine &from) {
return make_error_code(errc::success);
}
+error_code create_symlink(const Twine &to, const Twine &from) {
+ // Get arguments.
+ SmallString<128> from_storage;
+ SmallString<128> to_storage;
+ StringRef f = from.toNullTerminatedStringRef(from_storage);
+ StringRef t = to.toNullTerminatedStringRef(to_storage);
+
+ if (::symlink(t.begin(), f.begin()) == -1)
+ return error_code(errno, system_category());
+
+ return make_error_code(errc::success);
+}
+
error_code exists(const Twine &path, bool &result) {
SmallString<128> path_storage;
StringRef p = path.toNullTerminatedStringRef(path_storage);
OpenPOWER on IntegriCloud