llvm-project/lldb/lit
Pavel Labath d211d1a59c lldb-test: Improve newline handling
Summary:
Previously lldb-test's LinePrinter would output the indentation spaces
even on completely empty lines. This is not nice, as trailing spaces get
flagged as errors in some tools/editors, and it prevents FileCheck's
CHECK-EMPTY from working.

Equally annoying was the fact that the LinePrinter did not terminate
it's output with a newline (instead it would leave the unterminated hanging
indent from the last NewLine() command), which meant that the shell prompt
following the lldb-test command came out wrong.

This fixes both issues by changing how newlines are handled. NewLine(),
which was ending the previous line ('\n') *and* begging the next line by
printing the indent, is now "demoted" to just printing literal "\n".
Instead, lines are now delimited via a helper Line object, which makes
sure the line is indented and terminated in an RAII fashion. The typical
usage would be:
Printer.line() << "This text will be indented and terminated";
If one needs to do more work than it will fit into a single statement,
one can also assign the result of the line() function to a local
variable. The line will then be terminated when that object goes out of
scope.

Reviewers: zturner

Subscribers: lldb-commits

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

llvm-svn: 349269
2018-12-15 13:49:25 +00:00
..
Breakpoint build.py: Implement "gcc" builder 2018-12-12 08:54:14 +00:00
BuildScript build.py: Implement "gcc" builder 2018-12-12 08:54:14 +00:00
Driver Rewrite pexpect-based test in LIT/FileCheck. 2018-12-10 22:57:47 +00:00
ExecControl/StopHook [lit] Disable the stop hook tests on Windows 2018-11-20 16:24:03 +00:00
Expr [lit] Build and link TestIRMemoryMapWindows explicitly 2018-11-20 16:44:06 +00:00
Modules lldb-test: Improve newline handling 2018-12-15 13:49:25 +00:00
Quit Fix some issues with LLDB's lit configuration files. 2018-11-19 15:12:34 +00:00
Reproducer [Reproducers] Only creaate the bottom-most dir 2018-12-04 18:16:49 +00:00
Settings Refactor the lit configuration files 2018-11-02 17:49:01 +00:00
Suite Fix a typo in mac SIP workaround 2018-08-31 06:01:02 +00:00
SymbolFile [NativePDB] Fix local-variables.cpp test. 2018-12-14 18:43:42 +00:00
Unit Refactor the lit configuration files 2018-11-02 17:49:01 +00:00
helper build.py: Implement "gcc" builder 2018-12-12 08:54:14 +00:00
tools/lldb-mi Fix some issues with LLDB's lit configuration files. 2018-11-19 15:12:34 +00:00
CMakeLists.txt [build.py] A few general improvements. 2018-12-04 21:48:27 +00:00
lit-lldb-init Add EchoCommentCommands to CommandInterpreterRunOptions in addition to the existing EchoCommands and expose both as interpreter settings. 2018-10-05 16:49:47 +00:00
lit.cfg.py Fix clang test suite on Windows by reverting part of r347216 2018-11-19 19:36:28 +00:00
lit.site.cfg.py.in [build.py] A few general improvements. 2018-12-04 21:48:27 +00:00