[llvm-dev] RFC: Support for preferring paths with forward slashes on Windows

Martin Storsjö via llvm-dev llvm-dev at lists.llvm.org
Fri Oct 15 13:52:59 PDT 2021

On Fri, 15 Oct 2021, Michael Kruse wrote:

> I also noticed is that the paths printed by clang -v or -### are
> escaping the backslashes and put them into quotes, i.e.
> "C:\\path\\to\\clang.exe" -cc1 "..\\special'^`character .c"
> Interestingly, it still works copy&pasting it to the Windows command
> line [2], but cmd.exe's escape character is ^ and PowerShell's is the
> backtick `. What would the correct output be?

I wasn't aware that cmd.exe had an escape char per se (other than ^ for 
line continuations?).

The fact that such slashes are printed double is, iirc, an intentional 
quirk, so that the command lines are copypasteable in a variety of 
contexts: cmd.exe don't need them doubled (but tolerates them), bash 
unescapes them so it also can execute them.

This is actually one downside of using forward slashes, as cmd.exe 
wouldn't be able to execute such a command straight out (only the slash 
direction of the command executable itself matters though).

// Martin

More information about the llvm-dev mailing list