From 937348cd1359b30359b958ca81b7e7d8711b443e Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Wed, 13 Jun 2018 22:08:14 +0000 Subject: [FileSpec] Make style argument mandatory for SetFile. NFC SetFile has an optional style argument which defaulted to the native style. This patch makes that argument mandatory so clients of the FileSpec class are forced to think about the correct syntax. At the same time this introduces a (protected) convenience method to update the file from within the FileSpec class that keeps the current style. These two changes together prevent a potential pitfall where the style might be forgotten, leading to the path being updated and the style unintentionally being changed to the host style. llvm-svn: 334663 --- lldb/source/Commands/CommandObjectPlatform.cpp | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'lldb/source/Commands/CommandObjectPlatform.cpp') diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp index 0c979032708..3c44e8f252f 100644 --- a/lldb/source/Commands/CommandObjectPlatform.cpp +++ b/lldb/source/Commands/CommandObjectPlatform.cpp @@ -1342,32 +1342,32 @@ protected: } break; case 'n': - match_info.GetProcessInfo().GetExecutableFile().SetFile(option_arg, - false); + match_info.GetProcessInfo().GetExecutableFile().SetFile( + option_arg, false, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::Equals); break; case 'e': - match_info.GetProcessInfo().GetExecutableFile().SetFile(option_arg, - false); + match_info.GetProcessInfo().GetExecutableFile().SetFile( + option_arg, false, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::EndsWith); break; case 's': - match_info.GetProcessInfo().GetExecutableFile().SetFile(option_arg, - false); + match_info.GetProcessInfo().GetExecutableFile().SetFile( + option_arg, false, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::StartsWith); break; case 'c': - match_info.GetProcessInfo().GetExecutableFile().SetFile(option_arg, - false); + match_info.GetProcessInfo().GetExecutableFile().SetFile( + option_arg, false, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::Contains); break; case 'r': - match_info.GetProcessInfo().GetExecutableFile().SetFile(option_arg, - false); + match_info.GetProcessInfo().GetExecutableFile().SetFile( + option_arg, false, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::RegularExpression); break; @@ -1536,7 +1536,8 @@ public: break; case 'n': - attach_info.GetExecutableFile().SetFile(option_arg, false); + attach_info.GetExecutableFile().SetFile(option_arg, false, + FileSpec::Style::native); break; case 'w': @@ -1585,7 +1586,7 @@ public: ProcessInstanceInfoMatch match_info; if (partial_name) { match_info.GetProcessInfo().GetExecutableFile().SetFile( - partial_name, false); + partial_name, false, FileSpec::Style::native); match_info.SetNameMatchType(NameMatch::StartsWith); } platform_sp->FindProcesses(match_info, process_infos); -- cgit v1.2.3