llvm-project/clang/lib
Rui Ueyama a52f982f1c Improve raw_ostream so that you can "write" colors using operator<<
1. raw_ostream supports ANSI colors so that you can write messages to
the termina with colors. Previously, in order to change and reset
color, you had to call `changeColor` and `resetColor` functions,
respectively.

So, if you print out "error: " in red, for example, you had to do
something like this:

  OS.changeColor(raw_ostream::RED);
  OS << "error: ";
  OS.resetColor();

With this patch, you can write the same code as follows:

  OS << raw_ostream::RED << "error: " << raw_ostream::RESET;

2. Add a boolean flag to raw_ostream so that you can disable colored
output. If you disable colors, changeColor, operator<<(Color),
resetColor and other color-related functions have no effect.

Most LLVM tools automatically prints out messages using colors, and
you can disable it by passing a flag such as `--disable-colors`.
This new flag makes it easy to write code that works that way.

Differential Revision: https://reviews.llvm.org/D65564

llvm-svn: 367649
2019-08-02 04:48:30 +00:00
..
ARCMigrate [clang] Adopt new FileManager error-returning APIs 2019-08-01 21:31:56 +00:00
AST [clang] Adopt new FileManager error-returning APIs 2019-08-01 21:31:56 +00:00
ASTMatchers [clang] Add isDirectlyDerivedFrom AST matcher. 2019-07-25 11:54:13 +00:00
Analysis Improve raw_ostream so that you can "write" colors using operator<< 2019-08-02 04:48:30 +00:00
Basic [clang] Adopt new FileManager error-returning APIs 2019-08-01 21:31:56 +00:00
CodeGen [PGO] Add PGO support at -O0 in the experimental new pass manager 2019-08-01 22:36:34 +00:00
CrossTU [CrossTU] Add a function to retrieve original source location. 2019-07-24 10:16:37 +00:00
DirectoryWatcher [DirectoryWatcher] Relax assumption to prevent test flakiness 2019-08-01 23:24:30 +00:00
Driver Add support for openSUSE RISC-V triple 2019-08-01 14:23:56 +00:00
Edit [C++2a] Add __builtin_bit_cast, used to implement std::bit_cast 2019-07-02 18:28:13 +00:00
Format [clang-format] Fix a bug that doesn't break braces before unions for Allman 2019-08-02 04:30:42 +00:00
Frontend Improve raw_ostream so that you can "write" colors using operator<< 2019-08-02 04:48:30 +00:00
FrontendTool [clang-ifs] Clang Interface Stubs, first version (second landing attempt). 2019-06-20 16:59:48 +00:00
Headers [AArch64] Add support for Transactional Memory Extension (TME) 2019-07-31 12:52:17 +00:00
Index [clang][NFCI] Fix random typos 2019-07-23 16:54:11 +00:00
Lex [clang] Adopt new FileManager error-returning APIs 2019-08-01 21:31:56 +00:00
Parse [Parser] Change parameter type from int to enum 2019-08-01 11:46:28 +00:00
Rewrite [Rewrite] Extend to further accept CharSourceRange 2019-07-06 02:55:06 +00:00
Sema Delay emitting dllexport explicitly defaulted members until the class is fully parsed (PR40006) 2019-08-01 08:01:09 +00:00
Serialization [clang] Adopt new FileManager error-returning APIs 2019-08-01 21:31:56 +00:00
StaticAnalyzer [analyzer] StackFrameContext: Add NodeBuilderContext::blockCount() to its profile 2019-08-01 20:41:13 +00:00
Tooling [clang] Adopt new FileManager error-returning APIs 2019-08-01 21:31:56 +00:00
CMakeLists.txt Reland [clang] DirectoryWatcher 2019-07-12 20:34:10 +00:00