Add html::EscapeText for std::string; use this function to escape text in message bubbles.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48884 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/HTMLDiagnostics.cpp b/Driver/HTMLDiagnostics.cpp
index 65dd17c..93af223 100644
--- a/Driver/HTMLDiagnostics.cpp
+++ b/Driver/HTMLDiagnostics.cpp
@@ -117,8 +117,8 @@
std::ostringstream os;
const FileEntry* Entry = SMgr.getFileEntryForID(FileID);
- os << "<h1>" << Entry->getDir()->getName() << "/"
- << Entry->getName() << "</h1>\n";
+ os << "<h1>" << html::EscapeText(Entry->getDir()->getName())
+ << "/" << html::EscapeText(Entry->getName()) << "</h1>\n";
R.InsertStrBefore(SourceLocation::getFileLoc(FileID, 0), os.str());
}
@@ -200,7 +200,7 @@
<< "<div class=\"msg\" style=\"margin-left:"
<< ColNo << "ex\">";
- os << P.getString() << "</div></td></tr>";
+ os << html::EscapeText(P.getString()) << "</div></td></tr>";
// Insert the new html.