diff options
author | Martin Storsjö <martin@martin.st> | 2021-10-13 12:18:32 +0000 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2021-11-05 10:42:02 +0200 |
commit | df0ba47c36f6bd0865e3286853b76d37e037c2d7 (patch) | |
tree | 167e4acbfd8bcd0756c82257d5605980481132c4 /llvm/lib/Support/Path.cpp | |
parent | f4d83c56c99deb52769aab12bbd22b9bfeb0c617 (diff) | |
download | llvm-df0ba47c36f6bd0865e3286853b76d37e037c2d7.zip llvm-df0ba47c36f6bd0865e3286853b76d37e037c2d7.tar.gz llvm-df0ba47c36f6bd0865e3286853b76d37e037c2d7.tar.bz2 |
[Support] Allow configuring the preferred type of slashes on Windows
Default to preferring forward slashes when built for MinGW, as
many usecases, when e.g. Clang is used as a drop-in replacement
for GCC, requires the compiler to output paths with forward slashes.
Not all tests pass yet, if configuring to prefer forward slashes though.
Differential Revision: https://reviews.llvm.org/D112787
Diffstat (limited to 'llvm/lib/Support/Path.cpp')
-rw-r--r-- | llvm/lib/Support/Path.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Support/Path.cpp b/llvm/lib/Support/Path.cpp index cea6df8..3957547 100644 --- a/llvm/lib/Support/Path.cpp +++ b/llvm/lib/Support/Path.cpp @@ -12,6 +12,7 @@ #include "llvm/Support/Path.h" #include "llvm/ADT/ArrayRef.h" +#include "llvm/Config/config.h" #include "llvm/Config/llvm-config.h" #include "llvm/Support/Endian.h" #include "llvm/Support/Errc.h" @@ -41,7 +42,8 @@ namespace { return style; if (is_style_posix(style)) return Style::posix; - return Style::windows; + return LLVM_WINDOWS_PREFER_FORWARD_SLASH ? Style::windows_slash + : Style::windows_backslash; } inline const char *separators(Style style) { |