diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-12-04 22:51:11 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-12-04 22:51:11 +0000 |
commit | d75ba1c3573d3d5146d0abe8cb376dca94be94d5 (patch) | |
tree | d2f045344a0b9494765f500cedc90e8d779c13ee /include/llvm/Support/raw_ostream.h | |
parent | 4d6e2331c329fe6d2b80f61b0c49f55f73e4f8e5 (diff) | |
download | llvm-d75ba1c3573d3d5146d0abe8cb376dca94be94d5.tar.gz llvm-d75ba1c3573d3d5146d0abe8cb376dca94be94d5.tar.bz2 llvm-d75ba1c3573d3d5146d0abe8cb376dca94be94d5.tar.xz |
Have raw_fd_ostream keep track of the position in the file to make tell() go faster by not requiring a flush().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60560 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/raw_ostream.h')
-rw-r--r-- | include/llvm/Support/raw_ostream.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/llvm/Support/raw_ostream.h b/include/llvm/Support/raw_ostream.h index 2b4b17d7b2..1a4f6bf6f4 100644 --- a/include/llvm/Support/raw_ostream.h +++ b/include/llvm/Support/raw_ostream.h @@ -151,6 +151,7 @@ private: class raw_fd_ostream : public raw_ostream { int FD; bool ShouldClose; + uint64_t pos; public: /// raw_fd_ostream - Open the specified file for writing. If an /// error occurs, information about the error is put into ErrorInfo, @@ -178,7 +179,9 @@ public: void close(); /// tell - Return the current offset with the file. - uint64_t tell(); + uint64_t tell() { + return pos + (OutBufCur - OutBufStart); + } }; /// raw_stdout_ostream - This is a stream that always prints to stdout. |