diff --git a/lldb/bindings/lua/lua-wrapper.swig b/lldb/bindings/lua/lua-wrapper.swig --- a/lldb/bindings/lua/lua-wrapper.swig +++ b/lldb/bindings/lua/lua-wrapper.swig @@ -3,7 +3,8 @@ template void PushSBClass(lua_State * L, T * obj); // This function is called from Lua::CallBreakpointCallback -llvm::Expected lldb_private::LLDBSwigLuaBreakpointCallbackFunction( +llvm::Expected +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 @@ } // This function is called from Lua::CallWatchpointCallback -llvm::Expected lldb_private::LLDBSwigLuaWatchpointCallbackFunction( +llvm::Expected +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 --- a/lldb/include/lldb/API/SBBreakpointLocation.h +++ b/lldb/include/lldb/API/SBBreakpointLocation.h @@ -16,6 +16,9 @@ namespace python { class SWIGBridge; } +namespace lua { +class SWIGBridge; +} } // namespace lldb_private namespace lldb { @@ -98,6 +101,7 @@ 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 --- a/lldb/include/lldb/API/SBFrame.h +++ b/lldb/include/lldb/API/SBFrame.h @@ -16,6 +16,9 @@ namespace python { class SWIGBridge; } +namespace lua { +class SWIGBridge; +} } // namespace lldb_private namespace lldb { @@ -198,6 +201,7 @@ 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 --- a/lldb/include/lldb/API/SBStructuredData.h +++ b/lldb/include/lldb/API/SBStructuredData.h @@ -16,6 +16,9 @@ namespace python { class SWIGBridge; } +namespace lua { +class SWIGBridge; +} } // namespace lldb_private namespace lldb { @@ -104,6 +107,7 @@ 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 --- 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 @@ 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 --- a/lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp @@ -83,8 +83,8 @@ 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_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 --- 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 LLDBSwigLuaBreakpointCallbackFunction( - lua_State *L, lldb::StackFrameSP stop_frame_sp, - lldb::BreakpointLocationSP bp_loc_sp, - const StructuredDataImpl &extra_args_impl); +namespace lua { -llvm::Expected LLDBSwigLuaWatchpointCallbackFunction( - lua_State *L, lldb::StackFrameSP stop_frame_sp, lldb::WatchpointSP wp_sp); +class SWIGBridge { +public: + static llvm::Expected LLDBSwigLuaBreakpointCallbackFunction( + lua_State *L, lldb::StackFrameSP stop_frame_sp, + lldb::BreakpointLocationSP bp_loc_sp, + const StructuredDataImpl &extra_args_impl); + + static llvm::Expected 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 --- a/lldb/unittests/ScriptInterpreter/Lua/LuaTests.cpp +++ b/lldb/unittests/ScriptInterpreter/Lua/LuaTests.cpp @@ -14,14 +14,16 @@ extern "C" int luaopen_lldb(lua_State *L) { return 0; } -llvm::Expected lldb_private::LLDBSwigLuaBreakpointCallbackFunction( +llvm::Expected +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 lldb_private::LLDBSwigLuaWatchpointCallbackFunction( +llvm::Expected +lldb_private::lua::SWIGBridge::LLDBSwigLuaWatchpointCallbackFunction( lua_State *L, lldb::StackFrameSP stop_frame_sp, lldb::WatchpointSP wp_sp) { return false; }