[Lldb-commits] [PATCH] D55597: lldb-test: Improve newline handling
Pavel Labath via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Dec 12 05:02:28 PST 2018
labath created this revision.
labath added a reviewer: zturner.
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 RIAA 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.
https://reviews.llvm.org/D55597
Files:
lit/Modules/MachO/subsections.yaml
tools/lldb-test/FormatUtil.cpp
tools/lldb-test/FormatUtil.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55597.177841.patch
Type: text/x-patch
Size: 4697 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20181212/68c2c4e2/attachment.bin>
More information about the lldb-commits
mailing list