This is an archive of the discontinued LLVM Phabricator instance.

[Support] Move syntax highlighting into support
ClosedPublic

Authored by JDevlieghere on Mar 7 2018, 9:37 AM.

Details

Summary

Move the DWARF syntax highlighting into support. This has several
advantages, among which the facts that this makes the WithColor RAII
wrapper available outside libDebugInfo. Furthermore, several projects
all have their own code for handling colored output. This provides a
place to centralize it and guarantees a consistent experience.

Diff Detail

Repository
rL LLVM

Event Timeline

JDevlieghere created this revision.Mar 7 2018, 9:37 AM
davide added a comment.Mar 7 2018, 9:43 AM

Makes sense to me, can you do the formatting separately?

llvm/include/llvm/Support/SyntaxHighlighting.h
32–33 ↗(On Diff #137417)

unrelated formatting change?

llvm/lib/Support/SyntaxHighlighting.cpp
32–58 ↗(On Diff #137417)

these formatting changes are unrelated I assume? If so, can you split?

davide requested changes to this revision.Mar 7 2018, 9:44 AM

Marking as requested changes to get off of my queue. You can commit the formatting changes without review, then update this patch (I'll take another look).

This revision now requires changes to proceed.Mar 7 2018, 9:44 AM
zturner added a subscriber: zturner.Mar 7 2018, 9:44 AM

This would be a good chance to change the name of SyntaxHighlighting.h to WithColor.h and similarly for the cpp. Thoughts?

Makes sense to me, can you do the formatting separately?

My motivation is that I'm touching the lines anyway, so I might as well do it now.

dblaikie added inline comments.Mar 7 2018, 10:01 AM
llvm/lib/Support/SyntaxHighlighting.cpp
32 ↗(On Diff #137417)

Any interest in fixing this enum (Address/String/Tag/Attribute) to either have a prefix (HC_) or use an enum class (HighlightColor::Address, etc) in a follow-up change?

I think I wrote some code the other day where I thought I was using a variable named "Address" (wihch I'd forgotten to actually declare/initialize) but was actually using this enum constant...

JDevlieghere marked an inline comment as done.

Updated the diff with feedback Zachary & Dave. Thanks for the swift reviews!

davide accepted this revision.Mar 8 2018, 9:18 AM

As discussed, given you're moving the whole file anyway, this is fine. Thanks

This revision is now accepted and ready to land.Mar 8 2018, 9:18 AM
This revision was automatically updated to reflect the committed changes.
llvm/trunk/lib/DebugInfo/DWARF/SyntaxHighlighting.h