Files
clang-p2996/lldb/source/Plugins/ScriptInterpreter/Lua/Lua.h
Jonas Devlieghere bf03e17c57 [Lldb/Lua] Generate Lua Bindings
This patch uses SWIG to generate the Lua bindings for the SB API. It
covers most of the API, but some methods require a type map similar to
Python.

Discussion on the mailing list:
http://lists.llvm.org/pipermail/lldb-dev/2019-December/015812.html

Differential revision: https://reviews.llvm.org/D71235
2019-12-21 11:28:41 -08:00

45 lines
940 B
C++

//===-- ScriptInterpreterLua.h ----------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef liblldb_Lua_h_
#define liblldb_Lua_h_
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
#include "lua.hpp"
namespace lldb_private {
extern "C" {
int luaopen_lldb(lua_State *L);
}
class Lua {
public:
Lua() : m_lua_state(luaL_newstate()) {
assert(m_lua_state);
luaL_openlibs(m_lua_state);
luaopen_lldb(m_lua_state);
}
~Lua() {
assert(m_lua_state);
luaL_openlibs(m_lua_state);
}
llvm::Error Run(llvm::StringRef buffer);
private:
lua_State *m_lua_state;
};
} // namespace lldb_private
#endif // liblldb_Lua_h_