[PATCH] D80989: [DebugInfo] Make verbose line output appear at same point as non-verbose

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 03:48:18 PDT 2020


jhenderson added a comment.

In D80989#2069112 <https://reviews.llvm.org/D80989#2069112>, @dblaikie wrote:

> Not a huge fan of this - seems like a bit of a contortion & I'm not sure the consistency of where warnings are printed is all that important? (perhaps this is more of the path that I'd have liked to avoid by not syncing/flushing/trying to line up these things in the first place)
>
> Alternatively, though - could the APIs be changed here to make them more similar/consistent - rather than having an API that prints out and returns a result? What about going the other way and having a callback API that's called back for processed lines and unprocessed lines - and then it's printed on a per-line-table-entry basis, rather than buffered and dumped at the end? Eh, guess then you'd need a separate callback for the header too, etc.


There's probably an easier way, thinking about it - rather than have the verbose output behaviour be controlled by the presence of `OS` or not, simply pass in a separate `Verbose` argument for verbose output, and `OS` for verbose or non-verbose output. In other words, the three usages would become:

1. No output at all - don't pass in `OS` and set `Verbose` to `false` (or possibly it doesn't matter). Code will just populate the rows, sequences etc.
2. Brief non-verbose output - pass in `OS` and set `Verbose` to `false`. Code will populate the data structures and also print the rows as it goes, like the current verbose output, except without the instruction details etc.
3. Verbose output - pass in `OS` and set `Verbose` to `true`. Code will behave the same as currently.

The second and third options differ in that some output is only printed in verbose mode, whilst other output is printed always. This feels more natural to me as an interface anyway. I'll take a look at that as an alternative. It will give us more consistent timings of when things are printed (possibly important if people are doing some crazy things with custom streams, plus helps with error message timing) without significantly complicating the interface or having to buffer the output unnecessarily.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80989/new/

https://reviews.llvm.org/D80989





More information about the llvm-commits mailing list