LLDB mainline
lldb-python.h
Go to the documentation of this file.
1//===-- lldb-python.h -------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_SOURCE_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
10#define LLDB_SOURCE_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
11
12// BEGIN FIXME
13// This declaration works around a clang module build failure.
14// It should be deleted ASAP.
15#include "llvm/Support/Error.h"
16static llvm::Expected<bool> *g_fcxx_modules_workaround [[maybe_unused]];
17// END
18
19#include "llvm/Support/Compiler.h"
20#if defined(__linux__)
21// features.h will define _POSIX_C_SOURCE if _GNU_SOURCE is defined. This value
22// may be different from the value that Python defines it to be which results
23// in a warning. Undefine _POSIX_C_SOURCE before including Python.h The same
24// holds for _XOPEN_SOURCE.
25#undef _POSIX_C_SOURCE
26#undef _XOPEN_SOURCE
27#endif
28
29// Include locale before Python so _PY_PORT_CTYPE_UTF8_ISSUE doesn't cause
30// macro redefinitions.
31#if defined(__APPLE__)
32#include <locale>
33#endif
34
35#define LLDB_MINIMUM_PYTHON_VERSION 0x03080000
36
37#if LLDB_ENABLE_PYTHON_LIMITED_API
38// If defined, LLDB will be ABI-compatible with all Python 3 releases from the
39// specified one onward, and can use Limited API introduced up to that version.
40#define Py_LIMITED_API LLDB_MINIMUM_PYTHON_VERSION
41#endif
42
43// Include python for non windows machines
44#include <Python.h>
45
46// Provide a meaningful diagnostic error if someone tries to compile this file
47// with a version of Python we don't support.
48static_assert(PY_VERSION_HEX >= LLDB_MINIMUM_PYTHON_VERSION,
49 "LLDB requires at least Python 3.8");
50
51// PyMemoryView_FromMemory is part of stable ABI but the flag constants are not.
52// See https://github.com/python/cpython/issues/98680
53#ifndef PyBUF_READ
54#define PyBUF_READ 0x100
55#endif
56
57#endif // LLDB_SOURCE_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_H
#define LLDB_MINIMUM_PYTHON_VERSION
Definition lldb-python.h:35
static llvm::Expected< bool > * g_fcxx_modules_workaround
Definition lldb-python.h:16