From 8077a19f66b50573a043ef1c405e2149e0c69cb7 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Fri, 29 Oct 2021 16:50:10 -0700 Subject: [PATCH] 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. --- llvm/include/llvm/Support/Path.h | 5 ----- llvm/unittests/Support/Path.cpp | 5 ----- 2 files changed, 10 deletions(-) diff --git a/llvm/include/llvm/Support/Path.h b/llvm/include/llvm/Support/Path.h index 5a253ea1f329..eb063d071996 100644 --- a/llvm/include/llvm/Support/Path.h +++ b/llvm/include/llvm/Support/Path.h @@ -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 /// @{ diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp index 52e447fc2b32..927b7eb35e9c 100644 --- a/llvm/unittests/Support/Path.cpp +++ b/llvm/unittests/Support/Path.cpp @@ -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) {