summaryrefslogtreecommitdiffstats
path: root/lldb/scripts
diff options
context:
space:
mode:
authorLawrence D'Anna <lawrence_danna@apple.com>2019-10-01 01:05:02 +0000
committerLawrence D'Anna <lawrence_danna@apple.com>2019-10-01 01:05:02 +0000
commit4d536bfbead1494c7977689e32837353531ffc4b (patch)
tree6bbfe2eecf8ca2475a2a8642e049cd43e29b055e /lldb/scripts
parent7a6461fcc2ed8e28c43993c561721af0bbe97f3a (diff)
downloadbcm5719-llvm-4d536bfbead1494c7977689e32837353531ffc4b.tar.gz
bcm5719-llvm-4d536bfbead1494c7977689e32837353531ffc4b.zip
File::Clear() -> File::TakeStreamAndClear()
Summary: File::Clear() is an ugly function. It's only used in one place, which is the swig typemaps for FILE*. This patch refactors and renames that function to make it clear what it's really for and why nobody else should use it. Both File::TakeStreamAndClear() and the FILE* typemaps will be removed in later patches after a suitable replacement is in place. Reviewers: JDevlieghere, jasonmolenda, labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68160 llvm-svn: 373285
Diffstat (limited to 'lldb/scripts')
-rw-r--r--lldb/scripts/Python/python-typemaps.swig7
1 files changed, 4 insertions, 3 deletions
diff --git a/lldb/scripts/Python/python-typemaps.swig b/lldb/scripts/Python/python-typemaps.swig
index 0dcd050356e..fe6a1798c53 100644
--- a/lldb/scripts/Python/python-typemaps.swig
+++ b/lldb/scripts/Python/python-typemaps.swig
@@ -372,6 +372,9 @@ bool SetNumberFromPyObject<double>(double &number, PyObject *obj) {
$1 = $1 || PyCallable_Check(reinterpret_cast<PyObject*>($input));
}
+// 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)
@@ -398,9 +401,7 @@ bool SetNumberFromPyObject<double>(double &number, PyObject *obj) {
lldb::FileUP file = py_file.GetUnderlyingFile();
if (!file)
return nullptr;
- $1 = file->GetStream();
- if ($1)
- file->Clear();
+ $1 = file->TakeStreamAndClear();
}
}
OpenPOWER on IntegriCloud