summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-08-26 16:34:01 +0000
committerTed Kremenek <kremenek@apple.com>2008-08-26 16:34:01 +0000
commit2e75d8aed0abc610d01ffa761113cd19d8210a68 (patch)
treec5e6f1883f4dabb805e5e150459b9ef1fd6085f0
parent89654eef3a96d32ea9f82d07a1cc495a4f6437dc (diff)
downloadbcm5719-llvm-2e75d8aed0abc610d01ffa761113cd19d8210a68.tar.gz
bcm5719-llvm-2e75d8aed0abc610d01ffa761113cd19d8210a68.zip
Added "str()" method to raw_string_ostream.
str() mirrors the same method in std::ostringstream. str() flushes the buffered stream contents to string and returns a reference to the string. llvm-svn: 55370
-rw-r--r--llvm/include/llvm/Support/raw_ostream.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/include/llvm/Support/raw_ostream.h b/llvm/include/llvm/Support/raw_ostream.h
index 824d209189c..3cb8a3e317e 100644
--- a/llvm/include/llvm/Support/raw_ostream.h
+++ b/llvm/include/llvm/Support/raw_ostream.h
@@ -219,6 +219,13 @@ public:
raw_string_ostream(std::string &O) : OS(O) {}
~raw_string_ostream();
+ /// str - Flushes the stream contents to the target string and returns
+ /// the strings reference.
+ std::string& str() {
+ flush();
+ return OS;
+ }
+
/// flush_impl - The is the piece of the class that is implemented by
/// subclasses. This outputs the currently buffered data and resets the
/// buffer to empty.
OpenPOWER on IntegriCloud