[llvm] r181098 - Don't construct or delete a module on the Linker.
Rafael Espindola
rafael.espindola at gmail.com
Fri May 3 19:43:00 PDT 2013
Author: rafael
Date: Fri May 3 21:43:00 2013
New Revision: 181098
URL: http://llvm.org/viewvc/llvm-project?rev=181098&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/Linker.h
llvm/trunk/lib/Linker/Linker.cpp
llvm/trunk/tools/lto/LTOCodeGenerator.cpp
Modified: llvm/trunk/include/llvm/Linker.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Linker.h?rev=181098&r1=181097&r2=181098&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Linker.h (original)
+++ llvm/trunk/include/llvm/Linker.h Fri May 3 21:43:00 2013
@@ -44,13 +44,6 @@ class Linker {
/// @name Constructors
/// @{
public:
- /// Construct the Linker with an empty module which will be given the
- /// name \p progname. \p progname will also be used for error messages.
- /// @brief Construct with empty module
- Linker(StringRef modulename, ///< name of linker's end-result module
- LLVMContext &C ///< Context for global info
- );
-
/// Construct the Linker with a previously defined module, \p aModule. Use
/// \p progname for the name of the program in error messages.
/// @brief Construct with existing module
Modified: llvm/trunk/lib/Linker/Linker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Linker/Linker.cpp?rev=181098&r1=181097&r2=181098&view=diff
==============================================================================
--- llvm/trunk/lib/Linker/Linker.cpp (original)
+++ llvm/trunk/lib/Linker/Linker.cpp Fri May 3 21:43:00 2013
@@ -19,13 +19,8 @@
#include "llvm/Support/system_error.h"
using namespace llvm;
-Linker::Linker(StringRef modname,
- LLVMContext& C):
- Composite(new Module(modname, C)) { }
-
Linker::Linker(Module* aModule) :
Composite(aModule) { }
Linker::~Linker() {
- delete Composite;
}
Modified: llvm/trunk/tools/lto/LTOCodeGenerator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/lto/LTOCodeGenerator.cpp?rev=181098&r1=181097&r2=181098&view=diff
==============================================================================
--- llvm/trunk/tools/lto/LTOCodeGenerator.cpp (original)
+++ llvm/trunk/tools/lto/LTOCodeGenerator.cpp Fri May 3 21:43:00 2013
@@ -69,7 +69,7 @@ const char* LTOCodeGenerator::getVersion
LTOCodeGenerator::LTOCodeGenerator()
: _context(getGlobalContext()),
- _linker("ld-temp.o", _context), _target(NULL),
+ _linker(new Module("ld-temp.o", _context)), _target(NULL),
_emitDwarfDebugInfo(false), _scopeRestrictionsDone(false),
_codeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC),
_nativeObjectFile(NULL) {
@@ -81,6 +81,7 @@ LTOCodeGenerator::LTOCodeGenerator()
LTOCodeGenerator::~LTOCodeGenerator() {
delete _target;
delete _nativeObjectFile;
+ delete _linker.getModule();
for (std::vector<char*>::iterator I = _codegenOptions.begin(),
E = _codegenOptions.end(); I != E; ++I)
More information about the llvm-commits
mailing list