labath added inline comments.
================
Comment at: lldb/source/API/SBFile.cpp:20-26
+void SBFile::SetStream(FILE *file, bool transfer_ownership) {
+ m_opaque_up = std::make_unique<File>(file, transfer_ownership);
+}
+
+void SBFile::SetDescriptor(int fd, bool transfer_owndership) {
+ m_opaque_up = std::make_unique<File>(fd, transfer_owndership);
+}
----------------
lawrence_danna wrote:
> labath wrote:
> > I think it would be better if these were constructors instead of member
> > functions. That way you might be able to get rid of the all the `if
> > (!m_opaque_up) {` checks as the File member will always be initialized.
> Unfortunately, SWIG does not allow return types that don't have default
> constructors.
>
> https://github.com/swig/swig/issues/1062
Hmm.. that is unfortunate. I guess that means we still need the validity
checks, but you should still be able to replace these with constructors, right?
(you've guessed by now that I am not a fan of `Set` methods :) ).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67793/new/
https://reviews.llvm.org/D67793
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits