[all-commits] [llvm/llvm-project] 8077a1: Support: Remove sys::path::is_style_native()

Duncan P. N. Exon Smith via All-commits all-commits at lists.llvm.org
Fri Oct 29 17:13:57 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8077a19f66b50573a043ef1c405e2149e0c69cb7
      https://github.com/llvm/llvm-project/commit/8077a19f66b50573a043ef1c405e2149e0c69cb7
  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/unittests/Support/Path.cpp

  Log Message:
  -----------
  Support: Remove sys::path::is_style_native()

Remove sys::path::is_style_native(), which was added alongside
is_style_windows() and is_style_posix().

Thinking a bit about the windows forward-slash style variant in
https://reviews.llvm.org/D111879, it's not clear to me how the new
sys::path::is_style_native() should behave for them.

- Should it return true for both `windows_slash` and
  `windows_backslash`?
- Should it return true for only one of them?

I can think of hypothetical uses and justifications for either one, and
I could also imagine clients guessing either behaviour when just looking
at the function name in code.

Call sites will probably be more clear if they don't use this function,
and instead write out the code:

```
// Is "S" the coarse-grained native style?
if (is_style_windows(S) == is_style_windows(Style::native))

// Is "S" the fine-grained native style?
if (is_style_windows(S) == is_style_windows(Style::native) &&
    preferred_separator(S) == preferred_separator(Style::native))
```

Can always add this again if someone needs it and can justify one
behaviour over the other, but for now might as well avoid growing users.




More information about the All-commits mailing list