llvm.org GIT mirror llvm / 1051937
Don't construct or delete a module on the Linker. The linker is now responsible only for actually linking the modules, it is up to the clients to create and destroy them. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181098 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
3 changed file(s) with 2 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
4343 /// @name Constructors
4444 /// @{
4545 public:
46 /// Construct the Linker with an empty module which will be given the
47 /// name \p progname. \p progname will also be used for error messages.
48 /// @brief Construct with empty module
49 Linker(StringRef modulename, ///< name of linker's end-result module
50 LLVMContext &C ///< Context for global info
51 );
52
5346 /// Construct the Linker with a previously defined module, \p aModule. Use
5447 /// \p progname for the name of the program in error messages.
5548 /// @brief Construct with existing module
1818 #include "llvm/Support/system_error.h"
1919 using namespace llvm;
2020
21 Linker::Linker(StringRef modname,
22 LLVMContext& C):
23 Composite(new Module(modname, C)) { }
24
2521 Linker::Linker(Module* aModule) :
2622 Composite(aModule) { }
2723
2824 Linker::~Linker() {
29 delete Composite;
3025 }
6868
6969 LTOCodeGenerator::LTOCodeGenerator()
7070 : _context(getGlobalContext()),
71 _linker("ld-temp.o", _context), _target(NULL),
71 _linker(new Module("ld-temp.o", _context)), _target(NULL),
7272 _emitDwarfDebugInfo(false), _scopeRestrictionsDone(false),
7373 _codeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC),
7474 _nativeObjectFile(NULL) {
8080 LTOCodeGenerator::~LTOCodeGenerator() {
8181 delete _target;
8282 delete _nativeObjectFile;
83 delete _linker.getModule();
8384
8485 for (std::vector::iterator I = _codegenOptions.begin(),
8586 E = _codegenOptions.end(); I != E; ++I)