DebugInfo: Shrink pubnames/pubtypes in the presence of type units by only emitting...
[oota-llvm.git] / lib / Object / YAML.cpp
index 4e7f0890989bcc7dff1da07ac712babe1d8fbfdd..c527bde090e8e6ea2127695e4063628e42427129 100644 (file)
@@ -13,7 +13,9 @@
 //===----------------------------------------------------------------------===//
 
 #include "llvm/Object/YAML.h"
+#include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/raw_ostream.h"
+#include <cctype>
 
 using namespace llvm;
 using namespace object::yaml;
@@ -49,6 +51,10 @@ void BinaryRef::writeAsBinary(raw_ostream &OS) const {
 }
 
 void BinaryRef::writeAsHex(raw_ostream &OS) const {
+  if (binary_size() == 0) {
+    OS << "\"\"";
+    return;
+  }
   if (DataIsHexString) {
     OS.write((const char *)Data.data(), Data.size());
     return;