Re-commit "Use StringRef in Support/Darf APIs (NFC)"

This reverts commit r283285 and re-commit r283275 with
a fix for format("%s", Str); where Str is a StringRef.

llvm-svn: 283298
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
index 1a0b7e5..c2602ba 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
@@ -54,8 +54,10 @@
       OS << format("0x%8.8x ", dieRef);
       if (GnuStyle) {
         PubIndexEntryDescriptor desc(pubNames.getU8(&offset));
-        OS << format("%-8s", dwarf::GDBIndexEntryLinkageString(desc.Linkage))
-           << ' ' << format("%-8s", dwarf::GDBIndexEntryKindString(desc.Kind))
+        OS << format("%-8s",
+                     dwarf::GDBIndexEntryLinkageString(desc.Linkage).data())
+           << ' '
+           << format("%-8s", dwarf::GDBIndexEntryKindString(desc.Kind).data())
            << ' ';
       }
       OS << '\"' << pubNames.getCStr(&offset) << "\"\n";