[llvm] ac48b18 - [Support] Change isatty to is_displayed
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 16 18:28:03 PDT 2020
Author: Douglas Gliner
Date: 2020-03-16T18:27:43-07:00
New Revision: ac48b1885ad8582b1acbe942250b37d5115246b5
URL: https://github.com/llvm/llvm-project/commit/ac48b1885ad8582b1acbe942250b37d5115246b5
DIFF: https://github.com/llvm/llvm-project/commit/ac48b1885ad8582b1acbe942250b37d5115246b5.diff
LOG: [Support] Change isatty to is_displayed
Currently, when building with the Unix support library and `isatty` does
not exist for the target platform (i.e. `HAVE_ISATTY` is false),
compilation of the file `raw_ostream.cpp` will fail due to direct use of
`isatty` in the function `raw_fd_ostream::preferred_buffer_size()`.
Use is_displayed() to fix the problem.
Reviewed By: probinson, MaskRay
Differential Revision: https://reviews.llvm.org/D75278
Added:
Modified:
llvm/lib/Support/raw_ostream.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
index 13b0203ac953..7e9428e5dbc9 100644
--- a/llvm/lib/Support/raw_ostream.cpp
+++ b/llvm/lib/Support/raw_ostream.cpp
@@ -792,7 +792,7 @@ size_t raw_fd_ostream::preferred_buffer_size() const {
// If this is a terminal, don't use buffering. Line buffering
// would be a more traditional thing to do, but it's not worth
// the complexity.
- if (S_ISCHR(statbuf.st_mode) && isatty(FD))
+ if (S_ISCHR(statbuf.st_mode) && is_displayed())
return 0;
// Return the preferred block size.
return statbuf.st_blksize;
More information about the llvm-commits
mailing list