[YAML] Add support for non-printable characters
authorFrancis Visoiu Mistrih <francisvm@yahoo.com>
Mon, 18 Dec 2017 17:38:03 +0000 (17:38 +0000)
committerFrancis Visoiu Mistrih <francisvm@yahoo.com>
Mon, 18 Dec 2017 17:38:03 +0000 (17:38 +0000)
commitb213b27ee3cba7d0b7ad2a45c8cbd42e59510220
tree887a44fd8bb29d305bc2c240e44a01467ca9cc38
parent6c0858e41413de10b7194519fc6cb9d4a1eda959
[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
17 files changed:
llvm/docs/YamlIO.rst
llvm/include/llvm/CodeGen/MIRYamlMapping.h
llvm/include/llvm/ObjectYAML/CodeViewYAMLTypeHashing.h
llvm/include/llvm/ObjectYAML/CodeViewYAMLTypes.h
llvm/include/llvm/ObjectYAML/MachOYAML.h
llvm/include/llvm/ObjectYAML/YAML.h
llvm/include/llvm/Support/YAMLTraits.h
llvm/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp
llvm/lib/ObjectYAML/CodeViewYAMLSymbols.cpp
llvm/lib/ObjectYAML/CodeViewYAMLTypes.cpp
llvm/lib/ObjectYAML/MachOYAML.cpp
llvm/lib/Support/Statistic.cpp
llvm/lib/Support/Timer.cpp
llvm/lib/Support/YAMLTraits.cpp
llvm/test/CodeGen/MIR/X86/escape-function-name.ll [new file with mode: 0644]
llvm/tools/dsymutil/DebugMap.h
llvm/unittests/Support/YAMLIOTest.cpp