[Lldb-commits] [lldb] 96000f5 - [lldb] Simplify SBCommandInterpreter::SourceInitFileInHomeDirectory

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 9 07:18:41 PST 2022


Author: Pavel Labath
Date: 2022-02-09T16:18:27+01:00
New Revision: 96000f5c2bf99365bb45528898c864fcb1c7780b

URL: https://github.com/llvm/llvm-project/commit/96000f5c2bf99365bb45528898c864fcb1c7780b
DIFF: https://github.com/llvm/llvm-project/commit/96000f5c2bf99365bb45528898c864fcb1c7780b.diff

LOG: [lldb] Simplify SBCommandInterpreter::SourceInitFileInHomeDirectory

just have it delegate to the new overload.

Added: 
    

Modified: 
    lldb/include/lldb/Interpreter/CommandInterpreter.h
    lldb/source/API/SBCommandInterpreter.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/Interpreter/CommandInterpreter.h b/lldb/include/lldb/Interpreter/CommandInterpreter.h
index 3efb59fc05647..85eefcc899724 100644
--- a/lldb/include/lldb/Interpreter/CommandInterpreter.h
+++ b/lldb/include/lldb/Interpreter/CommandInterpreter.h
@@ -252,7 +252,7 @@ class CommandInterpreter : public Broadcaster,
   }
 
   void SourceInitFileCwd(CommandReturnObject &result);
-  void SourceInitFileHome(CommandReturnObject &result, bool is_repl = false);
+  void SourceInitFileHome(CommandReturnObject &result, bool is_repl);
 
   bool AddCommand(llvm::StringRef name, const lldb::CommandObjectSP &cmd_sp,
                   bool can_replace);

diff  --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp
index 073c1a1b042c2..4a1c3c6042c49 100644
--- a/lldb/source/API/SBCommandInterpreter.cpp
+++ b/lldb/source/API/SBCommandInterpreter.cpp
@@ -421,16 +421,7 @@ void SBCommandInterpreter::SourceInitFileInHomeDirectory(
     SBCommandReturnObject &result) {
   LLDB_INSTRUMENT_VA(this, result);
 
-  result.Clear();
-  if (IsValid()) {
-    TargetSP target_sp(m_opaque_ptr->GetDebugger().GetSelectedTarget());
-    std::unique_lock<std::recursive_mutex> lock;
-    if (target_sp)
-      lock = std::unique_lock<std::recursive_mutex>(target_sp->GetAPIMutex());
-    m_opaque_ptr->SourceInitFileHome(result.ref());
-  } else {
-    result->AppendError("SBCommandInterpreter is not valid");
-  }
+  SourceInitFileInHomeDirectory(result, /*is_repl=*/false);
 }
 
 void SBCommandInterpreter::SourceInitFileInHomeDirectory(


        


More information about the lldb-commits mailing list