[AArch64] Add cost handling of CALLER_SAVE_REGS and POINTER_REGS
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_report_decorator.h
blobc85105851112a53a53267677170a093f6a2119bd
1 //===-- sanitizer_report_decorator.h ----------------------------*- C++ -*-===//
2 //
3 // This file is distributed under the University of Illinois Open Source
4 // License. See LICENSE.TXT for details.
5 //
6 //===----------------------------------------------------------------------===//
7 //
8 // Tags to decorate the sanitizer reports.
9 // Currently supported tags:
10 // * None.
11 // * ANSI color sequences.
13 //===----------------------------------------------------------------------===//
15 #ifndef SANITIZER_REPORT_DECORATOR_H
16 #define SANITIZER_REPORT_DECORATOR_H
18 #include "sanitizer_common.h"
20 namespace __sanitizer {
21 class AnsiColorDecorator {
22 // FIXME: This is not portable. It assumes the special strings are printed to
23 // stdout, which is not the case on Windows (see SetConsoleTextAttribute()).
24 public:
25 explicit AnsiColorDecorator(bool use_ansi_colors) : ansi_(use_ansi_colors) { }
26 const char *Bold() const { return ansi_ ? "\033[1m" : ""; }
27 const char *Black() const { return ansi_ ? "\033[1m\033[30m" : ""; }
28 const char *Red() const { return ansi_ ? "\033[1m\033[31m" : ""; }
29 const char *Green() const { return ansi_ ? "\033[1m\033[32m" : ""; }
30 const char *Yellow() const { return ansi_ ? "\033[1m\033[33m" : ""; }
31 const char *Blue() const { return ansi_ ? "\033[1m\033[34m" : ""; }
32 const char *Magenta() const { return ansi_ ? "\033[1m\033[35m" : ""; }
33 const char *Cyan() const { return ansi_ ? "\033[1m\033[36m" : ""; }
34 const char *White() const { return ansi_ ? "\033[1m\033[37m" : ""; }
35 const char *Default() const { return ansi_ ? "\033[1m\033[0m" : ""; }
36 private:
37 bool ansi_;
40 class SanitizerCommonDecorator: protected AnsiColorDecorator {
41 public:
42 SanitizerCommonDecorator()
43 : __sanitizer::AnsiColorDecorator(ColorizeReports()) { }
44 const char *Warning() { return Red(); }
45 const char *EndWarning() { return Default(); }
48 } // namespace __sanitizer
50 #endif // SANITIZER_REPORT_DECORATOR_H