[llvm-commits] [llvm] r74265 - /llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
Nick Lewycky
nicholas at mxc.ca
Thu Jun 25 21:33:37 PDT 2009
Author: nicholas
Date: Thu Jun 25 23:33:37 2009
New Revision: 74265
URL: http://llvm.org/viewvc/llvm-project?rev=74265&view=rev
Log:
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!
Modified:
llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
Modified: llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp?rev=74265&r1=74264&r2=74265&view=diff
==============================================================================
--- llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp (original)
+++ llvm/trunk/lib/Target/CppBackend/CPPBackend.cpp Thu Jun 25 23:33:37 2009
@@ -1834,7 +1834,9 @@
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 @@
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";
More information about the llvm-commits
mailing list