Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
lldb/scripts/Python/python-typemaps.swig
Show First 20 Lines • Show All 428 Lines • ▼ Show 20 Lines | %typecheck(SWIG_TYPECHECK_POINTER) lldb::FileSP { | ||||
if (lldb_private::PythonFile::Check($input)) { | if (lldb_private::PythonFile::Check($input)) { | ||||
$1 = 1; | $1 = 1; | ||||
} else { | } else { | ||||
PyErr_Clear(); | PyErr_Clear(); | ||||
$1 = 0; | $1 = 0; | ||||
} | } | ||||
} | } | ||||
%typemap(out) lldb::FileSP { | |||||
using namespace lldb_private; | |||||
$result = nullptr; | |||||
lldb::FileSP &sp = $1; | |||||
if (sp) { | |||||
PythonFile pyfile = unwrapOrSetPythonException(PythonFile::FromFile(*sp)); | |||||
if (!pyfile.IsValid()) | |||||
return nullptr; | |||||
$result = pyfile.release(); | |||||
} | |||||
if (!$result) | |||||
{ | |||||
$result = Py_None; | |||||
Py_INCREF(Py_None); | |||||
} | |||||
} | |||||
// FIXME both of these paths wind up calling fdopen() with no provision for ever calling | // 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 | // fclose() on the result. SB interfaces that use FILE* should be deprecated for scripting | ||||
// use and this typemap should eventually be removed. | // use and this typemap should eventually be removed. | ||||
%typemap(in) FILE * { | %typemap(in) FILE * { | ||||
using namespace lldb_private; | using namespace lldb_private; | ||||
if ($input == Py_None) | if ($input == Py_None) | ||||
$1 = nullptr; | $1 = nullptr; | ||||
▲ Show 20 Lines • Show All 131 Lines • Show Last 20 Lines |