[Lldb-commits] [lldb] 86f21e9 - [lldb] Reinstate default constructor for SBCommandInterpreter

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Sat Sep 9 20:20:12 PDT 2023


Author: Jonas Devlieghere
Date: 2023-09-09T20:20:04-07:00
New Revision: 86f21e92ab6e422edda2c7a1da11670433ad26cb

URL: https://github.com/llvm/llvm-project/commit/86f21e92ab6e422edda2c7a1da11670433ad26cb
DIFF: https://github.com/llvm/llvm-project/commit/86f21e92ab6e422edda2c7a1da11670433ad26cb.diff

LOG: [lldb] Reinstate default constructor for SBCommandInterpreter

The default constructor for SBCommandInterpreter was (unintentionally)
made protected in 27b6a4e63afe. The goal of the patch was to make the
constructor taking an lldb_private type protected, but due to the
presence of a default argument, this ctor also served as the default
constructor. The latter should remain public.

This commit reinstates the original behavior by removing the default
argument and having an explicit, public default constructor.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lldb/include/lldb/API/SBCommandInterpreter.h b/lldb/include/lldb/API/SBCommandInterpreter.h
index 3330a6f20034ca0..b7f5b3bf3396e43 100644
--- a/lldb/include/lldb/API/SBCommandInterpreter.h
+++ b/lldb/include/lldb/API/SBCommandInterpreter.h
@@ -30,6 +30,7 @@ class SBCommandInterpreter {
     eBroadcastBitAsynchronousErrorData = (1 << 4)
   };
 
+  SBCommandInterpreter();
   SBCommandInterpreter(const lldb::SBCommandInterpreter &rhs);
 
   ~SBCommandInterpreter();
@@ -317,9 +318,8 @@ class SBCommandInterpreter {
 protected:
   friend class lldb_private::CommandPluginInterfaceImplementation;
 
-  SBCommandInterpreter(
-      lldb_private::CommandInterpreter *interpreter_ptr =
-          nullptr); // Access using SBDebugger::GetCommandInterpreter();
+  /// Access using SBDebugger::GetCommandInterpreter();
+  SBCommandInterpreter(lldb_private::CommandInterpreter *interpreter_ptr);
   lldb_private::CommandInterpreter &ref();
 
   lldb_private::CommandInterpreter *get();

diff  --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp
index 396c0eef0603d3c..d275da933919e53 100644
--- a/lldb/source/API/SBCommandInterpreter.cpp
+++ b/lldb/source/API/SBCommandInterpreter.cpp
@@ -83,6 +83,10 @@ class CommandPluginInterfaceImplementation : public CommandObjectParsed {
 };
 } // namespace lldb_private
 
+SBCommandInterpreter::SBCommandInterpreter() : m_opaque_ptr() {
+  LLDB_INSTRUMENT_VA(this);
+}
+
 SBCommandInterpreter::SBCommandInterpreter(CommandInterpreter *interpreter)
     : m_opaque_ptr(interpreter) {
   LLDB_INSTRUMENT_VA(this, interpreter);


        


More information about the lldb-commits mailing list