[all-commits] [llvm/llvm-project] a8b548: [Support] Add a new path style for Windows with fo...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Fri Nov 5 01:43:54 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a8b54834a186f5570b49b614e31b961a9cf1cbfe
      https://github.com/llvm/llvm-project/commit/a8b54834a186f5570b49b614e31b961a9cf1cbfe
  Author: Martin Storsjö <martin at martin.st>
  Date:   2021-11-05 (Fri, 05 Nov 2021)

  Changed paths:
    M llvm/include/llvm/Support/Path.h
    M llvm/lib/Support/Path.cpp
    M llvm/unittests/Support/Path.cpp

  Log Message:
  -----------
  [Support] Add a new path style for Windows with forward slashes

This behaves just like the regular Windows style, with both separator
forms accepted, but with get_separator() returning forward slashes.

Add a more descriptive name for the existing style, keeping the old
name around as an alias initially.

Add a new function `make_preferred()` (like the C++17
`std::filesystem::path` function with the same name), which converts
windows paths to the preferred separator form (while this one works on
any platform and takes a `path::Style` argument).

Contrary to `native()` (just like `make_preferred()` in `std::filesystem`),
this doesn't do anything at all on Posix, it doesn't try to reinterpret
backslashes into forward slashes there.

Differential Revision: https://reviews.llvm.org/D111879


  Commit: f4d83c56c99deb52769aab12bbd22b9bfeb0c617
      https://github.com/llvm/llvm-project/commit/f4d83c56c99deb52769aab12bbd22b9bfeb0c617
  Author: Martin Storsjö <martin at martin.st>
  Date:   2021-11-05 (Fri, 05 Nov 2021)

  Changed paths:
    M llvm/lib/Support/Windows/Path.inc
    M llvm/lib/Support/Windows/Process.inc
    M llvm/lib/Support/Windows/Program.inc
    M llvm/unittests/Support/CommandLineTest.cpp
    M llvm/unittests/Support/Path.cpp
    M llvm/unittests/Support/ProgramTest.cpp

  Log Message:
  -----------
  [Support] [Windows] Convert paths to the preferred form

This normalizes most paths (except ones input from the user as command
line arguments) into the preferred form, if `real_style()` evaluates to
`windows_forward`.

Differential Revision: https://reviews.llvm.org/D111880


  Commit: df0ba47c36f6bd0865e3286853b76d37e037c2d7
      https://github.com/llvm/llvm-project/commit/df0ba47c36f6bd0865e3286853b76d37e037c2d7
  Author: Martin Storsjö <martin at martin.st>
  Date:   2021-11-05 (Fri, 05 Nov 2021)

  Changed paths:
    M llvm/CMakeLists.txt
    M llvm/include/llvm/Config/config.h.cmake
    M llvm/lib/Support/Path.cpp

  Log Message:
  -----------
  [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


Compare: https://github.com/llvm/llvm-project/compare/f95bd18b5faa...df0ba47c36f6


More information about the All-commits mailing list