[all-commits] [llvm/llvm-project] 4e4883: Support: Expose sys::path::is_style_{posix, windows...

Duncan P. N. Exon Smith via All-commits all-commits at lists.llvm.org
Fri Oct 29 11:47:09 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4e4883e1f394f7c47ff3adee48039aa8374bb8d0
      https://github.com/llvm/llvm-project/commit/4e4883e1f394f7c47ff3adee48039aa8374bb8d0
  Author: Duncan P. N. Exon Smith <dexonsmith at apple.com>
  Date:   2021-10-29 (Fri, 29 Oct 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: Expose sys::path::is_style_{posix,windows,native}()

Expose three helpers in namespace llvm::sys::path to detect the
path rules followed by sys::path::Style.

- is_style_posix()
- is_style_windows()
- is_style_native()

This are constexpr functions that that will allow a bunch of
path-related code to stop checking `_WIN32`.

Originally I looked at adding system_style(), analogous to
sys::endian::system_endianness(), but future patches (from others) will
add more Windows style variants for slash preferences. These helpers
should be resilient to that change, allowing callers to detect basic
path rules.

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




More information about the All-commits mailing list