From 8bd2799a2d1e260a7908eb5ed3d5cfa39ad106bb Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Thu, 20 Mar 2014 06:28:52 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204312 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Object/YAML.cpp | 4 +--- unittests/Object/YAMLTest.cpp | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/Object/YAML.cpp b/lib/Object/YAML.cpp index c527bde090e..61e9da30395 100644 --- a/lib/Object/YAML.cpp +++ b/lib/Object/YAML.cpp @@ -51,10 +51,8 @@ void BinaryRef::writeAsBinary(raw_ostream &OS) const { } 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; diff --git a/unittests/Object/YAMLTest.cpp b/unittests/Object/YAMLTest.cpp index 3ae92ae1bae..1eb1113ae6b 100644 --- a/unittests/Object/YAMLTest.cpp +++ b/unittests/Object/YAMLTest.cpp @@ -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); } -- 2.11.0