diff options
Diffstat (limited to 'lib/Target/CppBackend')
| -rw-r--r-- | lib/Target/CppBackend/CPPBackend.cpp | 14 | 
1 files changed, 8 insertions, 6 deletions
| diff --git a/lib/Target/CppBackend/CPPBackend.cpp b/lib/Target/CppBackend/CPPBackend.cpp index 1feea96e3d9d..28f58e86f623 100644 --- a/lib/Target/CppBackend/CPPBackend.cpp +++ b/lib/Target/CppBackend/CPPBackend.cpp @@ -82,10 +82,8 @@ int CppBackendTargetMachineModule = 0;  // Register the target.  static RegisterTarget<CPPTargetMachine> X("cpp", "C++ backend"); -// Force static initialization when called from llvm/InitializeAllTargets.h -namespace llvm { -  void InitializeCppBackendTarget() { } -} +// Force static initialization. +extern "C" void LLVMInitializeCppBackendTarget() { }  namespace {    typedef std::vector<const Type*> TypeList; @@ -1836,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() << "\");";      } @@ -1869,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"; | 
