WithColor provides a way to change text color temporarily but currently it resets colors
in the destructor regardless of the previous color. Consider this example:
{ WithColor Red(outs(), raw_ostream::RED); Red << "AAA\n"; WithColor(outs(), raw_ostream::BLUE) << "BBB\n"; Red << "CCC\n"; }
In this example "CCC" is not colored with red because the WithColor instance for
"BBB" resets the color in its destructor.
This patch addresses the issue by saving the previous color state and restoring
the color settings in the destructor.
... then you can remove {}