[Lldb-commits] [lldb] r184212 - This patch fixes the issue where our command-line tab completer would sometimes replicate commands

Enrico Granata egranata at apple.com
Tue Jun 18 11:01:09 PDT 2013


Author: enrico
Date: Tue Jun 18 13:01:08 2013
New Revision: 184212

URL: http://llvm.org/viewvc/llvm-project?rev=184212&view=rev
Log:
This patch fixes the issue where our command-line tab completer would sometimes replicate commands
e.g.

(lldb) pl<TAB>
Available completions:
	platform
	plugin
	platform
	plugin

Thanks to Matthew Sorrels for doing work and testing on this issue

Modified:
    lldb/trunk/source/Interpreter/CommandInterpreter.cpp

Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=184212&r1=184211&r2=184212&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Tue Jun 18 13:01:08 2013
@@ -850,24 +850,29 @@ CommandInterpreter::GetCommandObject (co
 
     // If we didn't find an exact match to the command string in the commands, look in
     // the aliases.
-
-    if (command_obj == NULL)
-    {
-        command_obj = GetCommandSP (cmd_cstr, true, true, matches).get();
-    }
-
-    // If there wasn't an exact match among the aliases, look for an inexact match
-    // in just the commands.
-
-    if (command_obj == NULL)
-        command_obj = GetCommandSP(cmd_cstr, false, false, matches).get();
+    
+    if (command_obj)
+        return command_obj;
+
+    command_obj = GetCommandSP (cmd_cstr, true, true, matches).get();
+
+    if (command_obj)
+        return command_obj;
+    
+    // If there wasn't an exact match then look for an inexact one in just the commands
+    command_obj = GetCommandSP(cmd_cstr, false, false, NULL).get();
 
     // Finally, if there wasn't an inexact match among the commands, look for an inexact
     // match in both the commands and aliases.
-    if (command_obj == NULL)
-        command_obj = GetCommandSP(cmd_cstr, true, false, matches).get();
-
-    return command_obj;
+    
+    if (command_obj)
+    {
+        if (matches)
+            matches->AppendString(command_obj->GetCommandName());
+        return command_obj;
+    }
+    
+    return GetCommandSP(cmd_cstr, true, false, matches).get();
 }
 
 bool





More information about the lldb-commits mailing list