Skip to content

Commit a2c9cf4

Browse files
committed
[lldb] Use is_style_posix() for path style checks
Since a8b5483, there are two distinct Windows path styles, `windows_backslash` (with the old `windows` being an alias for it) and `windows_slash`. 4e4883e added helpers for inspecting path styles. The newly added windows_slash path style doesn't end up used in LLDB yet anyway, as LLDB is quite decoupled from most of llvm::sys::path and uses its own FileSpec class. To take it in use, it could be hooked up in `FileSpec::Style::GetNativeStyle` (in lldb/source/Utility/FileSpec.cpp) just like in the `real_style` function in llvm/lib/Support/Path.cpp in df0ba47. It is not currently clear whether there's a real need for using the Windows path style with forward slashes in LLDB (if there's any other applications interacting with it, expecting that style), and what other changes in LLDB are needed for that to work, but this at least makes some of the checks more ready for the new style, simplifying code a bit. Differential Revision: https://reviews.llvm.org/D113255
1 parent f095592 commit a2c9cf4

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

lldb/include/lldb/Utility/FileSpec.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class FileSpec {
202202
/// \return
203203
/// \b true if the file path is case sensitive (POSIX), false
204204
/// if case insensitive (Windows).
205-
bool IsCaseSensitive() const { return m_style != Style::windows; }
205+
bool IsCaseSensitive() const { return is_style_posix(m_style); }
206206

207207
/// Dump this object to a Stream.
208208
///

lldb/source/Utility/FileSpec.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ static constexpr FileSpec::Style GetNativeStyle() {
4343
}
4444

4545
bool PathStyleIsPosix(FileSpec::Style style) {
46-
return (style == FileSpec::Style::posix ||
47-
(style == FileSpec::Style::native &&
48-
GetNativeStyle() == FileSpec::Style::posix));
46+
return llvm::sys::path::is_style_posix(style);
4947
}
5048

5149
const char *GetPathSeparators(FileSpec::Style style) {

0 commit comments

Comments
 (0)