<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Thanks for taking care of it, I re-applied with unix-only symbolic link on r203162</div><br><div><div>On Mar 6, 2014, at 11:14 AM, Reid Kleckner <<a href="mailto:rnk@google.com">rnk@google.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Ended up reverting this in r203143.  We can't use symlinks in any meaningful way on Windows.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Mar 6, 2014 at 11:04 AM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Takumi's bots agree:<div><a href="http://bb.pgr.jp/builders/ninja-clang-i686-msc17-R/builds/7637" target="_blank">http://bb.pgr.jp/builders/ninja-clang-i686-msc17-R/builds/7637</a><br>
</div><div><br>Symlinks were added in Vista.  I don't believe LLVM has dropped support for running on XP yet, so we can't use symlinks unconditionally.  I also thought you had to have admin to create symlinks on Vista, so they're pretty hard to use anyway.</div>

<div><a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa363866(v=vs.85).aspx" target="_blank">http://msdn.microsoft.com/en-us/library/windows/desktop/aa363866(v=vs.85).aspx</a><br></div></div><div class="HOEnZb">
<div class="h5"><div class="gmail_extra"><br>
<br><div class="gmail_quote">On Thu, Mar 6, 2014 at 10:59 AM, Reid Kleckner <span dir="ltr"><<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr">The Windows implementation doesn't compile for me:<div><div>d:\src\llvm\lib\support\Windows/Path.inc(193) : error C2039: 'CreateSymbolicLinkW' : is not a member of '`global namespace''</div>


</div></div><div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Mar 6, 2014 at 9:36 AM, Argyrios Kyrtzidis <span dir="ltr"><<a href="mailto:akyrtzi@gmail.com" target="_blank">akyrtzi@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: akirtzidis<br>
Date: Thu Mar  6 11:36:46 2014<br>
New Revision: 203136<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=203136&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=203136&view=rev</a><br>
Log:<br>
[Support/FileSystem] Introduce llvm::sys::fs::create_symbolic_link().<br>
<br>
Modified:<br>
    llvm/trunk/include/llvm/Support/FileSystem.h<br>
    llvm/trunk/lib/Support/Unix/Path.inc<br>
    llvm/trunk/lib/Support/Windows/Path.inc<br>
<br>
Modified: llvm/trunk/include/llvm/Support/FileSystem.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FileSystem.h?rev=203136&r1=203135&r2=203136&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/FileSystem.h?rev=203136&r1=203135&r2=203136&view=diff</a><br>



==============================================================================<br>
--- llvm/trunk/include/llvm/Support/FileSystem.h (original)<br>
+++ llvm/trunk/include/llvm/Support/FileSystem.h Thu Mar  6 11:36:46 2014<br>
@@ -293,6 +293,14 @@ error_code create_directory(const Twine<br>
 ///          , otherwise a platform specific error_code.<br>
 error_code create_hard_link(const Twine &to, const Twine &from);<br>
<br>
+/// @brief Create a symbolic link from \a from to \a to.<br>
+///<br>
+/// @param to The path to link to.<br>
+/// @param from The path to link from. This is created.<br>
+/// @returns errc::success if successful<br>
+///          , otherwise a platform specific error_code.<br>
+error_code create_symbolic_link(const Twine &to, const Twine &from);<br>
+<br>
 /// @brief Get the current path.<br>
 ///<br>
 /// @param result Holds the current path on return.<br>
<br>
Modified: llvm/trunk/lib/Support/Unix/Path.inc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Path.inc?rev=203136&r1=203135&r2=203136&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Path.inc?rev=203136&r1=203135&r2=203136&view=diff</a><br>



==============================================================================<br>
--- llvm/trunk/lib/Support/Unix/Path.inc (original)<br>
+++ llvm/trunk/lib/Support/Unix/Path.inc Thu Mar  6 11:36:46 2014<br>
@@ -285,6 +285,19 @@ error_code create_hard_link(const Twine<br>
   return error_code::success();<br>
 }<br>
<br>
+error_code create_symbolic_link(const Twine &to, const Twine &from) {<br>
+  // Get arguments.<br>
+  SmallString<128> from_storage;<br>
+  SmallString<128> to_storage;<br>
+  StringRef f = from.toNullTerminatedStringRef(from_storage);<br>
+  StringRef t = to.toNullTerminatedStringRef(to_storage);<br>
+<br>
+  if (::symlink(t.begin(), f.begin()) == -1)<br>
+    return error_code(errno, system_category());<br>
+<br>
+  return error_code::success();<br>
+}<br>
+<br>
 error_code remove(const Twine &path, bool IgnoreNonExisting) {<br>
   SmallString<128> path_storage;<br>
   StringRef p = path.toNullTerminatedStringRef(path_storage);<br>
<br>
Modified: llvm/trunk/lib/Support/Windows/Path.inc<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Path.inc?rev=203136&r1=203135&r2=203136&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/Path.inc?rev=203136&r1=203135&r2=203136&view=diff</a><br>



==============================================================================<br>
--- llvm/trunk/lib/Support/Windows/Path.inc (original)<br>
+++ llvm/trunk/lib/Support/Windows/Path.inc Thu Mar  6 11:36:46 2014<br>
@@ -177,6 +177,25 @@ error_code create_hard_link(const Twine<br>
   return error_code::success();<br>
 }<br>
<br>
+error_code create_symbolic_link(const Twine &to, const Twine &from) {<br>
+  // Get arguments.<br>
+  SmallString<128> from_storage;<br>
+  SmallString<128> to_storage;<br>
+  StringRef f = from.toStringRef(from_storage);<br>
+  StringRef t = to.toStringRef(to_storage);<br>
+<br>
+  // Convert to utf-16.<br>
+  SmallVector<wchar_t, 128> wide_from;<br>
+  SmallVector<wchar_t, 128> wide_to;<br>
+  if (error_code ec = UTF8ToUTF16(f, wide_from)) return ec;<br>
+  if (error_code ec = UTF8ToUTF16(t, wide_to)) return ec;<br>
+<br>
+  if (!::CreateSymbolicLinkW(wide_from.begin(), wide_to.begin(), NULL))<br>
+    return windows_error(::GetLastError());<br>
+<br>
+  return error_code::success();<br>
+}<br>
+<br>
 error_code remove(const Twine &path, bool IgnoreNonExisting) {<br>
   SmallString<128> path_storage;<br>
   SmallVector<wchar_t, 128> path_utf16;<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</blockquote></div><br></body></html>