[YAML] Add support for non-printable characters

LLVM IR function names which disable mangling start with '\01'
(https://www.llvm.org/docs/LangRef.html#identifiers).

When an identifier like "\01@abc@" gets dumped to MIR, it is quoted, but
only with single quotes.

http://www.yaml.org/spec/1.2/spec.html#id2770814:

"The allowed character range explicitly excludes the C0 control block
allowed), the surrogate block #xD800-#xDFFF, #xFFFE, and #xFFFF."

http://www.yaml.org/spec/1.2/spec.html#id2776092:

"All non-printable characters must be escaped.
[...]
Note that escape sequences are only interpreted in double-quoted scalars."

This patch adds support for printing escaped non-printable characters
between double quotes if needed.

Should also fix PR31743.

Differential Revision: https://reviews.llvm.org/D41290

llvm-svn: 320996
diff --git a/llvm/lib/ObjectYAML/MachOYAML.cpp b/llvm/lib/ObjectYAML/MachOYAML.cpp
index 85079f2..e00a4ea 100644
--- a/llvm/lib/ObjectYAML/MachOYAML.cpp
+++ b/llvm/lib/ObjectYAML/MachOYAML.cpp
@@ -52,7 +52,9 @@
   return StringRef();
 }
 
-bool ScalarTraits<char_16>::mustQuote(StringRef S) { return needsQuotes(S); }
+QuotingType ScalarTraits<char_16>::mustQuote(StringRef S) {
+  return needsQuotes(S);
+}
 
 void ScalarTraits<uuid_t>::output(const uuid_t &Val, void *, raw_ostream &Out) {
   Out.write_uuid(Val);
@@ -75,7 +77,9 @@
   return StringRef();
 }
 
-bool ScalarTraits<uuid_t>::mustQuote(StringRef S) { return needsQuotes(S); }
+QuotingType ScalarTraits<uuid_t>::mustQuote(StringRef S) {
+  return needsQuotes(S);
+}
 
 void MappingTraits<MachOYAML::FileHeader>::mapping(
     IO &IO, MachOYAML::FileHeader &FileHdr) {