clang-format: Basic escaping when outputting XML.
llvm-svn: 250440
This commit is contained in:
parent
b860289dbd
commit
f39757d0c0
|
@ -199,9 +199,11 @@ static bool fillRanges(MemoryBuffer *Code,
|
|||
}
|
||||
|
||||
static void outputReplacementXML(StringRef Text) {
|
||||
// FIXME: When we sort includes, we need to make sure the stream is correct
|
||||
// utf-8.
|
||||
size_t From = 0;
|
||||
size_t Index;
|
||||
while ((Index = Text.find_first_of("\n\r", From)) != StringRef::npos) {
|
||||
while ((Index = Text.find_first_of("\n\r<&", From)) != StringRef::npos) {
|
||||
llvm::outs() << Text.substr(From, Index - From);
|
||||
switch (Text[Index]) {
|
||||
case '\n':
|
||||
|
@ -210,6 +212,12 @@ static void outputReplacementXML(StringRef Text) {
|
|||
case '\r':
|
||||
llvm::outs() << " ";
|
||||
break;
|
||||
case '<':
|
||||
llvm::outs() << "<";
|
||||
break;
|
||||
case '&':
|
||||
llvm::outs() << "&";
|
||||
break;
|
||||
default:
|
||||
llvm_unreachable("Unexpected character encountered!");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue