Author: ted
Date: Mon Apr  6 16:55:14 2015
New Revision: 234244

URL: http://llvm.org/viewvc/llvm-project?rev=234244&view=rev
Log:
Fix check for options in "command alias"

Summary:
"command alias" can add invalid options to the command. "command alias start 
process launch -s" will add an extra argument, "<no-argument>" to the alias, so 
it runs "process launch -s <no-argument>", which launches the process with args 
that include "<no-argument>".

This patch changes the text compare of the variable value with 
"<OptionParser::eNoArgument>" to a compare of variable value_type with 
OptionParser::eNoArgument. It also moves the previous test inside the if, so it 
won't add a trailing space if there is no argument.

Reviewers: clayborg

Reviewed By: clayborg

Subscribers: lldb-commits

Differential Revision: http://reviews.llvm.org/D8844

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=234244&r1=234243&r2=234244&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original)
+++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Mon Apr  6 16:55:14 
2015
@@ -1457,10 +1457,10 @@ CommandInterpreter::BuildAliasResult (co
                 else
                 {
                     result_str.Printf (" %s", option.c_str());
-                    if (value_type != OptionParser::eOptionalArgument)
-                        result_str.Printf (" ");
-                    if (value.compare ("<OptionParser::eNoArgument>") != 0)
+                    if (value_type != OptionParser::eNoArgument)
                     {
+                        if (value_type != OptionParser::eOptionalArgument)
+                            result_str.Printf (" ");
                         int index = GetOptionArgumentPosition (value.c_str());
                         if (index == 0)
                             result_str.Printf ("%s", value.c_str());


_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to