aboutsummaryrefslogtreecommitdiffstats
path: root/source/Interpreter/OptionValueUUID.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Interpreter/OptionValueUUID.cpp')
-rw-r--r--source/Interpreter/OptionValueUUID.cpp40
1 files changed, 17 insertions, 23 deletions
diff --git a/source/Interpreter/OptionValueUUID.cpp b/source/Interpreter/OptionValueUUID.cpp
index f39b66b77bb0..7a6bc65b25a4 100644
--- a/source/Interpreter/OptionValueUUID.cpp
+++ b/source/Interpreter/OptionValueUUID.cpp
@@ -62,30 +62,24 @@ lldb::OptionValueSP OptionValueUUID::DeepCopy() const {
return OptionValueSP(new OptionValueUUID(*this));
}
-size_t OptionValueUUID::AutoComplete(CommandInterpreter &interpreter,
- CompletionRequest &request) {
- request.SetWordComplete(false);
+void OptionValueUUID::AutoComplete(CommandInterpreter &interpreter,
+ CompletionRequest &request) {
ExecutionContext exe_ctx(interpreter.GetExecutionContext());
Target *target = exe_ctx.GetTargetPtr();
- if (target) {
- auto prefix = request.GetCursorArgumentPrefix();
- llvm::SmallVector<uint8_t, 20> uuid_bytes;
- if (UUID::DecodeUUIDBytesFromString(prefix, uuid_bytes).empty()) {
- const size_t num_modules = target->GetImages().GetSize();
- for (size_t i = 0; i < num_modules; ++i) {
- ModuleSP module_sp(target->GetImages().GetModuleAtIndex(i));
- if (module_sp) {
- const UUID &module_uuid = module_sp->GetUUID();
- if (module_uuid.IsValid()) {
- 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());
- }
- }
- }
- }
- }
+ if (!target)
+ return;
+ auto prefix = request.GetCursorArgumentPrefix();
+ llvm::SmallVector<uint8_t, 20> uuid_bytes;
+ if (!UUID::DecodeUUIDBytesFromString(prefix, uuid_bytes).empty())
+ return;
+ const size_t num_modules = target->GetImages().GetSize();
+ for (size_t i = 0; i < num_modules; ++i) {
+ ModuleSP module_sp(target->GetImages().GetModuleAtIndex(i));
+ if (!module_sp)
+ continue;
+ const UUID &module_uuid = module_sp->GetUUID();
+ if (!module_uuid.IsValid())
+ continue;
+ request.TryCompleteCurrentArg(module_uuid.GetAsString());
}
- return request.GetNumberOfMatches();
}