Skip to content

Commit 6498aff

Browse files
committed
[lldb/Bindings] Move bindings into their own subdirectory
All the code required to generate the language bindings for Python and Lua lives under scripts, even though the majority of this code aren't scripts at all, and surrounded by scripts that are totally unrelated. I've reorganized these files and moved everything related to the language bindings into a new top-level directory named bindings. This makes the corresponding files self contained and much more discoverable. Differential revision: https://reviews.llvm.org/D72437
1 parent 241f335 commit 6498aff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+17
-18
lines changed

lldb/CMakeLists.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ if (LLDB_ENABLE_PYTHON)
5656
endif ()
5757

5858
if (LLDB_ENABLE_PYTHON OR LLDB_ENABLE_LUA)
59-
add_subdirectory(scripts)
59+
add_subdirectory(bindings)
6060
endif ()
6161

6262
# We need the headers generated by instrinsics_gen before we can compile
@@ -97,7 +97,7 @@ if(LLDB_INCLUDE_TESTS)
9797
endif()
9898

9999
if (LLDB_ENABLE_PYTHON)
100-
get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
100+
get_target_property(lldb_bindings_dir swig_wrapper BINARY_DIR)
101101

102102
if(LLDB_BUILD_FRAMEWORK)
103103
set(lldb_python_build_path "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Resources/Python/lldb")
@@ -109,7 +109,7 @@ if (LLDB_ENABLE_PYTHON)
109109
# to liblldb.so for the Python API(hardlink on Windows).
110110
add_custom_target(finish_swig ALL VERBATIM
111111
COMMAND ${CMAKE_COMMAND} -E make_directory ${lldb_python_build_path}
112-
DEPENDS ${lldb_scripts_dir}/lldb.py
112+
DEPENDS ${lldb_bindings_dir}/lldb.py
113113
COMMENT "Python script sym-linking LLDB Python API")
114114

115115
if(NOT LLDB_USE_SYSTEM_SIX)
@@ -121,7 +121,7 @@ if (LLDB_ENABLE_PYTHON)
121121

122122
add_custom_command(TARGET finish_swig POST_BUILD VERBATIM
123123
COMMAND ${CMAKE_COMMAND} -E copy
124-
"${lldb_scripts_dir}/lldb.py"
124+
"${lldb_bindings_dir}/lldb.py"
125125
"${lldb_python_build_path}/__init__.py")
126126

