This is an archive of the discontinued LLVM Phabricator instance.

[dwarfdump][NFC] Consistent errors and warnings with --verify
ClosedPublic

Authored by JDevlieghere on Sep 28 2017, 9:35 AM.

Details

Summary

This patch introduces 3 helper functions: error(), warn() and note() to
make printing during verification more consistent. When supported, the
respective prefixes are printed in color using the same color scheme as
clang.

Diff Detail

Repository
rL LLVM

Event Timeline

I opted for this approach rather than passing a Twine to an error/warn function because of format objects.

aprantl edited edge metadata.Sep 28 2017, 9:56 AM

Sweet.
And then we can add color (using the same color scheme as clang with -fcolor-diagnostics) when printing to a real TTY (there already is code in dwarfdump to detect this).

Are there errors/warnings outside of DWARFVerifier.cpp, too?

lib/DebugInfo/DWARF/DWARFVerifier.cpp
154 ↗(On Diff #117011)

in the compiler we often prefix additional comments with note: . Should we do this here, too? (with a note() << function?

JDevlieghere edited the summary of this revision. (Show Details)
  • Feedback Adrian
  • Add color
  • Add note()
JDevlieghere marked an inline comment as done.Sep 28 2017, 10:26 AM
aprantl accepted this revision.Sep 28 2017, 10:32 AM

Thanks!

lib/DebugInfo/DWARF/DWARFVerifier.cpp
328 ↗(On Diff #117017)

This doesn't belong in this review, but I just noticed that we also should define a similar helper for formatting a range. I think at some point we all agreed that half-open ranges should be formatted [start,end).

test/tools/llvm-dwarfdump/X86/verify_unit_header_chain.s
7 ↗(On Diff #117017)

extra whitespace

This revision is now accepted and ready to land.Sep 28 2017, 10:32 AM
This revision was automatically updated to reflect the committed changes.