[compiler-rt] r234423 - [Sanitizer RT] Get rid of internal_isatty
Timur Iskhodzhanov
timurrrr at google.com
Wed Apr 8 10:42:58 PDT 2015
Author: timurrrr
Date: Wed Apr 8 12:42:57 2015
New Revision: 234423
URL: http://llvm.org/viewvc/llvm-project?rev=234423&view=rev
Log:
[Sanitizer RT] Get rid of internal_isatty
Modified:
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h
compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h?rev=234423&r1=234422&r2=234423&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h Wed Apr 8 12:42:57 2015
@@ -163,7 +163,7 @@ extern StaticSpinMutex CommonSanitizerRe
struct ReportFile {
void Write(const char *buffer, uptr length);
- bool PrintsToTty();
+ bool SupportsColors();
void SetReportPath(const char *path);
// Don't use fields directly. They are only declared public to allow
@@ -199,6 +199,8 @@ enum FileAccessMode {
// Returns kInvalidFd on error.
fd_t OpenFile(const char *filename, FileAccessMode mode,
error_t *errno_p = nullptr);
+bool SupportsColoredOutput(fd_t fd);
+
// Opens the file 'file_name" and reads up to 'max_len' bytes.
// The resulting buffer is mmaped and stored in '*buff'.
// The size of the mmaped region is stored in '*buff_size',
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc?rev=234423&r1=234422&r2=234423&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common_libcdep.cc Wed Apr 8 12:42:57 2015
@@ -23,10 +23,10 @@
namespace __sanitizer {
-bool ReportFile::PrintsToTty() {
+bool ReportFile::SupportsColors() {
SpinMutexLock l(mu);
ReopenIfNecessary();
- return internal_isatty(fd) != 0;
+ return SupportsColoredOutput(fd);
}
bool ColorizeReports() {
@@ -37,7 +37,7 @@ bool ColorizeReports() {
const char *flag = common_flags()->color;
return internal_strcmp(flag, "always") == 0 ||
- (internal_strcmp(flag, "auto") == 0 && report_file.PrintsToTty());
+ (internal_strcmp(flag, "auto") == 0 && report_file.SupportsColors());
}
static void (*sandboxing_callback)();
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h?rev=234423&r1=234422&r2=234423&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_libc.h Wed Apr 8 12:42:57 2015
@@ -63,7 +63,6 @@ const fd_t kStdinFd = 0;
const fd_t kStdoutFd = 1;
const fd_t kStderrFd = 2;
uptr internal_close(fd_t fd);
-int internal_isatty(fd_t fd);
uptr internal_read(fd_t fd, void *buf, uptr count);
uptr internal_write(fd_t fd, const void *buf, uptr count);
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc?rev=234423&r1=234422&r2=234423&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_posix_libcdep.cc Wed Apr 8 12:42:57 2015
@@ -122,8 +122,8 @@ int Atexit(void (*function)(void)) {
#endif
}
-int internal_isatty(fd_t fd) {
- return isatty(fd);
+bool SupportsColoredOutput(fd_t fd) {
+ return isatty(fd) != 0;
}
#ifndef SANITIZER_GO
Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc?rev=234423&r1=234422&r2=234423&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_win.cc Wed Apr 8 12:42:57 2015
@@ -399,14 +399,15 @@ uptr internal_close(fd_t fd) {
UNIMPLEMENTED();
}
-int internal_isatty(fd_t fd) {
- return _isatty(fd);
-}
-
fd_t OpenFile(const char *filename, FileAccessMode mode, error_t *last_error) {
UNIMPLEMENTED();
}
+bool SupportsColoredOutput(fd_t fd) {
+ // FIXME: support colored output.
+ return false;
+}
+
uptr internal_read(fd_t fd, void *buf, uptr count) {
UNIMPLEMENTED();
}
More information about the llvm-commits
mailing list