Skip to content

Commit 1f77059

Browse files
author
git apple-llvm automerger
committed
Merge commit 'fa39b67de01a' from llvm.org/main into next
2 parents 62eb160 + fa39b67 commit 1f77059

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

lldb/cmake/modules/LLDBConfig.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ add_optional_dependency(LLDB_ENABLE_FBSDVMCORE "Enable libfbsdvmcore support in
7878
option(LLDB_USE_ENTITLEMENTS "When codesigning, use entitlements if available" ON)
7979
option(LLDB_BUILD_FRAMEWORK "Build LLDB.framework (Darwin only)" OFF)
8080
option(LLDB_ENABLE_PROTOCOL_SERVERS "Enable protocol servers (e.g. MCP) in LLDB" ON)
81+
option(LLDB_ENABLE_PYTHON_LIMITED_API "Force LLDB to only use the Python Limited API (requires SWIG 4.2 or later)" OFF)
8182
option(LLDB_NO_INSTALL_DEFAULT_RPATH "Disable default RPATH settings in binaries" OFF)
8283
option(LLDB_USE_SYSTEM_DEBUGSERVER "Use the system's debugserver for testing (Darwin only)." OFF)
8384
option(LLDB_SKIP_STRIP "Whether to skip stripping of binaries when installing lldb." OFF)

lldb/include/lldb/Host/Config.h.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@
4545

4646
#cmakedefine01 LLDB_ENABLE_PYTHON
4747

48+
#cmakedefine01 LLDB_ENABLE_PYTHON_LIMITED_API
49+
4850
#cmakedefine01 LLDB_ENABLE_FBSDVMCORE
4951

5052
#cmakedefine01 LLDB_EMBED_PYTHON_HOME

lldb/source/Plugins/ScriptInterpreter/Python/lldb-python.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,20 @@ static llvm::Expected<bool> *g_fcxx_modules_workaround [[maybe_unused]];
4545
#include <locale>
4646
#endif
4747

48+
#define LLDB_MINIMUM_PYTHON_VERSION 0x03080000
49+
50+
#if LLDB_ENABLE_PYTHON_LIMITED_API
51+
// If defined, LLDB will be ABI-compatible with all Python 3 releases from the
52+
// specified one onward, and can use Limited API introduced up to that version.
53+
#define Py_LIMITED_API LLDB_MINIMUM_PYTHON_VERSION
54+
#endif
55+
4856
// Include python for non windows machines
4957
#include <Python.h>
5058

5159
// Provide a meaningful diagnostic error if someone tries to compile this file
5260
// with a version of Python we don't support.
53-
static_assert(PY_VERSION_HEX >= 0x03080000,
61+
static_assert(PY_VERSION_HEX >= LLDB_MINIMUM_PYTHON_VERSION,
5462
"LLDB requires at least Python 3.8");
5563
#endif
5664

0 commit comments

Comments
 (0)