summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2014-03-06 17:36:46 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2014-03-06 17:36:46 +0000
commitec9dac2579f621b250a8596dde378c421b72f437 (patch)
tree6f2f60264747c2a4d31178a21ccd30ba637db65a /llvm/lib/Support/Unix
parentf9a995d68c5877e5e81c66b656cf8fffdccb62d6 (diff)
downloadbcm5719-llvm-ec9dac2579f621b250a8596dde378c421b72f437.tar.gz
bcm5719-llvm-ec9dac2579f621b250a8596dde378c421b72f437.zip
[Support/FileSystem] Introduce llvm::sys::fs::create_symbolic_link().
llvm-svn: 203136
Diffstat (limited to 'llvm/lib/Support/Unix')
-rw-r--r--llvm/lib/Support/Unix/Path.inc13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Support/Unix/Path.inc b/llvm/lib/Support/Unix/Path.inc
index caa30c7533a..fe3f43a6fd8 100644
--- a/llvm/lib/Support/Unix/Path.inc
+++ b/llvm/lib/Support/Unix/Path.inc
@@ -285,6 +285,19 @@ error_code create_hard_link(const Twine &to, const Twine &from) {
return error_code::success();
}
+error_code create_symbolic_link(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 error_code::success();
+}
+
error_code remove(const Twine &path, bool IgnoreNonExisting) {
SmallString<128> path_storage;
StringRef p = path.toNullTerminatedStringRef(path_storage);
OpenPOWER on IntegriCloud