r250440 - clang-format: Basic escaping when outputting XML.
Nico Weber via cfe-commits
cfe-commits at lists.llvm.org
Thu Oct 15 11:43:35 PDT 2015
test?
On Thu, Oct 15, 2015 at 11:39 AM, Daniel Jasper via cfe-commits <
cfe-commits at lists.llvm.org> wrote:
> Author: djasper
> Date: Thu Oct 15 13:39:31 2015
> New Revision: 250440
>
> URL: http://llvm.org/viewvc/llvm-project?rev=250440&view=rev
> Log:
> clang-format: Basic escaping when outputting XML.
>
> Modified:
> cfe/trunk/tools/clang-format/ClangFormat.cpp
>
> Modified: cfe/trunk/tools/clang-format/ClangFormat.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/ClangFormat.cpp?rev=250440&r1=250439&r2=250440&view=diff
>
> ==============================================================================
> --- cfe/trunk/tools/clang-format/ClangFormat.cpp (original)
> +++ cfe/trunk/tools/clang-format/ClangFormat.cpp Thu Oct 15 13:39:31 2015
> @@ -199,9 +199,11 @@ static bool fillRanges(MemoryBuffer *Cod
> }
>
> 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(StringR
> case '\r':
> llvm::outs() << "
";
> break;
> + case '<':
> + llvm::outs() << "<";
> + break;
> + case '&':
> + llvm::outs() << "&";
> + break;
> default:
> llvm_unreachable("Unexpected character encountered!");
> }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151015/f05c5a87/attachment.html>
More information about the cfe-commits
mailing list