diff --git a/llvm/include/llvm/Support/raw_ostream.h b/llvm/include/llvm/Support/raw_ostream.h --- a/llvm/include/llvm/Support/raw_ostream.h +++ b/llvm/include/llvm/Support/raw_ostream.h @@ -507,9 +507,7 @@ /// See raw_ostream::write_impl. void write_impl(const char *Ptr, size_t Size) override; - /// Return the current position within the stream, not counting the bytes - /// currently in the buffer. - uint64_t current_pos() const override { return OS.size(); } + uint64_t current_pos() const override; public: explicit raw_string_ostream(std::string &O) : OS(O) {} diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp --- a/llvm/lib/Support/raw_ostream.cpp +++ b/llvm/lib/Support/raw_ostream.cpp @@ -895,6 +895,10 @@ // raw_string_ostream //===----------------------------------------------------------------------===// +/// Return the current position within the stream, not counting the bytes +/// currently in the buffer. +uint64_t raw_string_ostream::current_pos() const { return OS.size(); } + raw_string_ostream::~raw_string_ostream() { flush(); }