[Lldb-commits] [lldb] 692ae97 - [lldb] Fix lua build after 27b6a4e63afe

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Mon May 15 17:25:28 PDT 2023


Author: Alex Langford
Date: 2023-05-15T17:24:00-07:00
New Revision: 692ae97ae71d62ce51d784681a0481fb54343fc1

URL: https://github.com/llvm/llvm-project/commit/692ae97ae71d62ce51d784681a0481fb54343fc1
DIFF: https://github.com/llvm/llvm-project/commit/692ae97ae71d62ce51d784681a0481fb54343fc1.diff

LOG: [lldb] Fix lua build after 27b6a4e63afe

This applies the same trick for Lua that I did for python in
27b6a4e63afe.

Differential Revision: https://reviews.llvm.org/D150624

Added: 
    

Modified: 
    lldb/bindings/lua/lua-wrapper.swig
    lldb/include/lldb/API/SBBreakpointLocation.h
    lldb/include/lldb/API/SBFrame.h
    lldb/include/lldb/API/SBStructuredData.h
    lldb/include/lldb/API/SBWatchpoint.h
    lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp
    lldb/source/Plugins/ScriptInterpreter/Lua/SWIGLuaBridge.h
    lldb/unittests/ScriptInterpreter/Lua/LuaTests.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/bindings/lua/lua-wrapper.swig b/lldb/bindings/lua/lua-wrapper.swig
index a36e69a6fc935..1409148873858 100644
--- a/lldb/bindings/lua/lua-wrapper.swig
+++ b/lldb/bindings/lua/lua-wrapper.swig
@@ -3,7 +3,8 @@
 template <typename T> void PushSBClass(lua_State * L, T * obj);
 
 // This function is called from Lua::CallBreakpointCallback
