aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/llvm/Support/raw_ostream.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/Support/raw_ostream.h b/include/llvm/Support/raw_ostream.h
index 824d209189..3cb8a3e317 100644
--- a/include/llvm/Support/raw_ostream.h
+++ b/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.