diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2015-04-13 11:09:48 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2015-04-13 11:09:48 +0000 |
commit | a9b84abba8919e1ae36ffefbdb1e1dafa258630e (patch) | |
tree | 71f0f4bb89cc298c8c988a3035d080d2e7697fd0 /llvm/lib/Support | |
parent | 2a76f41511dfeecf322ff780b14bdf93c9953716 (diff) | |
download | bcm5719-llvm-a9b84abba8919e1ae36ffefbdb1e1dafa258630e.tar.gz bcm5719-llvm-a9b84abba8919e1ae36ffefbdb1e1dafa258630e.zip |
Fix SupportsSeeking detection on windows.
Will be tested by existing tests once used (soon).
llvm-svn: 234737
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r-- | llvm/lib/Support/raw_ostream.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp index b8588af702b..16c52c90e09 100644 --- a/llvm/lib/Support/raw_ostream.cpp +++ b/llvm/lib/Support/raw_ostream.cpp @@ -525,7 +525,14 @@ raw_fd_ostream::raw_fd_ostream(int fd, bool shouldClose, bool unbuffered) // Get the starting position. off_t loc = ::lseek(FD, 0, SEEK_CUR); +#ifdef LLVM_ON_WIN32 + // MSVCRT's _lseek(SEEK_CUR) doesn't return -1 for pipes. + sys::fs::file_status Status; + std::error_code EC = status(FD, Status); + SupportsSeeking = !EC && Status.type() == sys::fs::file_type::regular_file; +#else SupportsSeeking = loc != (off_t)-1; +#endif if (!SupportsSeeking) pos = 0; else |