summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2015-10-16 17:52:03 +0000
committerZachary Turner <zturner@google.com>2015-10-16 17:52:03 +0000
commitc5b41d67af3df959d2f1958f19e8aab39805743b (patch)
tree66fa8ee055bc80a1621ec0a92e5f4f9c21008acb
parent7d6d218e1219f7df284b83dfb3eaa5e5b70e77e8 (diff)
downloadbcm5719-llvm-c5b41d67af3df959d2f1958f19e8aab39805743b.tar.gz
bcm5719-llvm-c5b41d67af3df959d2f1958f19e8aab39805743b.zip
Fix linkage of `init_lldb` SWIG method in Python 3.
llvm-svn: 250531
-rw-r--r--lldb/source/API/SystemInitializerFull.cpp12
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h6
2 files changed, 16 insertions, 2 deletions
diff --git a/lldb/source/API/SystemInitializerFull.cpp b/lldb/source/API/SystemInitializerFull.cpp
index d9fbbf99178..d3df421da2c 100644
--- a/lldb/source/API/SystemInitializerFull.cpp
+++ b/lldb/source/API/SystemInitializerFull.cpp
@@ -89,9 +89,19 @@ using namespace lldb_private;
#ifndef LLDB_DISABLE_PYTHON
// Defined in the SWIG source file
+#if PY_MAJOR_VERSION >= 3
+extern "C" PyObject*
+PyInit__lldb(void);
+
+#define LLDBSwigPyInit PyInit__lldb
+
+#else
extern "C" void
init_lldb(void);
+#define LLDBSwigPyInit init_lldb
+#endif
+
// these are the Pythonic implementations of the required callbacks
// these are scripting-language specific, which is why they belong here
// we still need to use function pointers to them instead of relying
@@ -328,7 +338,7 @@ void SystemInitializerFull::InitializeSWIG()
{
#if !defined(LLDB_DISABLE_PYTHON)
ScriptInterpreterPython::InitializeInterpreter(
- init_lldb,
+ LLDBSwigPyInit,
LLDBSwigPythonBreakpointCallbackFunction,
LLDBSwigPythonWatchpointCallbackFunction,
LLDBSwigPythonCallTypeScript,
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
index 0f613e5842c..0cdb9c054eb 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h
@@ -32,7 +32,11 @@ class ScriptInterpreterPython :
public IOHandlerDelegateMultiline
{
public:
- typedef void (*SWIGInitCallback) (void);
+#if PY_MAJOR_VERSION >= 3
+ typedef PyObject*(*SWIGInitCallback) (void);
+#else
+ typedef void(*SWIGInitCallback) (void);
+#endif
typedef bool (*SWIGBreakpointCallbackFunction) (const char *python_function_name,
const char *session_dictionary_name,
OpenPOWER on IntegriCloud