Skip to content

Commit 768bef0

Browse files
bulbazordmedismailben
authored andcommitted
[lldb] Fix lua build after 27b6a4e
This applies the same trick for Lua that I did for python in 27b6a4e. Differential Revision: https://reviews.llvm.org/D150624
1 parent 0c51553 commit 768bef0

File tree

8 files changed

+42
-15
lines changed

8 files changed

+42
-15
lines changed

lldb/bindings/lua/lua-wrapper.swig

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
template <typename T> void PushSBClass(lua_State * L, T * obj);
44

55
// This function is called from Lua::CallBreakpointCallback
6-
llvm::Expected<bool> lldb_private::LLDBSwigLuaBreakpointCallbackFunction(
6+
llvm::Expected<bool>
7+
lldb_private::lua::SWIGBridge::LLDBSwigLuaBreakpointCallbackFunction(
78
lua_State * L, lldb::StackFrameSP stop_frame_sp,
89
lldb::BreakpointLocationSP bp_loc_sp,
910
const StructuredDataImpl &extra_args_impl) {
@@ -41,7 +42,8 @@ llvm::Expected<bool> lldb_private::LLDBSwigLuaBreakpointCallbackFunction(
4142
}
4243

4344
// This function is called from Lua::CallWatchpointCallback
44-
llvm::Expected<bool> lldb_private::LLDBSwigLuaWatchpointCallbackFunction(
45+
llvm::Expected<bool>
46+
lldb_private::lua::SWIGBridge::LLDBSwigLuaWatchpointCallbackFunction(
4547
lua_State * L, lldb::StackFrameSP stop_frame_sp, lldb::WatchpointSP wp_sp) {
4648
lldb::SBFrame sb_frame(stop_frame_sp);
4749
lldb::SBWatchpoint sb_wp(wp_sp);

lldb/include/lldb/API/SBBreakpointLocation.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ namespace lldb_private {
1616
namespace python {
1717
class SWIGBridge;
1818
}
19+
namespace lua {
20+
class SWIGBridge;
21+
}
1922
} // namespace lldb_private
2023

2124
namespace lldb {
@@ -98,6 +101,7 @@ class LLDB_API SBBreakpointLocation {
98101

99102
protected:
100103
friend class lldb_private::python::SWIGBridge;
104+
friend class lldb_private::lua::SWIGBridge;
101105
SBBreakpointLocation(const lldb::BreakpointLocationSP &break_loc_sp);
102106

103107
private:

lldb/include/lldb/API/SBFrame.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ namespace lldb_private {
1616
namespace python {
1717
class SWIGBridge;
1818
}
19+
namespace lua {
20+
class SWIGBridge;
21+
}
1922
} // namespace lldb_private
2023

2124
namespace lldb {
@@ -202,6 +205,7 @@ class LLDB_API SBFrame {
202205
friend class SBValue;
203206

204207
friend class lldb_private::python::SWIGBridge;
208+
friend class lldb_private::lua::SWIGBridge;
205209

206210
SBFrame(const lldb::StackFrameSP &lldb_object_sp);
207211

lldb/include/lldb/API/SBStructuredData.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ namespace lldb_private {
1616
namespace python {
1717
class SWIGBridge;
1818
}
19+
namespace lua {
20+
class SWIGBridge;
21+
}
1922
} // namespace lldb_private
2023

2124
namespace lldb {
@@ -104,6 +107,7 @@ class SBStructuredData {
104107
friend class SBBreakpointName;
105108
friend class SBTrace;
106109
friend class lldb_private::python::SWIGBridge;
110+
friend class lldb_private::lua::SWIGBridge;
107111

108112
SBStructuredData(const lldb_private::StructuredDataImpl &impl);
109113

lldb/include/lldb/API/SBWatchpoint.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@
1313
#include "lldb/API/SBType.h"
1414

1515
namespace lldb_private {
16-
namespace ptyhon {
16+
namespace python {
17+
class SWIGBridge;
18+
}
19+
namespace lua {
1720
class SWIGBridge;
1821
}
1922
} // namespace lldb_private
@@ -86,6 +89,7 @@ class LLDB_API SBWatchpoint {
8689

8790
protected:
8891
friend class lldb_private::python::SWIGBridge;
92+
friend class lldb_private::lua::SWIGBridge;
8993

9094
SBWatchpoint(const lldb::WatchpointSP &wp_sp);
9195

lldb/source/Plugins/ScriptInterpreter/Lua/Lua.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ Lua::CallBreakpointCallback(void *baton, lldb::StackFrameSP stop_frame_sp,
8383
lua_pushlightuserdata(m_lua_state, baton);
8484
lua_gettable(m_lua_state, LUA_REGISTRYINDEX);
8585
StructuredDataImpl extra_args_impl(std::move(extra_args_sp));
86-
return LLDBSwigLuaBreakpointCallbackFunction(m_lua_state, stop_frame_sp,
87-
bp_loc_sp, extra_args_impl);
86+
return lua::SWIGBridge::LLDBSwigLuaBreakpointCallbackFunction(
87+
m_lua_state, stop_frame_sp, bp_loc_sp, extra_args_impl);
8888
}
8989

9090
llvm::Error Lua::RegisterWatchpointCallback(void *baton, const char *body) {
@@ -109,8 +109,8 @@ Lua::CallWatchpointCallback(void *baton, lldb::StackFrameSP stop_frame_sp,
109109

110110
lua_pushlightuserdata(m_lua_state, baton);
111111
lua_gettable(m_lua_state, LUA_REGISTRYINDEX);
112-
return LLDBSwigLuaWatchpointCallbackFunction(m_lua_state, stop_frame_sp,
113-
wp_sp);
112+
return lua::SWIGBridge::LLDBSwigLuaWatchpointCallbackFunction(
113+
m_lua_state, stop_frame_sp, wp_sp);
114114
}
115115

116116
llvm::Error Lua::CheckSyntax(llvm::StringRef buffer) {

lldb/source/Plugins/ScriptInterpreter/Lua/SWIGLuaBridge.h

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,20 @@
1515

1616
namespace lldb_private {
1717

18-
llvm::Expected<bool> LLDBSwigLuaBreakpointCallbackFunction(
19-
lua_State *L, lldb::StackFrameSP stop_frame_sp,
20-
lldb::BreakpointLocationSP bp_loc_sp,
21-
const StructuredDataImpl &extra_args_impl);
18+
namespace lua {
2219

23-
llvm::Expected<bool> LLDBSwigLuaWatchpointCallbackFunction(
24-
lua_State *L, lldb::StackFrameSP stop_frame_sp, lldb::WatchpointSP wp_sp);
20+
class SWIGBridge {
21+
public:
22+
static llvm::Expected<bool> LLDBSwigLuaBreakpointCallbackFunction(
23+
lua_State *L, lldb::StackFrameSP stop_frame_sp,
24+
lldb::BreakpointLocationSP bp_loc_sp,
25+
const StructuredDataImpl &extra_args_impl);
26+
27+
static llvm::Expected<bool> LLDBSwigLuaWatchpointCallbackFunction(
28+
lua_State *L, lldb::StackFrameSP stop_frame_sp, lldb::WatchpointSP wp_sp);
29+
};
30+
31+
} // namespace lua
2532

2633
} // namespace lldb_private
2734

lldb/unittests/ScriptInterpreter/Lua/LuaTests.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,16 @@ using namespace lldb_private;
1414

1515
extern "C" int luaopen_lldb(lua_State *L) { return 0; }
1616

17-
llvm::Expected<bool> lldb_private::LLDBSwigLuaBreakpointCallbackFunction(
17+
llvm::Expected<bool>
18+
lldb_private::lua::SWIGBridge::LLDBSwigLuaBreakpointCallbackFunction(
1819
lua_State *L, lldb::StackFrameSP stop_frame_sp,
1920
lldb::BreakpointLocationSP bp_loc_sp,
2021
const StructuredDataImpl &extra_args_impl) {
2122
return false;
2223
}
2324

24-
llvm::Expected<bool> lldb_private::LLDBSwigLuaWatchpointCallbackFunction(
25+
llvm::Expected<bool>
26+
lldb_private::lua::SWIGBridge::LLDBSwigLuaWatchpointCallbackFunction(
2527
lua_State *L, lldb::StackFrameSP stop_frame_sp, lldb::WatchpointSP wp_sp) {
2628
return false;
2729
}

0 commit comments

Comments
 (0)