llvm-project/lldb/tools
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
..
argdumper Introduce lldb-framework CMake target and centralize its logic 2018-06-18 18:27:16 +00:00
compact-unwind *** This commit represents a complete reformatting of the LLDB source code 2016-09-06 20:57:50 +00:00
darwin-debug Remove comments after header includes. 2018-11-11 23:16:43 +00:00
darwin-threads the thread id is easier to read in base16. 2018-03-06 23:33:02 +00:00
debugserver Simplify Boolean expressions 2018-12-15 00:15:33 +00:00
driver [Driver] Simplify OptionData. NFC 2018-12-11 20:19:53 +00:00
install-headers add back an Xcode-specific Makefile for header installation 2016-01-28 22:34:36 +00:00
intel-features Remove header grouping comments. 2018-11-11 23:17:06 +00:00
lldb-mi Simplify Boolean expressions 2018-12-15 00:15:33 +00:00
lldb-perf Make lldb -Werror clean for -Wstring-conversion 2017-01-06 00:38:06 +00:00
lldb-server [Reproducers] Change how reproducers are initialized. 2018-12-03 17:28:29 +00:00
lldb-test lldb-test: Improve newline handling 2018-12-15 13:49:25 +00:00
lldb-vscode Simplify Boolean expressions 2018-12-15 00:15:33 +00:00
CMakeLists.txt [cmake] Add option to skip building lldb-server 2018-08-23 18:05:45 +00:00