[Lldb-commits] [PATCH] D115474: [lldb] Refactor & update of EditlineTest

Neal via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Dec 9 15:33:59 PST 2021


nealsid created this revision.
Herald added a subscriber: kristof.beyls.
nealsid requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This patch has a few minor cleanups and a restructuring of the
EditlineTest class:

Cleanups:

- Adds some comments to member variables
- Renames _editline_sp to _editline_up to reflect that it's a unique_ptr
- Create a debug macro for ConsumeAllOutput when EDITLINE_DUMP_OUTPUT is 1
- Rename _sp_output_thread to output_read_thread since it's no longer a shared pointer.

Restructuring:

- Merge EditlineAdapter and EditlineTestFixture.  EditLineAdapter is a

useful separation, but is only used by EditlineTestFixture.  It's a
perfectly fine pattern to put test state & helper methods in the test
fixture class, which is what this patch does.

- Remove FilePointer, which is an RAII class for FILE* pointers.  We

used it in two locations, which are to store FILE* variables for the
pty file handles.  In the primary case, the Pseudoterminal class already
closes the handle in it's destructor, so we don't need to (and were
actually causing a harmless double close of the handle), and in the
second case, we need to manage the handle close ourselves anyway,
because some tests need to close the handle manually as part of their
test case.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115474

Files:
  lldb/unittests/Editline/EditlineTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115474.393304.patch
Type: text/x-patch
Size: 17449 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20211209/5dc9bf3c/attachment-0001.bin>


More information about the lldb-commits mailing list