diff options
author | Sergey Matveev <earthdok@google.com> | 2013-09-03 13:31:03 +0000 |
---|---|---|
committer | Sergey Matveev <earthdok@google.com> | 2013-09-03 13:31:03 +0000 |
commit | 650c7d44b659ddfb4af471dc2ad79a727b7de939 (patch) | |
tree | db9f0ace7d8f6d95b8f054f97c7cdc40ebe2d9a6 /lib/sanitizer_common/sanitizer_common_libcdep.cc | |
parent | 68c016aea0b61f649b9d9ba65c7d7217e0c0f6cb (diff) |
[lsan] Colorize LSan reports.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@189804 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_common_libcdep.cc')
-rw-r--r-- | lib/sanitizer_common/sanitizer_common_libcdep.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_common_libcdep.cc b/lib/sanitizer_common/sanitizer_common_libcdep.cc index c730ccfbd..f3430074e 100644 --- a/lib/sanitizer_common/sanitizer_common_libcdep.cc +++ b/lib/sanitizer_common/sanitizer_common_libcdep.cc @@ -20,4 +20,18 @@ bool PrintsToTty() { return internal_isatty(report_fd) != 0; } +bool PrintsToTtyCached() { + // FIXME: Add proper Windows support to AnsiColorDecorator and re-enable color + // printing on Windows. + if (SANITIZER_WINDOWS) + return 0; + + static int cached = 0; + static bool prints_to_tty; + if (!cached) { // Not thread-safe. + prints_to_tty = PrintsToTty(); + cached = 1; + } + return prints_to_tty; +} } // namespace __sanitizer |