aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-19 18:40:58 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-19 18:40:58 +0000
commitd14787e49777888eb7c685c0d5803044e7b7971a (patch)
tree29aae6c3c19c2f7383eb9c851db0ddb7161d9caf /include/llvm
parentc21d5883acb7635635bb449dd8e439fa15a91bf6 (diff)
downloadexternal_llvm-d14787e49777888eb7c685c0d5803044e7b7971a.zip
external_llvm-d14787e49777888eb7c685c0d5803044e7b7971a.tar.gz
external_llvm-d14787e49777888eb7c685c0d5803044e7b7971a.tar.bz2
Change raw_svector_ostream to reserve the input buffer if necessary, Ted was
right. - This class turns out to be much more convenient to use if we do this; clients can make sure the buffer is always big enough if they care (since our current idiom tends to be to use a SmallString<256> for the input to this we should generally be avoiding an unnecessary malloc). Also, add a convenience raw_svector_ostream::str method which flushes the buffer and returns a StringRef for the vector contents. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79446 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/Support/raw_ostream.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/llvm/Support/raw_ostream.h b/include/llvm/Support/raw_ostream.h
index ed06dbf..dc496d4 100644
--- a/include/llvm/Support/raw_ostream.h
+++ b/include/llvm/Support/raw_ostream.h
@@ -454,10 +454,14 @@ class raw_svector_ostream : public raw_ostream {
public:
/// Construct a new raw_svector_ostream.
///
- /// \arg O - The vector to write to; this *must* have at least 128 bytes of
- /// free space in it.
+ /// \arg O - The vector to write to; this should generally have at least 128
+ /// bytes free to avoid any extraneous memory overhead.
explicit raw_svector_ostream(SmallVectorImpl<char> &O);
~raw_svector_ostream();
+
+ /// str - Flushes the stream contents to the target vector and return a
+ /// StringRef for the vector contents.
+ StringRef str();
};
/// raw_null_ostream - A raw_ostream that discards all output.