mirror of
https://github.com/RPCS3/llvm.git
synced 2026-07-19 23:23:38 -04:00
[dsymutil] Escape HTML special characters in plist.
When printing string in the Plist, we weren't escaping the characters which lead to invalid XML. This patch adds the escape logic to StringExtras. rdar://39785334 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@333565 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -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 << "&";
|
||||
else if (C == '<')
|
||||
Out << "<";
|
||||
else if (C == '>')
|
||||
Out << ">";
|
||||
else if (C == '\"')
|
||||
Out << """;
|
||||
else if (C == '\'')
|
||||
Out << "'";
|
||||
else
|
||||
Out << C;
|
||||
}
|
||||
}
|
||||
|
||||
void llvm::printLowerCase(StringRef String, raw_ostream &Out) {
|
||||
for (const char C : String)
|
||||
Out << toLower(C);
|
||||
|
||||
Reference in New Issue
Block a user