From 14f6465c157b36c50ffe431463a9c94efda42b99 Mon Sep 17 00:00:00 2001 From: Raphael Isemann Date: Mon, 23 Sep 2019 09:46:17 +0000 Subject: [lldb] Make cursor index in CompletionRequest unsigned The fact that index==-1 means "no arguments" is not obvious and only used in one place from what I can tell. Also fixes several warnings about using the cursor index as if it was a size_t when comparing. Not fully NFC as we now also correctly update the partial argument list when injecting the fake empty argument in the CompletionRequest constructor. llvm-svn: 372566 --- lldb/source/Interpreter/CommandInterpreter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lldb/source/Interpreter/CommandInterpreter.cpp') diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp index c8a64b09526..cb61046e574 100644 --- a/lldb/source/Interpreter/CommandInterpreter.cpp +++ b/lldb/source/Interpreter/CommandInterpreter.cpp @@ -1756,7 +1756,7 @@ void CommandInterpreter::HandleCompletionMatches(CompletionRequest &request) { // For any of the command completions a unique match will be a complete word. - if (request.GetCursorIndex() == -1) { + if (request.GetPartialParsedLine().GetArgumentCount() == 0) { // We got nothing on the command line, so return the list of commands bool include_aliases = true; StringList new_matches, descriptions; @@ -1780,7 +1780,7 @@ void CommandInterpreter::HandleCompletionMatches(CompletionRequest &request) { new_matches.DeleteStringAtIndex(0); new_descriptions.DeleteStringAtIndex(0); request.GetParsedLine().AppendArgument(llvm::StringRef()); - request.SetCursorIndex(request.GetCursorIndex() + 1); + request.SetCursorIndex(request.GetCursorIndex() + 1U); request.SetCursorCharPosition(0); } } -- cgit v1.2.3