summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-05-04 02:43:00 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-05-04 02:43:00 +0000
commit0229acaa0f2cdf37cddd44d82457695e58707372 (patch)
treef7dba9ea215260aa85efe549ef8940e10e1dabea /llvm
parent02a071aca8f41c926426c6287346d23291e7f5ac (diff)
downloadbcm5719-llvm-0229acaa0f2cdf37cddd44d82457695e58707372.tar.gz
bcm5719-llvm-0229acaa0f2cdf37cddd44d82457695e58707372.zip
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. llvm-svn: 181098
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Linker.h7
-rw-r--r--llvm/lib/Linker/Linker.cpp5
-rw-r--r--llvm/tools/lto/LTOCodeGenerator.cpp3
3 files changed, 2 insertions, 13 deletions
diff --git a/llvm/include/llvm/Linker.h b/llvm/include/llvm/Linker.h
index 6761b8e68ed..b199a34cbf8 100644
--- a/llvm/include/llvm/Linker.h
+++ b/llvm/include/llvm/Linker.h
@@ -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
diff --git a/llvm/lib/Linker/Linker.cpp b/llvm/lib/Linker/Linker.cpp
index c80f8173c3f..ab99b98ee04 100644
--- a/llvm/lib/Linker/Linker.cpp
+++ b/llvm/lib/Linker/Linker.cpp
@@ -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;
}
diff --git a/llvm/tools/lto/LTOCodeGenerator.cpp b/llvm/tools/lto/LTOCodeGenerator.cpp
index 683a480d3fb..de2c1fd4b8d 100644
--- a/llvm/tools/lto/LTOCodeGenerator.cpp
+++ b/llvm/tools/lto/LTOCodeGenerator.cpp
@@ -69,7 +69,7 @@ const char* LTOCodeGenerator::getVersionString() {
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)
OpenPOWER on IntegriCloud