aadsm updated this revision to Diff 287149.
aadsm added a comment.
Moved the header file to be in Plugins/ScriptInterpreter/Python so clang-tidy
doesn't get confused solving include paths.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D86381/new/
https://reviews.llvm.org/D86381
Files:
lldb/bindings/python/python-typemaps.swig
lldb/source/Plugins/ScriptInterpreter/Python/lldb-python-typemaps.h
Index: lldb/source/Plugins/ScriptInterpreter/Python/lldb-python-typemaps.h
===================================================================
--- /dev/null
+++ lldb/source/Plugins/ScriptInterpreter/Python/lldb-python-typemaps.h
@@ -0,0 +1,19 @@
+#ifndef LLDB_SOURCE_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_TYPEMAPS_H
+#define LLDB_SOURCE_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_TYPEMAPS_H
+
+#include "lldb-python.h"
+
+// Defined here instead of a .swig file because SWIG 2 doesn't support
+// explicit deleted functions.
+struct Py_buffer_RAII {
+ Py_buffer buffer = {};
+ Py_buffer_RAII(){};
+ Py_buffer &operator=(const Py_buffer_RAII &) = delete;
+ Py_buffer_RAII(const Py_buffer_RAII &) = delete;
+ ~Py_buffer_RAII() {
+ if (buffer.obj)
+ PyBuffer_Release(&buffer);
+ }
+};
+
+#endif // LLDB_SOURCE_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_TYPEMAPS_H
Index: lldb/bindings/python/python-typemaps.swig
===================================================================
--- lldb/bindings/python/python-typemaps.swig
+++ lldb/bindings/python/python-typemaps.swig
@@ -1,5 +1,11 @@
/* Typemap definitions, to allow SWIG to properly handle 'char**' data types.
*/
+%inline %{
+
+#include "../source/Plugins/ScriptInterpreter/Python/lldb-python-typemaps.h"
+
+%}
+
%typemap(in) char ** {
/* Check if is a list */
if (PythonList::Check($input)) {
@@ -61,7 +67,7 @@
%typemap(in) lldb::tid_t {
PythonObject obj = Retain<PythonObject>($input);
- lldb::tid_t value = unwrapOrSetPythonException(As<unsigned long long>(obj));
+ lldb::tid_t value = unwrapOrSetPythonException(As<unsigned long long>(obj));
if (PyErr_Occurred())
return nullptr;
$1 = value;
@@ -476,21 +482,6 @@
}
}
-%inline %{
-
-struct Py_buffer_RAII {
- Py_buffer buffer = {};
- Py_buffer_RAII() {};
- Py_buffer &operator=(const Py_buffer_RAII &) = delete;
- Py_buffer_RAII(const Py_buffer_RAII &) = delete;
- ~Py_buffer_RAII() {
- if (buffer.obj)
- PyBuffer_Release(&buffer);
- }
-};
-
-%}
-
// These two pybuffer macros are copied out of swig/Lib/python/pybuffer.i,
// and fixed so they will not crash if PyObject_GetBuffer fails.
// https://github.com/swig/swig/issues/1640
Index: lldb/source/Plugins/ScriptInterpreter/Python/lldb-python-typemaps.h
===================================================================
--- /dev/null
+++ lldb/source/Plugins/ScriptInterpreter/Python/lldb-python-typemaps.h
@@ -0,0 +1,19 @@
+#ifndef LLDB_SOURCE_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_TYPEMAPS_H
+#define LLDB_SOURCE_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_TYPEMAPS_H
+
+#include "lldb-python.h"
+
+// Defined here instead of a .swig file because SWIG 2 doesn't support
+// explicit deleted functions.
+struct Py_buffer_RAII {
+ Py_buffer buffer = {};
+ Py_buffer_RAII(){};
+ Py_buffer &operator=(const Py_buffer_RAII &) = delete;
+ Py_buffer_RAII(const Py_buffer_RAII &) = delete;
+ ~Py_buffer_RAII() {
+ if (buffer.obj)
+ PyBuffer_Release(&buffer);
+ }
+};
+
+#endif // LLDB_SOURCE_PLUGINS_SCRIPTINTERPRETER_PYTHON_LLDB_PYTHON_TYPEMAPS_H
Index: lldb/bindings/python/python-typemaps.swig
===================================================================
--- lldb/bindings/python/python-typemaps.swig
+++ lldb/bindings/python/python-typemaps.swig
@@ -1,5 +1,11 @@
/* Typemap definitions, to allow SWIG to properly handle 'char**' data types. */
+%inline %{
+
+#include "../source/Plugins/ScriptInterpreter/Python/lldb-python-typemaps.h"
+
+%}
+
%typemap(in) char ** {
/* Check if is a list */
if (PythonList::Check($input)) {
@@ -61,7 +67,7 @@
%typemap(in) lldb::tid_t {
PythonObject obj = Retain<PythonObject>($input);
- lldb::tid_t value = unwrapOrSetPythonException(As<unsigned long long>(obj));
+ lldb::tid_t value = unwrapOrSetPythonException(As<unsigned long long>(obj));
if (PyErr_Occurred())
return nullptr;
$1 = value;
@@ -476,21 +482,6 @@
}
}
-%inline %{
-
-struct Py_buffer_RAII {
- Py_buffer buffer = {};
- Py_buffer_RAII() {};
- Py_buffer &operator=(const Py_buffer_RAII &) = delete;
- Py_buffer_RAII(const Py_buffer_RAII &) = delete;
- ~Py_buffer_RAII() {
- if (buffer.obj)
- PyBuffer_Release(&buffer);
- }
-};
-
-%}
-
// These two pybuffer macros are copied out of swig/Lib/python/pybuffer.i,
// and fixed so they will not crash if PyObject_GetBuffer fails.
// https://github.com/swig/swig/issues/1640
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits