[Windows] Don't try to wildcard expand paths starting with \\?\
authorMartin Storsjö <martin@martin.st>
Sat, 28 May 2022 21:44:07 +0000 (00:44 +0300)
committerMartin Storsjö <martin@martin.st>
Wed, 1 Jun 2022 08:25:49 +0000 (11:25 +0300)
commit7e2afe83e88d5d50c878492f27c69c6850e31582
tree5c884ec49b6545854c32bb32bd9f108f69357143
parent298e9cac9204b788dd6a18dba669b40acf2aaa3c
[Windows] Don't try to wildcard expand paths starting with \\?\

Paths that start with `\\?\` are absolute paths, and aren't expected
to be used with wildcard expressions.

Previously, the `?` at the start of the path triggered the condition
for a potential wildcard, which caused the path to be split and
reassembled. In builds with `LLVM_WINDOWS_PREFER_FORWARD_SLASH=ON`,
this caused a path like e.g. `\\?\D:\tmp\hello.cpp` to be reassembled
into `\\?\D:\tmp/hello.cpp` which isn't a valid path (as such
absolute paths must use backslashes consistently).

This fixes https://github.com/mstorsjo/llvm-mingw/issues/280.

I'm not sure if there's any straightforward way to add a test
for this case, unfortunately.

Differential Revision: https://reviews.llvm.org/D126675
llvm/lib/Support/Windows/Process.inc