summaryrefslogtreecommitdiff
path: root/lldb/scripts
diff options
context:
space:
mode:
authorLawrence D'Anna <lawrence_danna@apple.com>2019-10-17 01:35:22 +0000
committerLawrence D'Anna <lawrence_danna@apple.com>2019-10-17 01:35:22 +0000
commit0f783599a4c645d8ae826f990f7b938fac6e5dae (patch)
tree9792f137ff09b6b8b90cbcf3d75dd8a98999ea25 /lldb/scripts
parent56ee31964f5a57621953eacdc8458bd41dfc4154 (diff)
downloadllvm-0f783599a4c645d8ae826f990f7b938fac6e5dae.tar.gz
delete SWIG typemaps for FILE*
Summary: The SWIG typemaps for FILE* are no longer used, so this patch deletes them. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68963 llvm-svn: 375073
Diffstat (limited to 'lldb/scripts')
-rw-r--r--lldb/scripts/Python/python-typemaps.swig68
1 files changed, 0 insertions, 68 deletions
diff --git a/lldb/scripts/Python/python-typemaps.swig b/lldb/scripts/Python/python-typemaps.swig
index b9389022512c..8ff178bc5e52 100644
--- a/lldb/scripts/Python/python-typemaps.swig
+++ b/lldb/scripts/Python/python-typemaps.swig
@@ -451,74 +451,6 @@ bool SetNumberFromPyObject<double>(double &number, PyObject *obj) {
}
}
-// FIXME both of these paths wind up calling fdopen() with no provision for ever calling
-// fclose() on the result. SB interfaces that use FILE* should be deprecated for scripting
-// use and this typemap should eventually be removed.
-%typemap(in) FILE * {
- using namespace lldb_private;
- if ($input == Py_None)
- $1 = nullptr;
- else if (!lldb_private::PythonFile::Check($input)) {
- int fd = PyObject_AsFileDescriptor($input);
- if (fd < 0 || PyErr_Occurred())
- return nullptr;
- PythonObject py_input(PyRefType::Borrowed, $input);
- PythonString py_mode = py_input.GetAttributeValue("mode").AsType<PythonString>();
- if (!py_mode.IsValid() || PyErr_Occurred())
- return nullptr;
- FILE *f;
- if ((f = fdopen(fd, py_mode.GetString().str().c_str())))
- $1 = f;
- else {
- PyErr_SetString(PyExc_TypeError, strerror(errno));
- return nullptr;
- }
- }
- else
- {
- PythonFile py_file(PyRefType::Borrowed, $input);
- lldb::FileUP file = py_file.GetUnderlyingFile();
- if (!file)
- return nullptr;
- $1 = file->TakeStreamAndClear();
- }
-}
-
-%typemap(out) FILE * {
- // TODO: This is gross. We should find a way to fetch the mode flags from the
- // lldb_private::File object.
- char mode[4] = {0};
-%#ifdef __APPLE__
- int i = 0;
- if ($1)
- {
- short flags = $1->_flags;
-
- if (flags & __SRD)
- mode[i++] = 'r';
- else if (flags & __SWR)
- mode[i++] = 'w';
- else // if (flags & __SRW)
- mode[i++] = 'a';
- }
-%#else
- // There's no portable way to get the mode here. We just return a mode which
- // permits both reads and writes and count on the operating system to return
- // an error when an invalid operation is attempted.
- mode[0] = 'r';
- mode[1] = '+';
-%#endif
- using namespace lldb_private;
- NativeFile file($1, false);
- PythonFile py_file(file, mode);
- $result = py_file.release();
- if (!$result)
- {
- $result = Py_None;
- Py_INCREF(Py_None);
- }
-}
-
%typemap(in) (const char* string, int len) {
using namespace lldb_private;
if ($input == Py_None)