[cfe-commits] [PATCH] ANSI colors for clang!
Török Edwin
edwintorok at gmail.com
Sat May 30 04:50:49 PDT 2009
Hi,
The attached patches make clang output diagnostics in color!
The llvm part adds changeColor/resetColor to raw_fd_ostream, and
StandardErrHasColors() to sys::Process.
The clang part adds a UseColors to TextDiagnosticPrinter, and an
-fno-color-diagnostic to clang-cc.
The detection for color support is very simple: isatty() && $TERM != dumb.
I've seen this used in NetBSD's grep and git. Most modern terminals
support color anyway, and if they don't
the user can either override TERM, or use -fno-color-diagnostic.
Reading terminfo, having a list of known terminals that support colors,
or using ncurses would just be overkill ;)
See attached screenshots for how it looks like.
P.S.: I've got no idea if the win32 part works or even if it compiles.
Please test the patch to see if it works on your systems, thanks!
Best regards,
--Edwin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang.patch
Type: text/x-diff
Size: 7014 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20090530/fd6729e6/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm.patch
Type: text/x-diff
Size: 9743 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20090530/fd6729e6/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang1.png
Type: image/png
Size: 10472 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20090530/fd6729e6/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: clang2.png
Type: image/png
Size: 37475 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20090530/fd6729e6/attachment-0001.png>
More information about the cfe-commits
mailing list