aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/lldb/bindings/python/python-typemaps.h
blob: 8a533e822988ed386c50aaa06b868f4bdeb8952c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#ifndef LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H
#define LLDB_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H

#include <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_BINDINGS_PYTHON_PYTHON_TYPEMAPS_H