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
This commit is contained in:
Douglas Gregor
2009-04-20 07:34:17 +00:00
parent 428098de62
commit 8f7be4731e
2 changed files with 45 additions and 0 deletions
+11
View File
@@ -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();
}