7 Commits

Author SHA1 Message Date
Jonas Devlieghere
f7e1e2ecdd [Support] Move header to WithColor header
Forgot to move the CommandLine.h include form the implementation to the
header and didn't notice the failure with my local modules build.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333177 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-24 11:47:20 +00:00
Jonas Devlieghere
2071b7a8b2 [Support] Add color cl category.
This commit adds a color category so tools can document this option and
enables it for dwarfdump and dsymuttil.

rdar://problem/40498996

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333176 91177308-0d34-0410-b5e6-96231b3b80d8
2018-05-24 11:36:57 +00:00
Jonas Devlieghere
e375d515ff [Support] Fix prefix logic in WithColor.
When a prefix is passed, we need to print a colon a space after it, not
just the prefix.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330535 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-22 08:01:01 +00:00
Jonas Devlieghere
52107f0189 [Support] Add optional prefix to convenience helpers in WithColor.
Several tools prefix the error/warning/note output with the name of the
tool. One such tool is LLD for example. This commit adds as an optional
'Prefix' argument to the convenience helpers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330526 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-21 21:36:11 +00:00
Jonas Devlieghere
5365e8b418 [Support] Extend WithColor helpers
Although printing warnings and errors to stderr is by far the most
common case, this patch makes it possible to specify any stream.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330094 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-15 08:44:15 +00:00
Jonas Devlieghere
5baab4c85c [Support] Add convenience functions to WithColor. NFC.
Create convenience functions for printing error, warning and note to
stdout. Previously we had similar functions being used in dsymutil, but
given that this pattern is so common it makes sense to make it available
globally.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330091 91177308-0d34-0410-b5e6-96231b3b80d8
2018-04-14 21:36:42 +00:00
Jonas Devlieghere
01d72e5767 [Support] Move syntax highlighting into support
Move the DWARF syntax highlighting into support. This has several
advantages, most notably 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.

Differential revision: https://reviews.llvm.org/D44215

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@327108 91177308-0d34-0410-b5e6-96231b3b80d8
2018-03-09 09:56:24 +00:00