[ThinLTO] Escape module paths when printing
authorAndrew Ng <anng.sw@gmail.com>
Thu, 12 Jul 2018 14:40:21 +0000 (14:40 +0000)
committerAndrew Ng <anng.sw@gmail.com>
Thu, 12 Jul 2018 14:40:21 +0000 (14:40 +0000)
commitac305e18a48d768831b972b088d01dc032962525
tree60eb9d02e9781609b88bd068c78c92fe4ce78fc2
parent8b2ab91a5d034fff1f80aa0e32142fafcbd90734
[ThinLTO] Escape module paths when printing

We have located a bug in AssemblyWriter::printModuleSummaryIndex(). This
function outputs path strings incorrectly. Backslashes in the strings
are not correctly escaped.

Consequently, if a path name contains a backslash followed by two
hexadecimal characters, the sequence is incorrectly interpreted when the
output is read by another component. This mangles the path and results
in error.

This patch fixes this issue by calling printEscapedString() to output
the module paths.

Patch by Chris Jackson.

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

llvm-svn: 336908
llvm/lib/IR/AsmWriter.cpp
llvm/test/Assembler/asm-path-writer.ll [new file with mode: 0644]