127127
function(create_python_package pkg_dir)
@@ -131,7 +131,7 @@ if (LLDB_ENABLE_PYTHON)
131131
endif()
132132
if(NOT ARG_NOINIT)
133133
set(init_cmd COMMAND ${PYTHON_EXECUTABLE}
134-
"${LLDB_SOURCE_DIR}/scripts/Python/createPythonInit.py"
134+
"${LLDB_SOURCE_DIR}/bindings/python/createPythonInit.py"
135135
"${pkg_dir}" ${ARG_FILES})
136136
endif()
137137
add_custom_command(TARGET finish_swig POST_BUILD VERBATIM

lldb/scripts/CMakeLists.txt renamed to lldb/bindings/CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
file(GLOB SWIG_INTERFACES interface/*.i)
1+
file(GLOB SWIG_INTERFACES interfaces/*.i)
22
file(GLOB_RECURSE SWIG_SOURCES *.swig)
33
file(GLOB SWIG_HEADERS
44
${LLDB_SOURCE_DIR}/include/lldb/API/*.h
@@ -46,7 +46,7 @@ if (LLDB_ENABLE_PYTHON)
4646
-python
4747
-threads
4848
-o ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapPython.cpp
49-
${LLDB_SOURCE_DIR}/scripts/lldb.swig
49+
${LLDB_SOURCE_DIR}/bindings/python.swig
5050
VERBATIM
5151
COMMENT "Builds LLDB Python wrapper")
5252

@@ -67,7 +67,7 @@ if (LLDB_ENABLE_LUA)
6767
-lua
6868
-w503
6969
-o ${CMAKE_CURRENT_BINARY_DIR}/LLDBWrapLua.cpp
70-
${LLDB_SOURCE_DIR}/scripts/lldb_lua.swig
70+
${LLDB_SOURCE_DIR}/bindings/lua.swig
7171
VERBATIM
7272
COMMENT "Builds LLDB Lua wrapper")
7373

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

lldb/scripts/interfaces.swig renamed to lldb/bindings/interfaces.swig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@
3232
%include "./interface/SBEvent.i"
3333
%include "./interface/SBExecutionContext.i"
3434
%include "./interface/SBExpressionOptions.i"
35-
%include "./interface/SBFileSpec.i"
3635
%include "./interface/SBFile.i"
36+
%include "./interface/SBFileSpec.i"
3737
%include "./interface/SBFileSpecList.i"
3838
%include "./interface/SBFrame.i"
3939
%include "./interface/SBFunction.i"
@@ -75,9 +75,8 @@
7575
%include "./interface/SBTypeNameSpecifier.i"
7676
%include "./interface/SBTypeSummary.i"
7777
%include "./interface/SBTypeSynthetic.i"
78+
%include "./interface/SBUnixSignals.i"
7879
%include "./interface/SBValue.i"
7980
%include "./interface/SBValueList.i"
8081
%include "./interface/SBVariablesOptions.i"
8182
%include "./interface/SBWatchpoint.i"
82-
%include "./interface/SBUnixSignals.i"
83-
File renamed without changes.
File renamed without changes.

lldb/scripts/lldb.swig renamed to lldb/bindings/python.swig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def lldb_iter(obj, getsize, getelem):
117117

118118
%{
119119
#include "../source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h"
120-
#include "../scripts/Python/python-swigsafecast.swig"
120+
#include "../bindings/python/python-swigsafecast.swig"
121121
using namespace lldb_private;
122122
using namespace lldb_private::python;
123123
using namespace lldb;

lldb/docs/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ if (LLDB_ENABLE_PYTHON)
3030
# Because we don't build liblldb, epydoc will complain that the import of
3131
# _lldb.so failed, but that doesn't prevent it from generating the docs.
3232
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lldb)
33-
get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
33+
get_target_property(lldb_bindings_dir swig_wrapper BINARY_DIR)
3434
add_custom_target(lldb-python-doc-package
35-
COMMAND "${CMAKE_COMMAND}" -E copy "${lldb_scripts_dir}/lldb.py" "${CMAKE_CURRENT_BINARY_DIR}/lldb/__init__.py"
35+
COMMAND "${CMAKE_COMMAND}" -E copy "${lldb_bindings_dir}/lldb.py" "${CMAKE_CURRENT_BINARY_DIR}/lldb/__init__.py"
3636
COMMENT "Copying lldb.py to pretend package.")
3737
add_dependencies(lldb-python-doc-package swig_wrapper)
3838

lldb/source/API/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ endif()
55
get_property(LLDB_ALL_PLUGINS GLOBAL PROPERTY LLDB_PLUGINS)
66

77
if(LLDB_ENABLE_PYTHON)
8-
get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
9-
set(lldb_python_wrapper ${lldb_scripts_dir}/LLDBWrapPython.cpp)
8+
get_target_property(lldb_bindings_dir swig_wrapper BINARY_DIR)
9+
set(lldb_python_wrapper ${lldb_bindings_dir}/LLDBWrapPython.cpp)
1010
endif()
1111

1212
if(LLDB_ENABLE_LUA)
13-
get_target_property(lldb_scripts_dir swig_wrapper_lua BINARY_DIR)
14-
set(lldb_lua_wrapper ${lldb_scripts_dir}/LLDBWrapLua.cpp)
13+
get_target_property(lldb_bindings_dir swig_wrapper_lua BINARY_DIR)
14+
set(lldb_lua_wrapper ${lldb_bindings_dir}/LLDBWrapLua.cpp)
1515
endif()
1616

1717
if(LLDB_BUILD_FRAMEWORK)

0 commit comments

Comments
 (0)