mirror of
https://github.com/intel/llvm.git
synced 2026-01-13 11:02:04 +08:00
[lldb] Remove extern "C" from lldb-swig-lua interface
This is the lua equivalent of 9a14adeae0.
This commit is contained in:
@@ -4,26 +4,9 @@ template <typename T>
|
||||
void
|
||||
PushSBClass(lua_State* L, T* obj);
|
||||
|
||||
%}
|
||||
|
||||
%runtime %{
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void LLDBSwigLuaCallLuaLogOutputCallback(const char *str, void *baton);
|
||||
int LLDBSwigLuaCloseFileHandle(lua_State *L);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
%}
|
||||
|
||||
%wrapper %{
|
||||
|
||||
// This function is called from Lua::CallBreakpointCallback
|
||||
SWIGEXPORT llvm::Expected<bool>
|
||||
LLDBSwigLuaBreakpointCallbackFunction
|
||||
llvm::Expected<bool>
|
||||
lldb_private::LLDBSwigLuaBreakpointCallbackFunction
|
||||
(
|
||||
lua_State *L,
|
||||
lldb::StackFrameSP stop_frame_sp,
|
||||
@@ -67,8 +50,8 @@ LLDBSwigLuaBreakpointCallbackFunction
|
||||
}
|
||||
|
||||
// This function is called from Lua::CallWatchpointCallback
|
||||
SWIGEXPORT llvm::Expected<bool>
|
||||
LLDBSwigLuaWatchpointCallbackFunction
|
||||
llvm::Expected<bool>
|
||||
lldb_private::LLDBSwigLuaWatchpointCallbackFunction
|
||||
(
|
||||
lua_State *L,
|
||||
lldb::StackFrameSP stop_frame_sp,
|
||||
@@ -101,7 +84,7 @@ LLDBSwigLuaWatchpointCallbackFunction
|
||||
return stop;
|
||||
}
|
||||
|
||||
SWIGEXPORT void
|
||||
static void
|
||||
LLDBSwigLuaCallLuaLogOutputCallback(const char *str, void *baton) {
|
||||
lua_State *L = (lua_State *)baton;
|
||||
|
||||
@@ -113,7 +96,7 @@ LLDBSwigLuaCallLuaLogOutputCallback(const char *str, void *baton) {
|
||||
lua_pcall(L, 1, 0, 0);
|
||||
}
|
||||
|
||||
int LLDBSwigLuaCloseFileHandle(lua_State *L) {
|
||||
static int LLDBSwigLuaCloseFileHandle(lua_State *L) {
|
||||
return luaL_error(L, "You cannot close a file handle used by lldb.");
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include "llvm/Support/Error.h"
|
||||
#include "llvm/Support/FormatVariadic.h"
|
||||
#include "../bindings/lua/lua-swigsafecast.swig"
|
||||
#include "../source/Plugins/ScriptInterpreter/Lua/SWIGLuaBridge.h"
|
||||
|
||||
// required headers for typemaps
|
||||
#include "lldb/Host/File.h"
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "Lua.h"
|
||||
#include "SWIGLuaBridge.h"
|
||||
#include "lldb/Host/FileSystem.h"
|
||||
#include "lldb/Utility/FileSpec.h"
|
||||
#include "llvm/Support/Error.h"
|
||||
@@ -15,30 +16,6 @@
|
||||
using namespace lldb_private;
|
||||
using namespace lldb;
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
|
||||
|
||||
// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has
|
||||
// C-linkage specified, but returns UDT 'llvm::Expected<bool>' which is
|
||||
// incompatible with C
|
||||
#if _MSC_VER
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable : 4190)
|
||||
#endif
|
||||
|
||||
extern "C" llvm::Expected<bool> LLDBSwigLuaBreakpointCallbackFunction(
|
||||
lua_State *L, lldb::StackFrameSP stop_frame_sp,
|
||||
lldb::BreakpointLocationSP bp_loc_sp, StructuredDataImpl *extra_args_impl);
|
||||
|
||||
extern "C" llvm::Expected<bool> LLDBSwigLuaWatchpointCallbackFunction(
|
||||
lua_State *L, lldb::StackFrameSP stop_frame_sp, lldb::WatchpointSP wp_sp);
|
||||
|
||||
#if _MSC_VER
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
static int lldb_print(lua_State *L) {
|
||||
int n = lua_gettop(L);
|
||||
lua_getglobal(L, "io");
|
||||
|
||||
@@ -7,40 +7,24 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "Plugins/ScriptInterpreter/Lua/Lua.h"
|
||||
#include "Plugins/ScriptInterpreter/Lua/SWIGLuaBridge.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
using namespace lldb_private;
|
||||
|
||||
extern "C" int luaopen_lldb(lua_State *L) { return 0; }
|
||||
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
|
||||
|
||||
// Disable warning C4190: 'LLDBSwigPythonBreakpointCallbackFunction' has
|
||||
// C-linkage specified, but returns UDT 'llvm::Expected<bool>' which is
|
||||
// incompatible with C
|
||||
#if _MSC_VER
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable : 4190)
|
||||
#endif
|
||||
|
||||
extern "C" llvm::Expected<bool> LLDBSwigLuaBreakpointCallbackFunction(
|
||||
llvm::Expected<bool> lldb_private::LLDBSwigLuaBreakpointCallbackFunction(
|
||||
lua_State *L, lldb::StackFrameSP stop_frame_sp,
|
||||
lldb::BreakpointLocationSP bp_loc_sp, StructuredDataImpl *extra_args_impl) {
|
||||
return false;
|
||||
}
|
||||
|
||||
extern "C" llvm::Expected<bool> LLDBSwigLuaWatchpointCallbackFunction(
|
||||
llvm::Expected<bool> lldb_private::LLDBSwigLuaWatchpointCallbackFunction(
|
||||
lua_State *L, lldb::StackFrameSP stop_frame_sp, lldb::WatchpointSP wp_sp) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if _MSC_VER
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
TEST(LuaTest, RunValid) {
|
||||
Lua lua;
|
||||
llvm::Error error = lua.Run("foo = 1");
|
||||
|
||||
Reference in New Issue
Block a user