Support slim switch for cfg graph dump
[official-gcc.git] / libsanitizer / sanitizer_common / sanitizer_report_decorator.h
blob17f0b2edd2f95d0caa34c4ba9f2a8f7d1e073a6e
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_ALLOCATOR_H
16 #define SANITIZER_ALLOCATOR_H
18 namespace __sanitizer {
19 class AnsiColorDecorator {
20 public:
21 explicit AnsiColorDecorator(bool use_ansi_colors) : ansi_(use_ansi_colors) { }
22 const char *Black() { return ansi_ ? "\033[1m\033[30m" : ""; }
23 const char *Red() { return ansi_ ? "\033[1m\033[31m" : ""; }
24 const char *Green() { return ansi_ ? "\033[1m\033[32m" : ""; }
25 const char *Yellow() { return ansi_ ? "\033[1m\033[33m" : ""; }
26 const char *Blue() { return ansi_ ? "\033[1m\033[34m" : ""; }
27 const char *Magenta() { return ansi_ ? "\033[1m\033[35m" : ""; }
28 const char *Cyan() { return ansi_ ? "\033[1m\033[36m" : ""; }
29 const char *White() { return ansi_ ? "\033[1m\033[37m" : ""; }
30 const char *Default() { return ansi_ ? "\033[1m\033[0m" : ""; }
31 private:
32 bool ansi_;
34 } // namespace __sanitizer
35 #endif // SANITIZER_ALLOCATOR_H