<div dir="ltr">test?</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 15, 2015 at 11:39 AM, Daniel Jasper via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: djasper<br>
Date: Thu Oct 15 13:39:31 2015<br>
New Revision: 250440<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=250440&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=250440&view=rev</a><br>
Log:<br>
clang-format: Basic escaping when outputting XML.<br>
<br>
Modified:<br>
cfe/trunk/tools/clang-format/ClangFormat.cpp<br>
<br>
Modified: cfe/trunk/tools/clang-format/ClangFormat.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/ClangFormat.cpp?rev=250440&r1=250439&r2=250440&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/ClangFormat.cpp?rev=250440&r1=250439&r2=250440&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/tools/clang-format/ClangFormat.cpp (original)<br>
+++ cfe/trunk/tools/clang-format/ClangFormat.cpp Thu Oct 15 13:39:31 2015<br>
@@ -199,9 +199,11 @@ static bool fillRanges(MemoryBuffer *Cod<br>
}<br>
<br>
static void outputReplacementXML(StringRef Text) {<br>
+ // FIXME: When we sort includes, we need to make sure the stream is correct<br>
+ // utf-8.<br>
size_t From = 0;<br>
size_t Index;<br>
- while ((Index = Text.find_first_of("\n\r", From)) != StringRef::npos) {<br>
+ while ((Index = Text.find_first_of("\n\r<&", From)) != StringRef::npos) {<br>
llvm::outs() << Text.substr(From, Index - From);<br>
switch (Text[Index]) {<br>
case '\n':<br>
@@ -210,6 +212,12 @@ static void outputReplacementXML(StringR<br>
case '\r':<br>
llvm::outs() << " ";<br>
break;<br>
+ case '<':<br>
+ llvm::outs() << "<";<br>
+ break;<br>
+ case '&':<br>
+ llvm::outs() << "&";<br>
+ break;<br>
default:<br>
llvm_unreachable("Unexpected character encountered!");<br>
}<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>