<div dir="ltr">Sean,<div><br></div><div>Yes, I remember that I ran into the issue with the empty string, that the empty section content dumped by obj2yaml couldn't be read back by yaml2obj. I remember that that's because the YAML writer prints out the empty string as '""' (double double quotes inside single quotes). I removed the double quotes by hand. I don't believe YAML representation of the empty string is '""' -- shouldn't it be just '' or ""?</div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Mar 31, 2014 at 10:26 AM, Sean Silva <span dir="ltr"><<a href="mailto:silvas@purdue.edu" target="_blank">silvas@purdue.edu</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">???<div><br></div><div>This doesn't make any sense. The emission of the empty quotes is there on purpose (hence the test case!) and actually was put there to fix a bug where BinaryRef::writeAsHex would emit an empty string, which is not a valid YAML scalar. If you want to just get a raw hex string, I would recommend segregating the previous functionality into a method writeAsHexScalar and add a new writeAsHexRaw with the behavior that you are wanting here.</div>


<div><br></div><div>Rui, were you the one that ran into the issue with the empty string and added this test case?</div><span class="HOEnZb"><font color="#888888">
<div><br></div><div>-- Sean Silva</div></font></span></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Mar 20, 2014 at 2:28 AM, David Majnemer <span dir="ltr"><<a href="mailto:david.majnemer@gmail.com" target="_blank">david.majnemer@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: majnemer<br>
Date: Thu Mar 20 01:28:52 2014<br>
New Revision: 204312<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=204312&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=204312&view=rev</a><br>
Log:<br>
Object: Don't double-escape empty hexdata<br>
<br>
We would emit a pair of double quotes inside a pair of single quotes.<br>
Just use a pair of single quotes.<br>
<br>
Modified:<br>
    llvm/trunk/lib/Object/YAML.cpp<br>
    llvm/trunk/unittests/Object/YAMLTest.cpp<br>
<br>
Modified: llvm/trunk/lib/Object/YAML.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/YAML.cpp?rev=204312&r1=204311&r2=204312&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Object/YAML.cpp?rev=204312&r1=204311&r2=204312&view=diff</a><br>



==============================================================================<br>
--- llvm/trunk/lib/Object/YAML.cpp (original)<br>
+++ llvm/trunk/lib/Object/YAML.cpp Thu Mar 20 01:28:52 2014<br>
@@ -51,10 +51,8 @@ void BinaryRef::writeAsBinary(raw_ostrea<br>
 }<br>
<br>
 void BinaryRef::writeAsHex(raw_ostream &OS) const {<br>
-  if (binary_size() == 0) {<br>
-    OS << "\"\"";<br>
+  if (binary_size() == 0)<br>
     return;<br>
-  }<br>
   if (DataIsHexString) {<br>
     OS.write((const char *)Data.data(), Data.size());<br>
     return;<br>
<br>
Modified: llvm/trunk/unittests/Object/YAMLTest.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Object/YAMLTest.cpp?rev=204312&r1=204311&r2=204312&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Object/YAMLTest.cpp?rev=204312&r1=204311&r2=204312&view=diff</a><br>



==============================================================================<br>
--- llvm/trunk/unittests/Object/YAMLTest.cpp (original)<br>
+++ llvm/trunk/unittests/Object/YAMLTest.cpp Thu Mar 20 01:28:52 2014<br>
@@ -34,5 +34,5 @@ TEST(ObjectYAML, BinaryRef) {<br>
   llvm::raw_svector_ostream OS(Buf);<br>
   yaml::Output YOut(OS);<br>
   YOut << BH;<br>
-  EXPECT_NE(OS.str().find("\"\""), StringRef::npos);<br>
+  EXPECT_NE(OS.str().find("''"), StringRef::npos);<br>
 }<br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>