summaryrefslogtreecommitdiffstats
path: root/lldb/source/Interpreter
diff options
context:
space:
mode:
authorRaphael Isemann <teemperor@gmail.com>2019-09-23 08:59:21 +0000
committerRaphael Isemann <teemperor@gmail.com>2019-09-23 08:59:21 +0000
commit93ca36d756d84310bd01c74f35dbdddf4d3035f9 (patch)
tree54693950e2913ff7350f3134d38eb90570b11ef4 /lldb/source/Interpreter
parent4ba6d0ded2303881bb09ed606970c6c910d183c1 (diff)
downloadbcm5719-llvm-93ca36d756d84310bd01c74f35dbdddf4d3035f9.tar.gz
bcm5719-llvm-93ca36d756d84310bd01c74f35dbdddf4d3035f9.zip
[lldb][NFC] Remove argument prefix checking boilerplate when adding completions
llvm-svn: 372561
Diffstat (limited to 'lldb/source/Interpreter')
-rw-r--r--lldb/source/Interpreter/OptionValueBoolean.cpp6
-rw-r--r--lldb/source/Interpreter/OptionValueEnumeration.cpp3
-rw-r--r--lldb/source/Interpreter/OptionValueUUID.cpp6
-rw-r--r--lldb/source/Interpreter/Options.cpp5
4 files changed, 5 insertions, 15 deletions
diff --git a/lldb/source/Interpreter/OptionValueBoolean.cpp b/lldb/source/Interpreter/OptionValueBoolean.cpp
index bfc7760e207..4a084156a0a 100644
--- a/lldb/source/Interpreter/OptionValueBoolean.cpp
+++ b/lldb/source/Interpreter/OptionValueBoolean.cpp
@@ -82,8 +82,6 @@ void OptionValueBoolean::AutoComplete(CommandInterpreter &interpreter,
if (request.GetCursorArgumentPrefix().empty())
entries = entries.take_front(2);
- for (auto entry : entries) {
- if (entry.startswith_lower(request.GetCursorArgumentPrefix()))
- request.AddCompletion(entry);
- }
+ for (auto entry : entries)
+ request.TryCompleteCurrentArg(entry);
}
diff --git a/lldb/source/Interpreter/OptionValueEnumeration.cpp b/lldb/source/Interpreter/OptionValueEnumeration.cpp
index 126a4f53e10..26933aa7824 100644
--- a/lldb/source/Interpreter/OptionValueEnumeration.cpp
+++ b/lldb/source/Interpreter/OptionValueEnumeration.cpp
@@ -108,8 +108,7 @@ void OptionValueEnumeration::AutoComplete(CommandInterpreter &interpreter,
if (!request.GetCursorArgumentPrefix().empty()) {
for (size_t i = 0; i < num_enumerators; ++i) {
llvm::StringRef name = m_enumerations.GetCStringAtIndex(i).GetStringRef();
- if (name.startswith(request.GetCursorArgumentPrefix()))
- request.AddCompletion(name);
+ request.TryCompleteCurrentArg(name);
}
return;
}
diff --git a/lldb/source/Interpreter/OptionValueUUID.cpp b/lldb/source/Interpreter/OptionValueUUID.cpp
index 483c47807d2..7a6bc65b25a 100644
--- a/lldb/source/Interpreter/OptionValueUUID.cpp
+++ b/lldb/source/Interpreter/OptionValueUUID.cpp
@@ -80,10 +80,6 @@ void OptionValueUUID::AutoComplete(CommandInterpreter &interpreter,
const UUID &module_uuid = module_sp->GetUUID();
if (!module_uuid.IsValid())
continue;
- llvm::ArrayRef<uint8_t> module_bytes = module_uuid.GetBytes();
- if (module_bytes.size() >= uuid_bytes.size() &&
- module_bytes.take_front(uuid_bytes.size()).equals(uuid_bytes)) {
- request.AddCompletion(module_uuid.GetAsString());
- }
+ request.TryCompleteCurrentArg(module_uuid.GetAsString());
}
}
diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp
index 09ecfed206c..1f633824a80 100644
--- a/lldb/source/Interpreter/Options.cpp
+++ b/lldb/source/Interpreter/Options.cpp
@@ -759,10 +759,7 @@ void Options::HandleOptionArgumentCompletion(
request.GetCursorCharPosition());
for (const auto &enum_value : enum_values) {
- if (strstr(enum_value.string_value, match_string.c_str()) ==
- enum_value.string_value) {
- request.AddCompletion(enum_value.string_value);
- }
+ request.TryCompleteCurrentArg(enum_value.string_value);
}
}
OpenPOWER on IntegriCloud