summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2018-06-13 22:08:14 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2018-06-13 22:08:14 +0000
commit937348cd1359b30359b958ca81b7e7d8711b443e (patch)
treef4249e96df7ff194b336fdbf8cbd6c690d5a39f2 /lldb/source/Commands
parent07570f55e4ad104a474efff4ae1a3c3b49145fed (diff)
downloadbcm5719-llvm-937348cd1359b30359b958ca81b7e7d8711b443e.tar.gz
bcm5719-llvm-937348cd1359b30359b958ca81b7e7d8711b443e.zip
[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.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectMemory.cpp2
-rw-r--r--lldb/source/Commands/CommandObjectPlatform.cpp25
-rw-r--r--lldb/source/Commands/CommandObjectProcess.cpp7
-rw-r--r--lldb/source/Commands/CommandObjectTarget.cpp7
5 files changed, 23 insertions, 20 deletions
diff --git a/lldb/source/Commands/CommandObjectLog.cpp b/lldb/source/Commands/CommandObjectLog.cpp
index 8d6b1cd1854..1389ff2bde0 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 a77c41579dc..e4a49e55857 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 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);
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index 0be1dd18235..9deb2e64940 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 b383b55c1fa..feeecf5517c 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();
OpenPOWER on IntegriCloud