[compiler-rt] r201392 - [libsanitizer] Create SanitizerCommonDecorator which provides the Warning() and EndWarning() methods

Alexander Potapenko glider at google.com
Fri Feb 14 00:59:46 PST 2014


Author: glider
Date: Fri Feb 14 02:59:42 2014
New Revision: 201392

URL: http://llvm.org/viewvc/llvm-project?rev=201392&view=rev
Log:
[libsanitizer] Create SanitizerCommonDecorator which provides the Warning() and EndWarning() methods
(needed for SEGV handling in sanitizer_common)


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

Modified: compiler-rt/trunk/lib/asan/asan_report.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_report.cc?rev=201392&r1=201391&r2=201392&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_report.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_report.cc Fri Feb 14 02:59:42 2014
@@ -45,11 +45,9 @@ void AppendToErrorMessageBuffer(const ch
 }
 
 // ---------------------- 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(); }

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_report_decorator.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_report_decorator.h?rev=201392&r1=201391&r2=201392&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_report_decorator.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_report_decorator.h Fri Feb 14 02:59:42 2014
@@ -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





More information about the llvm-commits mailing list