[llvm-commits] [llvm] r63044 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp

Chris Lattner clattner at apple.com
Mon Jan 26 15:56:26 PST 2009


On Jan 26, 2009, at 1:42 PM, Ted Kremenek wrote:

> 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.

Huh?  But now it's not a stream!  I guess it is ok as long as only  
raw_fd_ostream has this and not all raw_ostreams do.

-Chris

>
>
> 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
> // 
> = 
> = 
> = 
> ----------------------------------------------------------------------= 
> ==//
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list