-llvm::Expected<bool> lldb_private::LLDBSwigLuaBreakpointCallbackFunction(
+llvm::Expected<bool>
+lldb_private::lua::SWIGBridge::LLDBSwigLuaBreakpointCallbackFunction(
     lua_State * L, lldb::StackFrameSP stop_frame_sp,
     lldb::BreakpointLocationSP bp_loc_sp,
     const StructuredDataImpl &extra_args_impl) {
@@ -41,7 +42,8 @@ llvm::Expected<bool> lldb_private::LLDBSwigLuaBreakpointCallbackFunction(
 }
 
 // This function is called from Lua::CallWatchpointCallback
-llvm::Expected<bool> lldb_private::LLDBSwigLuaWatchpointCallbackFunction(
+llvm::Expected<bool>
+lldb_private::lua::SWIGBridge::LLDBSwigLuaWatchpointCallbackFunction(
     lua_State * L, lldb::StackFrameSP stop_frame_sp, lldb::WatchpointSP wp_sp) {
   lldb::SBFrame sb_frame(stop_frame_sp);
   lldb::SBWatchpoint sb_wp(wp_sp);

diff  --git a/lldb/include/lldb/API/SBBreakpointLocation.h b/lldb/include/lldb/API/SBBreakpointLocation.h
index bc06aeeb6f1c2..fa823e2b518ac 100644
--- a/lldb/include/lldb/API/SBBreakpointLocation.h
+++ b/lldb/include/lldb/API/SBBreakpointLocation.h
@@ -16,6 +16,9 @@ namespace lldb_private {
 namespace python {
 class SWIGBridge;
 }
+namespace lua {
+class SWIGBridge;
+}
 } // namespace lldb_private
 
 namespace lldb {
@@ -98,6 +101,7 @@ class LLDB_API SBBreakpointLocation {
 
 protected:
   friend class lldb_private::python::SWIGBridge;
+  friend class lldb_private::lua::SWIGBridge;
   SBBreakpointLocation(const lldb::BreakpointLocationSP &break_loc_sp);
 
 private:

diff  --git a/lldb/include/lldb/API/SBFrame.h b/lldb/include/lldb/API/SBFrame.h
index 8fc4d510be4a7..7c4477f9125d1 100644
--- a/lldb/include/lldb/API/SBFrame.h
+++ b/lldb/include/lldb/API/SBFrame.h
@@ -16,6 +16,9 @@ namespace lldb_private {
 namespace python {
 class SWIGBridge;
 }
+namespace lua {
+class SWIGBridge;
+}
 } // namespace lldb_private
 
 namespace lldb {
@@ -198,6 +201,7 @@ class LLDB_API SBFrame {
   friend class SBValue;
 
   friend class lldb_private::python::SWIGBridge;
+  friend class lldb_private::lua::SWIGBridge;
 
   SBFrame(const lldb::StackFrameSP &lldb_object_sp);
 

diff  --git a/lldb/include/lldb/API/SBStructuredData.h b/lldb/include/lldb/API/SBStructuredData.h
index 3021069793bd1..75f8ebb7c9e75 100644
--- a/lldb/include/lldb/API/SBStructuredData.h
+++ b/lldb/include/lldb/API/SBStructuredData.h
@@ -16,6 +16,9 @@ namespace lldb_private {
 namespace python {
 class SWIGBridge;
 }
+namespace lua {
+class SWIGBridge;
+}
 } // namespace lldb_private
 
 namespace lldb {
@@ -104,6 +107,7 @@ class SBStructuredData {
   friend class SBBreakpointName;
   friend class SBTrace;
   friend class lldb_private::python::SWIGBridge;
+  friend class lldb_private::lua::SWIGBridge;
 
   SBStructuredData(const lldb_private::StructuredDataImpl &impl);
 

diff  --git a/lldb/include/lldb/API/SBWatchpoint.h b/lldb/include/lldb/API/SBWatchpoint.h
index de8e87f3a7322..dc613a840beb2 100644
--- a/lldb/include/lldb/API/SBWatchpoint.h
+++ b/lldb/include/lldb/API/SBWatchpoint.h
@@ -13,7 +13,10 @@
 #include "lldb/API/SBType.h"
 
 namespace lldb_private {
-namespace ptyhon {
+namespace python {
+class SWIGBridge;
+}
+namespace lua {
 class SWIGBridge;
 }
 } // namespace lldb_private
@@ -86,6 +89,7 @@ class LLDB_API SBWatchpoint {
 
 protected:
   friend class lldb_private::python::SWIGBridge;
+  friend class lldb_private::lua::SWIGBridge;
 
   SBWatchpoint(const lldb::WatchpointSP &wp_sp);
 

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp b/lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp
index 9c2227cc3884e..8dad22d077be3 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp
@@ -83,8 +83,8 @@ Lua::CallBreakpointCallback(void *baton, lldb::StackFrameSP stop_frame_sp,
   lua_pushlightuserdata(m_lua_state, baton);
   lua_gettable(m_lua_state, LUA_REGISTRYINDEX);
   StructuredDataImpl extra_args_impl(std::move(extra_args_sp));
-  return LLDBSwigLuaBreakpointCallbackFunction(m_lua_state, stop_frame_sp,
-                                               bp_loc_sp, extra_args_impl);
+  return lua::SWIGBridge::LLDBSwigLuaBreakpointCallbackFunction(
+      m_lua_state, stop_frame_sp, bp_loc_sp, extra_args_impl);
 }
 
 llvm::Error Lua::RegisterWatchpointCallback(void *baton, const char *body) {
@@ -109,8 +109,8 @@ Lua::CallWatchpointCallback(void *baton, lldb::StackFrameSP stop_frame_sp,
 
   lua_pushlightuserdata(m_lua_state, baton);
   lua_gettable(m_lua_state, LUA_REGISTRYINDEX);
-  return LLDBSwigLuaWatchpointCallbackFunction(m_lua_state, stop_frame_sp,
-                                               wp_sp);
+  return lua::SWIGBridge::LLDBSwigLuaWatchpointCallbackFunction(
+      m_lua_state, stop_frame_sp, wp_sp);
 }
 
 llvm::Error Lua::CheckSyntax(llvm::StringRef buffer) {

diff  --git a/lldb/source/Plugins/ScriptInterpreter/Lua/SWIGLuaBridge.h b/lldb/source/Plugins/ScriptInterpreter/Lua/SWIGLuaBridge.h
index 5fca18f2dd6d5..27263c3b634b6 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Lua/SWIGLuaBridge.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Lua/SWIGLuaBridge.h
@@ -15,13 +15,20 @@
 
 namespace lldb_private {
 
-llvm::Expected<bool> LLDBSwigLuaBreakpointCallbackFunction(
-    lua_State *L, lldb::StackFrameSP stop_frame_sp,
-    lldb::BreakpointLocationSP bp_loc_sp,
-    const StructuredDataImpl &extra_args_impl);
+namespace lua {
 
-llvm::Expected<bool> LLDBSwigLuaWatchpointCallbackFunction(
-    lua_State *L, lldb::StackFrameSP stop_frame_sp, lldb::WatchpointSP wp_sp);
+class SWIGBridge {
+public:
+  static llvm::Expected<bool> LLDBSwigLuaBreakpointCallbackFunction(
+      lua_State *L, lldb::StackFrameSP stop_frame_sp,
+      lldb::BreakpointLocationSP bp_loc_sp,
+      const StructuredDataImpl &extra_args_impl);
+
+  static llvm::Expected<bool> LLDBSwigLuaWatchpointCallbackFunction(
+      lua_State *L, lldb::StackFrameSP stop_frame_sp, lldb::WatchpointSP wp_sp);
+};
+
+} // namespace lua
 
 } // namespace lldb_private
 

diff  --git a/lldb/unittests/ScriptInterpreter/Lua/LuaTests.cpp b/lldb/unittests/ScriptInterpreter/Lua/LuaTests.cpp
index 5e9fca597465f..3b5836cfa8033 100644
--- a/lldb/unittests/ScriptInterpreter/Lua/LuaTests.cpp
+++ b/lldb/unittests/ScriptInterpreter/Lua/LuaTests.cpp
@@ -14,14 +14,16 @@ using namespace lldb_private;
 
 extern "C" int luaopen_lldb(lua_State *L) { return 0; }
 
-llvm::Expected<bool> lldb_private::LLDBSwigLuaBreakpointCallbackFunction(
+llvm::Expected<bool>
+lldb_private::lua::SWIGBridge::LLDBSwigLuaBreakpointCallbackFunction(
     lua_State *L, lldb::StackFrameSP stop_frame_sp,
     lldb::BreakpointLocationSP bp_loc_sp,
     const StructuredDataImpl &extra_args_impl) {
   return false;
 }
 
-llvm::Expected<bool> lldb_private::LLDBSwigLuaWatchpointCallbackFunction(
+llvm::Expected<bool>
+lldb_private::lua::SWIGBridge::LLDBSwigLuaWatchpointCallbackFunction(
     lua_State *L, lldb::StackFrameSP stop_frame_sp, lldb::WatchpointSP wp_sp) {
   return false;
 }


        


More information about the lldb-commits mailing list