[Lldb-commits] [lldb] Centralize the handling of completion for simple argument lists. (PR #82085)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Sat Feb 17 11:08:48 PST 2024


================
@@ -305,6 +305,42 @@ void CommandObject::HandleCompletion(CompletionRequest &request) {
   }
 }
 
+void
+CommandObject::HandleArgumentCompletion(CompletionRequest &request,
+                           OptionElementVector &opt_element_vector) {
+  size_t num_arg_entries = GetNumArgumentEntries();
+  if (num_arg_entries != 1)
+    return;
+
+  CommandArgumentEntry *entry_ptr = GetArgumentEntryAtIndex(0);
+  if (!entry_ptr)
+    return; // Maybe this should be an assert, this shouldn't be possible.
----------------
clayborg wrote:

assert is fine, but please leave the `if (!entry_ptr) return;` in just in case. We don't want to crash if we can help it, but the assert will let us know something is wrong during testing.

https://github.com/llvm/llvm-project/pull/82085


More information about the lldb-commits mailing list