summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/StringExtras.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Support/StringExtras.cpp')
-rw-r--r--llvm/lib/Support/StringExtras.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Support/StringExtras.cpp b/llvm/lib/Support/StringExtras.cpp
index f4933150d28..d8f8ff4f604 100644
--- a/llvm/lib/Support/StringExtras.cpp
+++ b/llvm/lib/Support/StringExtras.cpp
@@ -68,6 +68,23 @@ void llvm::PrintEscapedString(StringRef Name, raw_ostream &Out) {
}
}
+void llvm::PrintHTMLEscaped(StringRef String, raw_ostream &Out) {
+ for (char C : String) {
+ if (C == '&')
+ Out << "&amp;";
+ else if (C == '<')
+ Out << "&lt;";
+ else if (C == '>')
+ Out << "&gt;";
+ else if (C == '\"')
+ Out << "&quot;";
+ else if (C == '\'')
+ Out << "&apos;";
+ else
+ Out << C;
+ }
+}
+
void llvm::printLowerCase(StringRef String, raw_ostream &Out) {
for (const char C : String)
Out << toLower(C);
OpenPOWER on IntegriCloud