aboutsummaryrefslogtreecommitdiff
path: root/lib/Support/raw_ostream.cpp
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2010-01-01 10:31:22 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2010-01-01 10:31:22 +0000
commit1e7804dbd25b8dbf534c850355d70ad215206f4b (patch)
treedba00119388b84f9f44e6ec5e9129f807fd79ca3 /lib/Support/raw_ostream.cpp
parent571945e6affd20b19264ec22495da418d0fbdbb4 (diff)
downloadsrc-1e7804dbd25b8dbf534c850355d70ad215206f4b.tar.gz
src-1e7804dbd25b8dbf534c850355d70ad215206f4b.zip
Update LLVM to 92395.
Notes
Notes: svn path=/vendor/llvm/dist/; revision=201360
Diffstat (limited to 'lib/Support/raw_ostream.cpp')
-rw-r--r--lib/Support/raw_ostream.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp
index 0c90e7720bf6..a820210f7bde 100644
--- a/lib/Support/raw_ostream.cpp
+++ b/lib/Support/raw_ostream.cpp
@@ -67,7 +67,7 @@ raw_ostream::~raw_ostream() {
// An out of line virtual method to provide a home for the class vtable.
void raw_ostream::handle() {}
-size_t raw_ostream::preferred_buffer_size() {
+size_t raw_ostream::preferred_buffer_size() const {
// BUFSIZ is intended to be a reasonable default.
return BUFSIZ;
}
@@ -440,20 +440,20 @@ uint64_t raw_fd_ostream::seek(uint64_t off) {
return pos;
}
-size_t raw_fd_ostream::preferred_buffer_size() {
+size_t raw_fd_ostream::preferred_buffer_size() const {
#if !defined(_MSC_VER) && !defined(__MINGW32__) // Windows has no st_blksize.
assert(FD >= 0 && "File not yet open!");
struct stat statbuf;
- if (fstat(FD, &statbuf) == 0) {
- // 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))
- return 0;
- // Return the preferred block size.
- return statbuf.st_blksize;
- }
- error_detected();
+ if (fstat(FD, &statbuf) != 0)
+ return 0;
+
+ // 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))
+ return 0;
+ // Return the preferred block size.
+ return statbuf.st_blksize;
#endif
return raw_ostream::preferred_buffer_size();
}
@@ -578,7 +578,9 @@ void raw_svector_ostream::write_impl(const char *Ptr, size_t Size) {
SetBuffer(OS.end(), OS.capacity() - OS.size());
}
-uint64_t raw_svector_ostream::current_pos() { return OS.size(); }
+uint64_t raw_svector_ostream::current_pos() const {
+ return OS.size();
+}
StringRef raw_svector_ostream::str() {
flush();
@@ -601,6 +603,6 @@ raw_null_ostream::~raw_null_ostream() {
void raw_null_ostream::write_impl(const char *Ptr, size_t Size) {
}
-uint64_t raw_null_ostream::current_pos() {
+uint64_t raw_null_ostream::current_pos() const {
return 0;
}