forked from OSchip/llvm-project
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.
This commit is contained in:
parent
0d5b6423ba
commit
8077a19f66
|
@ -43,11 +43,6 @@ constexpr bool is_style_posix(Style S) {
|
|||
/// Check if \p S uses Windows path rules.
|
||||
constexpr bool is_style_windows(Style S) { return !is_style_posix(S); }
|
||||
|
||||
/// Check if \p S uses the same path rules as Style::native.
|
||||
constexpr bool is_style_native(Style S) {
|
||||
return is_style_posix(S) == is_style_posix(Style::native);
|
||||
}
|
||||
|
||||
/// @name Lexical Component Iterator
|
||||
/// @{
|
||||
|
||||
|
|
|
@ -86,11 +86,6 @@ TEST(is_style_Style, Works) {
|
|||
EXPECT_TRUE(is_style_posix(Style::native));
|
||||
EXPECT_FALSE(is_style_windows(Style::native));
|
||||
#endif
|
||||
|
||||
// Check is_style_native().
|
||||
EXPECT_TRUE(is_style_native(Style::native));
|
||||
EXPECT_EQ(is_style_posix(Style::native), is_style_native(Style::posix));
|
||||
EXPECT_EQ(is_style_windows(Style::native), is_style_native(Style::windows));
|
||||
}
|
||||
|
||||
TEST(is_separator, Works) {
|
||||
|
|
Loading…
Reference in New Issue