From 8f7be4731e979255c54eb8951b7a06ed4fd6ce45 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Mon, 20 Apr 2009 07:34:17 +0000 Subject: Make all raw_ostreams support the tell() function. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@69583 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/raw_ostream.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib') diff --git a/lib/Support/raw_ostream.cpp b/lib/Support/raw_ostream.cpp index f62a31d..6ac37bc 100644 --- a/lib/Support/raw_ostream.cpp +++ b/lib/Support/raw_ostream.cpp @@ -339,6 +339,12 @@ void raw_os_ostream::write_impl(const char *Ptr, unsigned Size) { OS.write(Ptr, Size); } +uint64_t raw_os_ostream::current_pos() { return OS.tellp(); } + +uint64_t raw_os_ostream::tell() { + return (uint64_t)OS.tellp() + GetNumBytesInBuffer(); +} + //===----------------------------------------------------------------------===// // raw_string_ostream //===----------------------------------------------------------------------===// @@ -363,3 +369,8 @@ void raw_svector_ostream::write_impl(const char *Ptr, unsigned Size) { OS.append(Ptr, Ptr + Size); } +uint64_t raw_svector_ostream::current_pos() { return OS.size(); } + +uint64_t raw_svector_ostream::tell() { + return OS.size() + GetNumBytesInBuffer(); +} -- cgit v1.1