llvm.org GIT mirror llvm / caf71d4
Free the codegen options when deleting LTO code generator object. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153803 91177308-0d34-0410-b5e6-96231b3b80d8 Bill Wendling 7 years ago
1 changed file(s) with 23 addition(s) and 28 deletion(s). Raw diff Collapse all Expand all
5050 #include
5151 #include
5252 #include
53
54
5553 using namespace llvm;
5654
5755 static cl::opt DisableInline("disable-inlining",
5856 cl::desc("Do not run the inliner pass"));
5957
60
61 const char* LTOCodeGenerator::getVersionString()
62 {
58 const char* LTOCodeGenerator::getVersionString() {
6359 #ifdef LLVM_VERSION_INFO
64 return PACKAGE_NAME " version " PACKAGE_VERSION ", " LLVM_VERSION_INFO;
60 return PACKAGE_NAME " version " PACKAGE_VERSION ", " LLVM_VERSION_INFO;
6561 #else
66 return PACKAGE_NAME " version " PACKAGE_VERSION;
62 return PACKAGE_NAME " version " PACKAGE_VERSION;
6763 #endif
6864 }
69
7065
7166 LTOCodeGenerator::LTOCodeGenerator()
7267 : _context(getGlobalContext()),
8075 InitializeAllAsmPrinters();
8176 }
8277
83 LTOCodeGenerator::~LTOCodeGenerator()
84 {
85 delete _target;
86 delete _nativeObjectFile;
87 }
88
89
78 LTOCodeGenerator::~LTOCodeGenerator() {
79 delete _target;
80 delete _nativeObjectFile;
81
82 for (std::vector::iterator I = _codegenOptions.begin(),
83 E = _codegenOptions.end(); I != E; ++I)
84 free(*I);
85 }
9086
9187 bool LTOCodeGenerator::addModule(LTOModule* mod, std::string& errMsg)
9288 {
415411 return false; // success
416412 }
417413
418
419 /// Optimize merged modules using various IPO passes
420 void LTOCodeGenerator::setCodeGenDebugOptions(const char* options)
421 {
422 for (std::pair o = getToken(options);
423 !o.first.empty(); o = getToken(o.second)) {
424 // ParseCommandLineOptions() expects argv[0] to be program name.
425 // Lazily add that.
426 if ( _codegenOptions.empty() )
427 _codegenOptions.push_back("libLTO");
428 _codegenOptions.push_back(strdup(o.first.str().c_str()));
429 }
430 }
414 /// setCodeGenDebugOptions - Set codegen debugging options to aid in debugging
415 /// LTO problems.
416 void LTOCodeGenerator::setCodeGenDebugOptions(const char *options) {
417 for (std::pair o = getToken(options);
418 !o.first.empty(); o = getToken(o.second)) {
419 // ParseCommandLineOptions() expects argv[0] to be program name. Lazily add
420 // that.
421 if ( _codegenOptions.empty() )
422 _codegenOptions.push_back(strdup("libLTO"));
423 _codegenOptions.push_back(strdup(o.first.str().c_str()));
424 }
425 }