summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_report_decorator.h
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2012-12-18 07:32:16 +0000
committerKostya Serebryany <kcc@google.com>2012-12-18 07:32:16 +0000
commit58f54555c2528f863e211a0679c2c423cfa55fb2 (patch)
tree18391fe4eaee237fc2bf939bebe7ce56f4e1009b /lib/sanitizer_common/sanitizer_report_decorator.h
parentc2234cd922bbd94e276e0bebb08004d63cbc5cf2 (diff)
downloadcompiler-rt-58f54555c2528f863e211a0679c2c423cfa55fb2.tar.gz
[asan] add some colors to asan output if printing to tty (following ubsan)
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@170418 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_report_decorator.h')
-rw-r--r--lib/sanitizer_common/sanitizer_report_decorator.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_report_decorator.h b/lib/sanitizer_common/sanitizer_report_decorator.h
new file mode 100644
index 000000000..50a3ee572
--- /dev/null
+++ b/lib/sanitizer_common/sanitizer_report_decorator.h
@@ -0,0 +1,37 @@
+//===-- sanitizer_report_decorator.h ----------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Tags to decorate the sanitizer reports.
+// Currently supported tags:
+// * None.
+// * ANSI color sequences.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef SANITIZER_ALLOCATOR_H
+#define SANITIZER_ALLOCATOR_H
+
+namespace __sanitizer {
+class AnsiColorDecorator {
+ public:
+ explicit AnsiColorDecorator(bool use_ansi_colors) : ansi_(use_ansi_colors) { }
+ const char *Black() { return ansi_ ? "\033[1m\033[30m" : ""; }
+ const char *Red() { return ansi_ ? "\033[1m\033[31m" : ""; }
+ const char *Green() { return ansi_ ? "\033[1m\033[32m" : ""; }
+ const char *Yellow() { return ansi_ ? "\033[1m\033[33m" : ""; }
+ const char *Blue() { return ansi_ ? "\033[1m\033[34m" : ""; }
+ const char *Magenta() { return ansi_ ? "\033[1m\033[35m" : ""; }
+ const char *Cyan() { return ansi_ ? "\033[1m\033[36m" : ""; }
+ const char *White() { return ansi_ ? "\033[1m\033[37m" : ""; }
+ const char *Default() { return ansi_ ? "\033[1m\033[0m" : ""; }
+ private:
+ bool ansi_;
+};
+} // namespace __sanitizer
+#endif // SANITIZER_ALLOCATOR_H