aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lto/LTOModule.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-02 00:31:14 +0000
committerOwen Anderson <resistor@mac.com>2009-07-02 00:31:14 +0000
commit353dadbf8593671468a243e1e14ea55836259f17 (patch)
tree69c161120ebf5ea3e8f5d7a20a26ca90cc78b193 /tools/lto/LTOModule.cpp
parentf151969c988d7bebf22ded9bde88a860cd59878c (diff)
downloadexternal_llvm-353dadbf8593671468a243e1e14ea55836259f17.zip
external_llvm-353dadbf8593671468a243e1e14ea55836259f17.tar.gz
external_llvm-353dadbf8593671468a243e1e14ea55836259f17.tar.bz2
Maintain the old LTO API, by using the global context.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74678 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lto/LTOModule.cpp')
-rw-r--r--tools/lto/LTOModule.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/tools/lto/LTOModule.cpp b/tools/lto/LTOModule.cpp
index 157928c..9c8baef 100644
--- a/tools/lto/LTOModule.cpp
+++ b/tools/lto/LTOModule.cpp
@@ -69,7 +69,7 @@ bool LTOModule::isBitcodeFileForTarget(const char* path,
bool LTOModule::isTargetMatch(MemoryBuffer* buffer, const char* triplePrefix)
{
OwningPtr<ModuleProvider> mp(getBitcodeModuleProvider(buffer,
- *new LLVMContext()));
+ getGlobalContext()));
// on success, mp owns buffer and both are deleted at end of this method
if ( !mp ) {
delete buffer;
@@ -87,13 +87,12 @@ LTOModule::LTOModule(Module* m, TargetMachine* t)
}
LTOModule* LTOModule::makeLTOModule(const char* path,
- LLVMContext& Context,
std::string& errMsg)
{
OwningPtr<MemoryBuffer> buffer(MemoryBuffer::getFile(path, &errMsg));
if ( !buffer )
return NULL;
- return makeLTOModule(buffer.get(), Context, errMsg);
+ return makeLTOModule(buffer.get(), errMsg);
}
/// makeBuffer - create a MemoryBuffer from a memory range.
@@ -113,13 +112,12 @@ MemoryBuffer* LTOModule::makeBuffer(const void* mem, size_t length)
LTOModule* LTOModule::makeLTOModule(const void* mem, size_t length,
- LLVMContext& Context,
std::string& errMsg)
{
OwningPtr<MemoryBuffer> buffer(makeBuffer(mem, length));
if ( !buffer )
return NULL;
- return makeLTOModule(buffer.get(), Context, errMsg);
+ return makeLTOModule(buffer.get(), errMsg);
}
/// getFeatureString - Return a string listing the features associated with the
@@ -142,11 +140,10 @@ std::string getFeatureString(const char *TargetTriple) {
}
LTOModule* LTOModule::makeLTOModule(MemoryBuffer* buffer,
- LLVMContext& Context,
std::string& errMsg)
{
// parse bitcode buffer
- OwningPtr<Module> m(ParseBitcodeFile(buffer, Context, &errMsg));
+ OwningPtr<Module> m(ParseBitcodeFile(buffer, getGlobalContext(), &errMsg));
if ( !m )
return NULL;
// find machine architecture for this module