diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2009-06-26 04:33:37 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2009-06-26 04:33:37 +0000 |
commit | aa1e3b9e2fda0f9bd1aa9e55959802ae926ad8c3 (patch) | |
tree | 54d0da8b85d718a43da7a6ed61afac036266b45f /lib | |
parent | e2d4fc5831de787f8ccfe6281a22e9a1d57ddd7c (diff) | |
download | external_llvm-aa1e3b9e2fda0f9bd1aa9e55959802ae926ad8c3.zip external_llvm-aa1e3b9e2fda0f9bd1aa9e55959802ae926ad8c3.tar.gz external_llvm-aa1e3b9e2fda0f9bd1aa9e55959802ae926ad8c3.tar.bz2 |
Escape the name of the module since it comes from the file name and may include
invalid characters like backslashes on Windows. Patch by James Abbatiello!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74265 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Target/CppBackend/CPPBackend.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 44418f6..28f58e8 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -1834,7 +1834,9 @@ namespace { const std::string& mName) { nl(Out) << "Module* " << fname << "() {"; nl(Out,1) << "// Module Construction"; - nl(Out) << "Module* mod = new Module(\"" << mName << "\");"; + nl(Out) << "Module* mod = new Module(\""; + printEscapedString(mName); + Out << "\");"; if (!TheModule->getTargetTriple().empty()) { nl(Out) << "mod->setDataLayout(\"" << TheModule->getDataLayout() << "\");"; } @@ -1867,7 +1869,9 @@ namespace { void CppWriter::printContents(const std::string& fname, const std::string& mName) { Out << "\nModule* " << fname << "(Module *mod) {\n"; - Out << "\nmod->setModuleIdentifier(\"" << mName << "\");\n"; + Out << "\nmod->setModuleIdentifier(\""; + printEscapedString(mName); + Out << "\");\n"; printModuleBody(); Out << "\nreturn mod;\n"; Out << "\n}\n"; |