llvm.org GIT mirror llvm / 5984680
Add 'tell' method to raw_fd_ostream that clients can use to query the current location in the file the stream is writing to. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60085 91177308-0d34-0410-b5e6-96231b3b80d8 Ted Kremenek 11 years ago
2 changed file(s) with 12 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
174174 virtual void flush_impl();
175175
176176 /// close - Manually flush the stream and close the file.
177 void close();
177 void close();
178
179 /// tell - Return the current offset with the file.
180 uint64_t tell();
178181 };
179182
180183 /// raw_stdout_ostream - This is a stream that always prints to stdout.
252252 FD = -1;
253253 }
254254
255 uint64_t raw_fd_ostream::tell() {
256 // We have to take into account the bytes waiting in the buffer. For now
257 // we do the easy thing and just flush the buffer before getting the
258 // current file offset.
259 flush();
260 return (uint64_t) lseek(FD, 0, SEEK_CUR);
261 }
262
255263 //===----------------------------------------------------------------------===//
256264 // raw_stdout/err_ostream
257265 //===----------------------------------------------------------------------===//