[llvm-commits] [llvm] r78924 - in /llvm/trunk: include/llvm/Support/raw_ostream.h lib/Support/raw_ostream.cpp
Dan Gohman
gohman at apple.com
Thu Aug 13 10:41:40 PDT 2009
Author: djg
Date: Thu Aug 13 12:41:40 2009
New Revision: 78924
URL: http://llvm.org/viewvc/llvm-project?rev=78924&view=rev
Log:
Set raw_os_ostream, raw_string_ostream, and raw_svector_ostream to be
unbuffered. std::ostream does its own buffering, and std::string and
SmallVector both have allocation strategies intended to handle frequent
appending.
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=78924&r1=78923&r2=78924&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/raw_ostream.h (original)
+++ llvm/trunk/include/llvm/Support/raw_ostream.h Thu Aug 13 12:41:40 2009
@@ -376,8 +376,7 @@
virtual uint64_t current_pos();
public:
- raw_os_ostream(std::ostream &O) : OS(O) {}
- ~raw_os_ostream();
+ raw_os_ostream(std::ostream &O) : raw_ostream(true), OS(O) {}
/// tell - Return the current offset with the stream.
uint64_t tell();
@@ -395,8 +394,7 @@
/// counting the bytes currently in the buffer.
virtual uint64_t current_pos() { return OS.size(); }
public:
- explicit raw_string_ostream(std::string &O) : OS(O) {}
- ~raw_string_ostream();
+ explicit raw_string_ostream(std::string &O) : raw_ostream(true), OS(O) {}
/// tell - Return the current offset with the stream.
uint64_t tell() { return OS.size() + GetNumBytesInBuffer(); }
@@ -422,8 +420,8 @@
/// counting the bytes currently in the buffer.
virtual uint64_t current_pos();
public:
- explicit raw_svector_ostream(SmallVectorImpl<char> &O) : OS(O) {}
- ~raw_svector_ostream();
+ explicit raw_svector_ostream(SmallVectorImpl<char> &O)
+ : raw_ostream(true), OS(O) {}
/// tell - Return the current offset with the stream.
uint64_t tell();
Modified: llvm/trunk/lib/Support/raw_ostream.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/raw_ostream.cpp?rev=78924&r1=78923&r2=78924&view=diff
==============================================================================
--- llvm/trunk/lib/Support/raw_ostream.cpp (original)
+++ llvm/trunk/lib/Support/raw_ostream.cpp Thu Aug 13 12:41:40 2009
@@ -441,10 +441,6 @@
// raw_os_ostream
//===----------------------------------------------------------------------===//
-raw_os_ostream::~raw_os_ostream() {
- flush();
-}
-
void raw_os_ostream::write_impl(const char *Ptr, size_t Size) {
OS.write(Ptr, Size);
}
@@ -459,10 +455,6 @@
// raw_string_ostream
//===----------------------------------------------------------------------===//
-raw_string_ostream::~raw_string_ostream() {
- flush();
-}
-
void raw_string_ostream::write_impl(const char *Ptr, size_t Size) {
OS.append(Ptr, Size);
}
@@ -471,10 +463,6 @@
// raw_svector_ostream
//===----------------------------------------------------------------------===//
-raw_svector_ostream::~raw_svector_ostream() {
- flush();
-}
-
void raw_svector_ostream::write_impl(const char *Ptr, size_t Size) {
OS.append(Ptr, Ptr + Size);
}
More information about the llvm-commits
mailing list