summaryrefslogtreecommitdiffstats
path: root/lldb/source/Commands/CommandObjectProcess.cpp
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2019-08-22 09:02:54 +0000
committerRaphael Isemann <teemperor@gmail.com>2019-08-22 09:02:54 +0000
commit1153dc9603c74f85314505abdae28b3f0dc85c39 (patch)
tree4f32ee69f63bdcbfb94470ae767186cdfb6de47d /lldb/source/Commands/CommandObjectProcess.cpp
parent35038c914c187484e65440d204029e716ea1eeca (diff)
downloadbcm5719-llvm-1153dc9603c74f85314505abdae28b3f0dc85c39.tar.gz
bcm5719-llvm-1153dc9603c74f85314505abdae28b3f0dc85c39.zip
[lldb][NFC] NFC cleanup for the completion code
llvm-svn: 369632
Diffstat (limited to 'lldb/source/Commands/CommandObjectProcess.cpp')
-rw-r--r--lldb/source/Commands/CommandObjectProcess.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp
index 10af1a35872..1a1378b1938 100644
--- a/lldb/source/Commands/CommandObjectProcess.cpp
+++ b/lldb/source/Commands/CommandObjectProcess.cpp
@@ -328,35 +328,35 @@ public:
// We are only completing the name option for now...
- if (GetDefinitions()[opt_defs_index].short_option == 'n') {
- // Are we in the name?
-
- // Look to see if there is a -P argument provided, and if so use that
- // plugin, otherwise use the default plugin.
-
- const char *partial_name = nullptr;
- partial_name = request.GetParsedLine().GetArgumentAtIndex(opt_arg_pos);
-
- PlatformSP platform_sp(interpreter.GetPlatform(true));
- if (platform_sp) {
- ProcessInstanceInfoList process_infos;
- ProcessInstanceInfoMatch match_info;
- if (partial_name) {
- match_info.GetProcessInfo().GetExecutableFile().SetFile(
- partial_name, FileSpec::Style::native);
- match_info.SetNameMatchType(NameMatch::StartsWith);
- }
+ // Are we in the name?
+ if (GetDefinitions()[opt_defs_index].short_option != 'n')
+ return false;
+
+ // Look to see if there is a -P argument provided, and if so use that
+ // plugin, otherwise use the default plugin.
+
+ const char *partial_name = nullptr;
+ partial_name = request.GetParsedLine().GetArgumentAtIndex(opt_arg_pos);
+
+ PlatformSP platform_sp(interpreter.GetPlatform(true));
+ if (!platform_sp)
+ return false;
+ ProcessInstanceInfoList process_infos;
+ ProcessInstanceInfoMatch match_info;
+ if (partial_name) {
+ match_info.GetProcessInfo().GetExecutableFile().SetFile(
+ partial_name, FileSpec::Style::native);
+ match_info.SetNameMatchType(NameMatch::StartsWith);
+ }
platform_sp->FindProcesses(match_info, process_infos);
const size_t num_matches = process_infos.GetSize();
- if (num_matches > 0) {
- for (size_t i = 0; i < num_matches; ++i) {
- request.AddCompletion(llvm::StringRef(
- process_infos.GetProcessNameAtIndex(i),
- process_infos.GetProcessNameLengthAtIndex(i)));
- }
+ if (num_matches == 0)
+ return false;
+ for (size_t i = 0; i < num_matches; ++i) {
+ request.AddCompletion(
+ llvm::StringRef(process_infos.GetProcessNameAtIndex(i),
+ process_infos.GetProcessNameLengthAtIndex(i)));
}
- }
- }
return false;
}
OpenPOWER on IntegriCloud