[llvm-commits] [llvm] r63044 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp
Ted Kremenek
kremenek at apple.com
Mon Jan 26 13:42:04 PST 2009
Author: kremenek
Date: Mon Jan 26 15:42:04 2009
New Revision: 63044
URL: http://llvm.org/viewvc/llvm-project?rev=63044&view=rev
Log:
Add method raw_fd_ostream::seek() for random access within a file.
Modified:
llvm/trunk/include/llvm/Support/raw_ostream.h
llvm/trunk/lib/Support/raw_ostream.cpp
Modified: llvm/trunk/include/llvm/Support/raw_ostream.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/raw_ostream.h?rev=63044&r1=63043&r2=63044&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/raw_ostream.h (original)
+++ llvm/trunk/include/llvm/Support/raw_ostream.h Mon Jan 26 15:42:04 2009
@@ -181,7 +181,11 @@
/// tell - Return the current offset with the file.
uint64_t tell() {
return pos + (OutBufCur - OutBufStart);
- }
+ }
+
+ /// seek - Flushes the stream and repositions the underlying file descriptor
+ /// positition to the offset specified from the beginning of the file.
+ uint64_t seek(uint64_t off);
};
/// raw_stdout_ostream - This is a stream that always prints to stdout.
Modified: llvm/trunk/lib/Support/raw_ostream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=63044&r1=63043&r2=63044&view=diff
==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Mon Jan 26 15:42:04 2009
@@ -255,6 +255,12 @@
FD = -1;
}
+uint64_t raw_fd_ostream::seek(uint64_t off) {
+ flush();
+ pos = lseek(FD, off, SEEK_SET);
+ return pos;
+}
+
//===----------------------------------------------------------------------===//
// raw_stdout/err_ostream
//===----------------------------------------------------------------------===//
More information about the llvm-commits
mailing list