diff options
Diffstat (limited to 'llvm/lib/IR/AsmWriter.cpp')
-rw-r--r-- | llvm/lib/IR/AsmWriter.cpp | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp index 4750cf6071d..c64291cbbfc 100644 --- a/llvm/lib/IR/AsmWriter.cpp +++ b/llvm/lib/IR/AsmWriter.cpp @@ -2203,22 +2203,6 @@ void AssemblyWriter::writeOperandBundles(ImmutableCallSite CS) { Out << " ]"; } -/// Escape any backslashes in the source file (e.g. Windows paths) -/// before emitting, so that it is parsed properly by the lexer on input. -static void EscapeBackslashes(std::string Str, - SmallVectorImpl<char> &Res) { - for (auto C : Str) { - switch (C) { - default: - break; - case '\\': - Res.push_back('\\'); - break; - } - Res.push_back(C); - } -} - void AssemblyWriter::printModule(const Module *M) { Machine.initialize(); @@ -2232,9 +2216,9 @@ void AssemblyWriter::printModule(const Module *M) { Out << "; ModuleID = '" << M->getModuleIdentifier() << "'\n"; if (!M->getSourceFileName().empty()) { - SmallString<128> EscapedName; - EscapeBackslashes(M->getSourceFileName(), EscapedName); - Out << "source_filename = \"" << EscapedName << "\"\n"; + Out << "source_filename = \""; + PrintEscapedString(M->getSourceFileName(), Out); + Out << "\"\n"; } const std::string &DL = M->getDataLayoutStr(); |