[libsanitizer] Create SanitizerCommonDecorator which provides the Warning() and EndWarning() methods

(needed for SEGV handling in sanitizer_common)

llvm-svn: 201392
This commit is contained in:
Alexander Potapenko 2014-02-14 08:59:42 +00:00
parent 7429c5941b
commit 0b28ea9c47
2 changed files with 11 additions and 4 deletions

View 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(); }

View 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