SBFile support in SBCommandReturnObject

Summary:
This patch add SBFile interfaces to SBCommandReturnObject, and
removes the internal callers of its FILE* interfaces.

Reviewers: JDevlieghere, jasonmolenda, labath

Reviewed By: JDevlieghere

Subscribers: lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D68434

llvm-svn: 374238
This commit is contained in:
Lawrence D'Anna
2019-10-09 21:50:49 +00:00
parent b24022cd72
commit 9eb1371923
11 changed files with 144 additions and 40 deletions

View File

@@ -23,12 +23,13 @@ SBFile::SBFile(FileSP file_sp) : m_opaque_sp(file_sp) {
SBFile::SBFile() { LLDB_RECORD_CONSTRUCTOR_NO_ARGS(SBFile); }
SBFile::SBFile(FILE *file, bool transfer_ownership) {
LLDB_RECORD_DUMMY(void, SBFile, (FILE *, bool), file, transfer_ownership);
m_opaque_sp = std::make_shared<NativeFile>(file, transfer_ownership);
}
SBFile::SBFile(int fd, const char *mode, bool transfer_owndership) {
LLDB_RECORD_CONSTRUCTOR(SBFile, (int, const char *, bool), fd, mode,
transfer_owndership);
LLDB_RECORD_DUMMY(void, SBFile, (int, const char *, bool), fd, mode,
transfer_owndership);
auto options = File::GetOptionsFromMode(mode);
m_opaque_sp = std::make_shared<NativeFile>(fd, options, transfer_owndership);
}
@@ -104,9 +105,9 @@ bool SBFile::operator!() const {
namespace lldb_private {
namespace repro {
template <> void RegisterMethods<SBFile>(Registry &R) {
LLDB_REGISTER_CONSTRUCTOR(SBFile, ());
LLDB_REGISTER_CONSTRUCTOR(SBFile, (int, const char *, bool));
LLDB_REGISTER_METHOD(lldb::SBError, SBFile, Flush, ());
LLDB_REGISTER_METHOD_CONST(bool, SBFile, IsValid, ());
LLDB_REGISTER_METHOD_CONST(bool, SBFile, operator bool,());