[Lldb-commits] [lldb] r171810 - /lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp

Enrico Granata egranata at apple.com
Mon Jan 7 15:09:59 PST 2013


Author: enrico
Date: Mon Jan  7 17:09:58 2013
New Revision: 171810

URL: http://llvm.org/viewvc/llvm-project?rev=171810&view=rev
Log:
Make sure that the GenerateFunction call can support arbitrary levels of indentation for user code


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

Modified: lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp?rev=171810&r1=171809&r2=171810&view=diff
==============================================================================
--- lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp (original)
+++ lldb/trunk/source/Interpreter/ScriptInterpreterPython.cpp Mon Jan  7 17:09:58 2013
@@ -1609,10 +1609,11 @@
     
     // Wrap everything up inside the function, increasing the indentation.
     
+    auto_generated_function.AppendString("     if True:");
     for (int i = 0; i < num_lines; ++i)
     {
         sstr.Clear ();
-        sstr.Printf ("     %s", input.GetStringAtIndex (i));
+        sstr.Printf ("       %s", input.GetStringAtIndex (i));
         auto_generated_function.AppendString (sstr.GetData());
     }
     auto_generated_function.AppendString ("     for key in new_keys:");  // Iterate over all the keys from session dict
@@ -1702,7 +1703,8 @@
     auto_generated_class.AppendString (sstr.GetData());
         
     // Wrap everything up inside the class, increasing the indentation.
-    
+    // we don't need to play any fancy indentation tricks here because there is no
+    // surrounding code whose indentation we need to honor
     for (int i = 0; i < num_lines; ++i)
     {
         sstr.Clear ();





More information about the lldb-commits mailing list