[Lldb-commits] [lldb] 56ab485 - [lldb/Scripting] Simplify code by removing the #if.

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Wed Dec 18 16:48:24 PST 2019


Author: Jonas Devlieghere
Date: 2019-12-18T16:46:38-08:00
New Revision: 56ab485a311d065f9417e0cff903e1f33495f4cc

URL: https://github.com/llvm/llvm-project/commit/56ab485a311d065f9417e0cff903e1f33495f4cc
DIFF: https://github.com/llvm/llvm-project/commit/56ab485a311d065f9417e0cff903e1f33495f4cc.diff

LOG: [lldb/Scripting] Simplify code by removing the #if.

The "none" script interpreter does not depend on Python so it doesn't
make sense to have it withing the if-block. The only goal seems to be to
have a slightly different error for when there's no script interpreter,
but as per the comment this doesn't make sense for more than one
scripting language. I think the existing error is perfectly clear, so I
just removed this altogether.

Added: 
    

Modified: 
    lldb/source/Interpreter/CommandObjectScript.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Interpreter/CommandObjectScript.cpp b/lldb/source/Interpreter/CommandObjectScript.cpp
index fe365a5496f8..d61d0cac9762 100644
--- a/lldb/source/Interpreter/CommandObjectScript.cpp
+++ b/lldb/source/Interpreter/CommandObjectScript.cpp
@@ -32,7 +32,6 @@ CommandObjectScript::~CommandObjectScript() {}
 
 bool CommandObjectScript::DoExecute(llvm::StringRef command,
                                     CommandReturnObject &result) {
-#if LLDB_ENABLE_PYTHON
   if (m_interpreter.GetDebugger().GetScriptLanguage() ==
       lldb::eScriptLanguageNone) {
     result.AppendError(
@@ -49,9 +48,9 @@ bool CommandObjectScript::DoExecute(llvm::StringRef command,
     return false;
   }
 
-  DataVisualization::ForceUpdate(); // script might change Python code we use
-                                    // for formatting.. make sure we keep up to
-                                    // date with it
+  // Script might change Python code we use for formatting. Make sure we keep
+  // up to date with it.
+  DataVisualization::ForceUpdate();
 
   if (command.empty()) {
     script_interpreter->ExecuteInterpreterLoop();
@@ -66,11 +65,4 @@ bool CommandObjectScript::DoExecute(llvm::StringRef command,
     result.SetStatus(eReturnStatusFailed);
 
   return result.Succeeded();
-#else
-  // if we ever support languages other than Python this simple #ifdef won't
-  // work
-  result.AppendError("your copy of LLDB does not support scripting.");
-  result.SetStatus(eReturnStatusFailed);
-  return false;
-#endif
 }


        


More information about the lldb-commits mailing list