test?

On Thu, Oct 15, 2015 at 11:39 AM, Daniel Jasper via cfe-commits <
cfe-commits@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() << "&#13;";
>        break;
> +    case '<':
> +      llvm::outs() << "&lt;";
> +      break;
> +    case '&':
> +      llvm::outs() << "&amp;";
> +      break;
>      default:
>        llvm_unreachable("Unexpected character encountered!");
>      }
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to