[ubsan] Honor color option (was: Let lsan honor color option)
Stephan Bergmann
sbergman at redhat.com
Fri Jun 6 02:20:39 PDT 2014
On 06/04/2014 07:05 PM, Sergey Matveev wrote:
> Thanks, fixed in r210199.
...and, in a similar vein, for ubsan (it cannot simply use
SanitizerCommonDecorator as that inherits AnsiColorDecorator protected).
Works at least when -fsanitize=undefined is used in combination with
another sanitizer like -fsanitize=address and ASAN_OPTIONS=color=always:
> Index: lib/ubsan/ubsan_diag.cc
> ===================================================================
> --- lib/ubsan/ubsan_diag.cc (revision 210250)
> +++ lib/ubsan/ubsan_diag.cc (working copy)
> @@ -265,7 +265,7 @@
> }
>
> Diag::~Diag() {
> - __sanitizer::AnsiColorDecorator Decor(PrintsToTty());
> + __sanitizer::AnsiColorDecorator Decor(ColorizeReports());
> SpinMutexLock l(&CommonSanitizerReportMutex);
> Printf(Decor.Bold());
>
Stephan
> Generally, compiler-rt patches should be posted to llvm-commits, not
> cfe-commits.
>
>
> On Wed, Jun 4, 2014 at 8:12 PM, Stephan Bergmann <sbergman at redhat.com
> <mailto:sbergman at redhat.com>> wrote:
>
> The below change to trunk projects/compiler-rt makes
> ASAN_OPTIONS=detect_leaks=1:__color=always colorize the
> LeakSanitizer output as intended:
>
> Index: lib/lsan/lsan_common.cc
> ==============================__==============================__=======
> --- lib/lsan/lsan_common.cc (revision 210183)
> +++ lib/lsan/lsan_common.cc (working copy)
> @@ -133,7 +133,7 @@
>
> class Decorator: private __sanitizer::__AnsiColorDecorator {
> public:
> - Decorator() :
> __sanitizer::__AnsiColorDecorator(__PrintsToTtyCached()) { }
> + Decorator() :
> __sanitizer::__AnsiColorDecorator(__ColorizeReports()) { }
> const char *Error() { return Red(); }
> const char *Leak() { return Blue(); }
> const char *End() { return Default(); }
More information about the llvm-commits
mailing list