[llvm-commits] [llvm] r111339 - /llvm/trunk/lib/Support/raw_ostream.cpp
Dan Gohman
gohman at apple.com
Tue Aug 17 18:34:52 PDT 2010
Author: djg
Date: Tue Aug 17 20:34:52 2010
New Revision: 111339
URL: http://llvm.org/viewvc/llvm-project?rev=111339&view=rev
Log:
Revert r111321. This doesn't fix a problem.
Modified:
llvm/trunk/lib/Support/raw_ostream.cpp
Modified: llvm/trunk/lib/Support/raw_ostream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=111339&r1=111338&r2=111339&view=diff
==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Tue Aug 17 20:34:52 2010
@@ -415,32 +415,16 @@
raw_fd_ostream::~raw_fd_ostream() {
if (FD < 0) return;
- if (!ShouldClose) {
- flush();
- return;
- }
-
- bool HadError = has_error();
- close();
-
- // If we had a failure closing the stream, there is no way for the client to
- // handle it, just eat the failure.
- if (!HadError && has_error())
- clear_error();
-}
-
-void raw_fd_ostream::close() {
- assert(ShouldClose);
- ShouldClose = false;
flush();
- while (::close(FD) != 0)
- if (errno != EINTR) {
- error_detected();
- break;
- }
- FD = -1;
+ if (ShouldClose)
+ while (::close(FD) != 0)
+ if (errno != EINTR) {
+ error_detected();
+ break;
+ }
}
+
void raw_fd_ostream::write_impl(const char *Ptr, size_t Size) {
assert(FD >= 0 && "File already closed.");
pos += Size;
@@ -477,6 +461,18 @@
} while (Size > 0);
}
+void raw_fd_ostream::close() {
+ assert(ShouldClose);
+ ShouldClose = false;
+ flush();
+ while (::close(FD) != 0)
+ if (errno != EINTR) {
+ error_detected();
+ break;
+ }
+ FD = -1;
+}
+
uint64_t raw_fd_ostream::seek(uint64_t off) {
flush();
pos = ::lseek(FD, off, SEEK_SET);
More information about the llvm-commits
mailing list