Patch by Csaba Hruska!
"Here is a patch what replaces std::ostream with llvm::raw_ostream. This patch
covers the AST library, but ignores Analysis lib."
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56185 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/HTMLDiagnostics.cpp b/lib/Driver/HTMLDiagnostics.cpp
index e691882..5025e87 100644
--- a/lib/Driver/HTMLDiagnostics.cpp
+++ b/lib/Driver/HTMLDiagnostics.cpp
@@ -23,9 +23,9 @@
#include "llvm/Support/Compiler.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Streams.h"
+#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Path.h"
#include <fstream>
-#include <sstream>
using namespace clang;
@@ -220,7 +220,8 @@
// Add the name of the file as an <h1> tag.
{
- std::ostringstream os;
+ std::string s;
+ llvm::raw_string_ostream os(s);
os << "<h3>Bug Summary</h3>\n<table class=\"simpletable\">\n"
"<tr><td class=\"rowname\">File:</td><td>"
@@ -252,26 +253,30 @@
const std::string& BugDesc = D.getDescription();
if (!BugDesc.empty()) {
- std::ostringstream os;
+ std::string s;
+ llvm::raw_string_ostream os(s);
os << "\n<!-- BUGDESC " << BugDesc << " -->\n";
R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str());
}
{
- std::ostringstream os;
+ std::string s;
+ llvm::raw_string_ostream os(s);
os << "\n<!-- BUGFILE " << DirName << Entry->getName() << " -->\n";
R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str());
}
{
- std::ostringstream os;
+ std::string s;
+ llvm::raw_string_ostream os(s);
os << "\n<!-- BUGLINE " << D.back()->getLocation().getLogicalLineNumber()
<< " -->\n";
R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str());
}
{
- std::ostringstream os;
+ std::string s;
+ llvm::raw_string_ostream os(s);
os << "\n<!-- BUGPATHLENGTH " << D.size() << " -->\n";
R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str());
}
@@ -365,7 +370,8 @@
// Create the html for the message.
- std::ostringstream os;
+ std::string s;
+ llvm::raw_string_ostream os(s);
os << "\n<tr><td class=\"num\"></td><td class=\"line\">"
<< "<div id=\"";