diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-06-13 22:08:14 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-06-13 22:08:14 +0000 |
commit | 937348cd1359b30359b958ca81b7e7d8711b443e (patch) | |
tree | f4249e96df7ff194b336fdbf8cbd6c690d5a39f2 /lldb/source/Commands | |
parent | 07570f55e4ad104a474efff4ae1a3c3b49145fed (diff) | |
download | llvm-937348cd1359b30359b958ca81b7e7d8711b443e.zip llvm-937348cd1359b30359b958ca81b7e7d8711b443e.tar.gz llvm-937348cd1359b30359b958ca81b7e7d8711b443e.tar.bz2 |
[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
Diffstat (limited to 'lldb/source/Commands')
-rw-r--r-- | lldb/source/Commands/CommandObjectLog.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectMemory.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectPlatform.cpp | 25 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectProcess.cpp | 7 | ||||
-rw-r--r-- | lldb/source/Commands/CommandObjectTarget.cpp | 7 |
5 files changed, 23 insertions, 20 deletions
diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp index 8d6b1cd..1389ff2 100644 --- a/lldb/source/Commands/CommandObjectLog.cpp +++ b/lldb/source/Commands/CommandObjectLog.cpp @@ -101,7 +101,7 @@ public: switch (short_option) { case 'f': - log_file.SetFile(option_arg, true); + log_file.SetFile(option_arg, true, FileSpec::Style::native); break; case 't': log_options |= LLDB_LOG_OPTION_THREADSAFE; diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index a77c415..e4a49e5 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -1209,7 +1209,7 @@ public: switch (short_option) { case 'i': - m_infile.SetFile(option_value, true); + m_infile.SetFile(option_value, true, FileSpec::Style::native); if (!m_infile.Exists()) { m_infile.Clear(); error.SetErrorStringWithFormat("input file does not exist: '%s'", diff --git a/lldb/source/Commands/CommandObjectPlatform.cpp b/lldb/source/Commands/CommandObjectPlatform.cpp index 0c97903..3c44e8f 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); diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index 0be1dd1..9deb2e6 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -358,7 +358,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': @@ -411,7 +412,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); @@ -983,7 +984,7 @@ public: case 'i': do_install = true; if (!option_arg.empty()) - install_path.SetFile(option_arg, false); + install_path.SetFile(option_arg, false, FileSpec::Style::native); break; default: error.SetErrorStringWithFormat("invalid short option character '%c'", diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index b383b55..feeecf5 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -258,7 +258,7 @@ protected: FileSpec file_spec; if (file_path) - file_spec.SetFile(file_path, true); + file_spec.SetFile(file_path, true, FileSpec::Style::native); bool must_set_platform_path = false; @@ -3581,7 +3581,7 @@ public: break; case 'f': - m_file.SetFile(option_arg, false); + m_file.SetFile(option_arg, false, FileSpec::Style::native); m_type = eLookupTypeFileLine; break; @@ -4319,7 +4319,8 @@ protected: for (auto &entry : args.entries()) { if (!entry.ref.empty()) { - module_spec.GetSymbolFileSpec().SetFile(entry.ref, true); + module_spec.GetSymbolFileSpec().SetFile(entry.ref, true, + FileSpec::Style::native); if (file_option_set) { module_spec.GetFileSpec() = m_file_option.GetOptionValue().GetCurrentValue(); |