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
This commit is contained in:
Nick Lewycky 2009-06-26 04:33:37 +00:00
parent fc0fc3aedb
commit b8b7347c10

View File

@ -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";