[llvm] r204312 - Object: Don't double-escape empty hexdata

David Majnemer david.majnemer at gmail.com
Wed Mar 19 23:28:52 PDT 2014


Author: majnemer
Date: Thu Mar 20 01:28:52 2014
New Revision: 204312

URL: http://llvm.org/viewvc/llvm-project?rev=204312&view=rev
Log:
Object: Don't double-escape empty hexdata

We would emit a pair of double quotes inside a pair of single quotes.
Just use a pair of single quotes.

Modified:
    llvm/trunk/lib/Object/YAML.cpp
    llvm/trunk/unittests/Object/YAMLTest.cpp

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

Modified: llvm/trunk/unittests/Object/YAMLTest.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Object/YAMLTest.cpp?rev=204312&r1=204311&r2=204312&view=diff
==============================================================================
--- llvm/trunk/unittests/Object/YAMLTest.cpp (original)
+++ llvm/trunk/unittests/Object/YAMLTest.cpp Thu Mar 20 01:28:52 2014
@@ -34,5 +34,5 @@ TEST(ObjectYAML, BinaryRef) {
   llvm::raw_svector_ostream OS(Buf);
   yaml::Output YOut(OS);
   YOut << BH;
-  EXPECT_NE(OS.str().find("\"\""), StringRef::npos);
+  EXPECT_NE(OS.str().find("''"), StringRef::npos);
 }





More information about the llvm-commits mailing list