[libsanitizer] Create SanitizerCommonDecorator which provides the Warning() and EndWa...
authorAlexander Potapenko <glider@google.com>
Fri, 14 Feb 2014 08:59:42 +0000 (08:59 +0000)
committerAlexander Potapenko <glider@google.com>
Fri, 14 Feb 2014 08:59:42 +0000 (08:59 +0000)
(needed for SEGV handling in sanitizer_common)

llvm-svn: 201392

compiler-rt/lib/asan/asan_report.cc
compiler-rt/lib/sanitizer_common/sanitizer_report_decorator.h

index bd900e8..787dc5c 100644 (file)
@@ -45,11 +45,9 @@ void AppendToErrorMessageBuffer(const char *buffer) {
 }
 
 // ---------------------- Decorator ------------------------------ {{{1
-class Decorator: private __sanitizer::AnsiColorDecorator {
+class Decorator: public __sanitizer::SanitizerCommonDecorator {
  public:
-  Decorator() : __sanitizer::AnsiColorDecorator(PrintsToTtyCached()) { }
-  const char *Warning()    { return Red(); }
-  const char *EndWarning() { return Default(); }
+  Decorator() : SanitizerCommonDecorator() { }
   const char *Access()     { return Blue(); }
   const char *EndAccess()  { return Default(); }
   const char *Location()   { return Green(); }
index eef2b15..2b6365f 100644 (file)
@@ -36,6 +36,15 @@ class AnsiColorDecorator {
  private:
   bool ansi_;
 };
+
+class SanitizerCommonDecorator: protected AnsiColorDecorator {
+ public:
+  SanitizerCommonDecorator()
+      : __sanitizer::AnsiColorDecorator(PrintsToTtyCached()) { }
+  const char *Warning()    { return Red(); }
+  const char *EndWarning() { return Default(); }
+};
+
 }  // namespace __sanitizer
 
 #endif  // SANITIZER_REPORT_DECORATOR_H