]> granicus.if.org Git - llvm/commit
Win: handle \\?\UNC\ prefix in realPathFromHandle (PR43204)
authorHans Wennborg <hans@hanshq.net>
Thu, 5 Sep 2019 09:07:05 +0000 (09:07 +0000)
committerHans Wennborg <hans@hanshq.net>
Thu, 5 Sep 2019 09:07:05 +0000 (09:07 +0000)
commit4ded9b43aa0a1970b33b08b95ab3621c575f91a7
tree5519cceb064fcfba2c1d16dec4b3442ed379115a
parentf4cf1ddf4fe1b9d12d677e80d740a2d2a84f506f
Win: handle \\?\UNC\ prefix in realPathFromHandle (PR43204)

After r361885, realPathFromHandle() ends up getting called on the working
directory on each Clang invocation. This unveiled that the code didn't work for
paths on network shares.

For example, if one maps the local dir c:\src\tmp to x:

  net use x: \\localhost\c$\tmp

and run e.g. "clang -c foo.cc" in x:\, realPathFromHandle will get
\\?\UNC\localhost\c$\src\tmp\ back from GetFinalPathNameByHandleW, and would
strip off the initial \\?\ prefix, ending up with a path that doesn't work.

This patch makes the prefix stripping a little smarter to handle this case.

Differential revision: https://reviews.llvm.org/D67166

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371035 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Support/Windows/Path.inc