<div dir="ltr">On 10 September 2013 17:45, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Author: ruiu<br>
Date: Tue Sep 10 19:45:48 2013<br>
New Revision: 190469<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=190469&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=190469&view=rev</a><br>
Log:<br>
YAMLIO: Fix string quoting logic.<br>
<br>
YAMLIO printed a string as is without quotes unless it contains a newline<br>
character. That did not suffice. We also need to quote a string if it starts<br>
with a backquote, quote, double quote or atsign, or it's the empty string.<br></blockquote><div><br></div><div>This broke clang-modernize tests which have *_expected.yaml golden files:</div><div><br></div><div> <a href="http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-modernize/HeaderReplacements/">http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/test/clang-modernize/HeaderReplacements/</a><br>
</div><div><br></div><div>as well as tools/clang/unittests/Tooling/ReplacementsYamlTest.cpp:</div><div><br></div><div><div>[ RUN ] ReplacementsYamlTest.serializesReplacements</div><div>tools/clang/unittests/Tooling/ReplacementsYamlTest.cpp:51: Failure</div>
<div>Value of: YamlContentStream.str().c_str()</div><div> Actual: "---</div><div>MainSourceFile: '"/path/to/source.cpp"'</div><div>Context: '"some context"'</div><div>Replacements: </div>
<div> - FilePath: '"/path/to/file1.h"'</div><div> Offset: 232</div><div> Length: 56</div><div> ReplacementText: '"replacement #1"'</div><div> - FilePath: '"/path/to/file2.h"'</div>
<div> Offset: 301</div><div> Length: 2</div><div> ReplacementText: '"replacement #2"'</div><div>...</div><div>"</div><div>Expected: "---\n" "MainSourceFile: \"/path/to/source.cpp\"\n" "Context: \"some context\"\n" "Replacements: \n" " - FilePath: \"/pat</div>
<div>h/to/file1.h\"\n" " Offset: 232\n" " Length: 56\n" " ReplacementText: \"replacement #1\"\n" " - FilePath: \"/path/to</div>
<div>/file2.h\"\n" " Offset: 301\n" " Length: 2\n" " ReplacementText: \"replacement #2\"\n" "...\n"</div><div>Which is: "---</div>
<div>MainSourceFile: "/path/to/source.cpp"</div><div>Context: "some context"</div><div>Replacements: </div><div> - FilePath: "/path/to/file1.h"</div><div> Offset: 232</div>
<div> Length: 56</div><div> ReplacementText: "replacement #1"</div><div> - FilePath: "/path/to/file2.h"</div><div> Offset: 301</div><div> Length: 2</div>
<div>
ReplacementText: "replacement #2"</div><div>...</div><div>"</div><div>[ FAILED ] ReplacementsYamlTest.serializesReplacements (0 ms)</div></div><div><br></div><div>Nick</div><div><br></div></div></div>
</div>