[Lldb-commits] [lldb] r268970 - Fixed multiline expressions, and removed some dead code.

Sean Callanan via lldb-commits lldb-commits at lists.llvm.org
Mon May 9 14:13:28 PDT 2016


Author: spyffe
Date: Mon May  9 16:13:27 2016
New Revision: 268970

URL: http://llvm.org/viewvc/llvm-project?rev=268970&view=rev
Log:
Fixed multiline expressions, and removed some dead code.

IOHandlerLinesUpdated() does nothing, and IOHandlerIsInputComplete should be
implemented but isn't.  This means that multiline expressions don't work.  This
patch fixes that.  Test case to follow in the next commit.

Modified:
    lldb/trunk/source/Commands/CommandObjectExpression.cpp
    lldb/trunk/source/Commands/CommandObjectExpression.h

Modified: lldb/trunk/source/Commands/CommandObjectExpression.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.cpp?rev=268970&r1=268969&r2=268970&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.cpp Mon May  9 16:13:27 2016
@@ -451,28 +451,21 @@ CommandObjectExpression::IOHandlerInputC
         error_sp->Flush();
 }
 
-LineStatus
-CommandObjectExpression::IOHandlerLinesUpdated (IOHandler &io_handler,
-                                                StringList &lines,
-                                                uint32_t line_idx,
-                                                Error &error)
+bool
+CommandObjectExpression::IOHandlerIsInputComplete (IOHandler &io_handler,
+                                                   StringList &lines)
 {
-    if (line_idx == UINT32_MAX)
+    // An empty lines is used to indicate the end of input
+    const size_t num_lines = lines.GetSize();
+    if (num_lines > 0 && lines[num_lines - 1].empty())
     {
-        // Remove the last line from "lines" so it doesn't appear
-        // in our final expression
+        // Remove the last empty line from "lines" so it doesn't appear
+        // in our resulting input and return true to indicate we are done
+        // getting lines
         lines.PopBack();
-        error.Clear();
-        return LineStatus::Done;
+        return true;
     }
-    else if (line_idx + 1 == lines.GetSize())
-    {
-        // The last line was edited, if this line is empty, then we are done
-        // getting our multiple lines.
-        if (lines[line_idx].empty())
-            return LineStatus::Done;
-    }
-    return LineStatus::Success;
+    return false;
 }
 
 void

Modified: lldb/trunk/source/Commands/CommandObjectExpression.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectExpression.h?rev=268970&r1=268969&r2=268970&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectExpression.h (original)
+++ lldb/trunk/source/Commands/CommandObjectExpression.h Mon May  9 16:13:27 2016
@@ -82,12 +82,11 @@ protected:
     void
     IOHandlerInputComplete(IOHandler &io_handler,
 			   std::string &line) override;
-
-    virtual LineStatus
-    IOHandlerLinesUpdated (IOHandler &io_handler,
-                           StringList &lines,
-                           uint32_t line_idx,
-                           Error &error);
+    
+    bool
+    IOHandlerIsInputComplete (IOHandler &io_handler,
+                              StringList &lines) override;
+    
     bool
     DoExecute(const char *command,
 	      CommandReturnObject &result) override;




More information about the lldb-commits mailing list