Revert "Introduce a string_ostream string builder facilty"
[oota-llvm.git] / lib / LTO / LTOCodeGenerator.cpp
index d87299b5c783ce6f70e42b34cc07570e597ebfaf..a1709f60fff219adac9c949ac2b79b936ab3ab5d 100644 (file)
@@ -549,17 +549,16 @@ void LTOCodeGenerator::DiagnosticHandler2(const DiagnosticInfo &DI) {
     break;
   }
   // Create the string that will be reported to the external diagnostic handler.
-  string_ostream Msg;
-  DiagnosticPrinterRawOStream DP(Msg);
+  std::string MsgStorage;
+  raw_string_ostream Stream(MsgStorage);
+  DiagnosticPrinterRawOStream DP(Stream);
   DI.print(DP);
-
-  // Null-terminate the C string.
-  Msg << '\0';
+  Stream.flush();
 
   // If this method has been called it means someone has set up an external
   // diagnostic handler. Assert on that.
   assert(DiagHandler && "Invalid diagnostic handler");
-  (*DiagHandler)(Severity, Msg.str().data(), DiagContext);
+  (*DiagHandler)(Severity, MsgStorage.c_str(), DiagContext);
 }
 
 void