This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Use is_style_posix() for path style checks
ClosedPublic

Authored by mstorsjo on Nov 5 2021, 3:04 AM.

Details

Summary

Since a8b54834a186f5570b49b614e31b961a9cf1cbfe, there are two
distinct Windows path styles, windows_backslash (with the old
windows being an alias for it) and windows_slash.
4e4883e1f394f7c47ff3adee48039aa8374bb8d0 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
df0ba47c36f6bd0865e3286853b76d37e037c2d7.

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.

Diff Detail

Event Timeline

mstorsjo requested review of this revision.Nov 5 2021, 3:04 AM
mstorsjo created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptNov 5 2021, 3:04 AM
labath accepted this revision.Nov 5 2021, 6:53 AM
This revision is now accepted and ready to land.Nov 5 2021, 6:53 AM
This revision was automatically updated to reflect the committed changes.