Make BinaryRef output correctly in case of empty data.
Previously, it would simply output nothing, but it should output an
empty string `""`.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@185894 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Object/YAML.cpp b/lib/Object/YAML.cpp
index 4e7f089..5b66503 100644
--- a/lib/Object/YAML.cpp
+++ b/lib/Object/YAML.cpp
@@ -49,6 +49,10 @@
}
void BinaryRef::writeAsHex(raw_ostream &OS) const {
+ if (binary_size() == 0) {
+ OS << "\"\"";
+ return;
+ }
if (DataIsHexString) {
OS.write((const char *)Data.data(), Data.size());
return;