[PATCH] D115421: [Support] No longer require .flush()ing raw_string_ostream

Logan Smith via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 9 12:49:58 PST 2021


logan-5 added inline comments.


================
Comment at: llvm/include/llvm/Support/raw_ostream.h:644-645
 
-  /// Flushes the stream contents to the target string and returns  the string's
-  /// reference.
-  std::string& str() {
-    flush();
-    return OS;
-  }
+  /// Returns the string's reference.
+  std::string &str() { return OS; }
 
----------------
dexonsmith wrote:
> I wonder if this API should be deleted entirely? (not in this commit) -- in which case, could land just the change to the destructor here, then delete callers, then delete this.
N.B. `raw_svector_ostream` has `str()` that returns `StringRef`, which appears to be useful in places. We could keep this for API parity, but change it to return `StringRef` to discourage using it to initialize `std::string`s.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D115421/new/

https://reviews.llvm.org/D115421



More information about the llvm-commits mailing list