summaryrefslogtreecommitdiff
path: root/tools/lto/lto.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2009-07-01 16:58:40 +0000
committerOwen Anderson <resistor@mac.com>2009-07-01 16:58:40 +0000
commit8b477ed579794ba6d76915d56b3f448a7dd20120 (patch)
tree70d3be97f6ecf1ab7962e6cfafd113f2f7ce2579 /tools/lto/lto.cpp
parent4fb75e542539153acaf31d9221845a7d0feccbf6 (diff)
downloadllvm-8b477ed579794ba6d76915d56b3f448a7dd20120.tar.gz
llvm-8b477ed579794ba6d76915d56b3f448a7dd20120.tar.bz2
llvm-8b477ed579794ba6d76915d56b3f448a7dd20120.tar.xz
Add a pointer to the owning LLVMContext to Module. This requires threading LLVMContext through a lot
of the bitcode reader and ASM parser APIs, as well as supporting it in all of the tools. Patches for Clang and LLVM-GCC to follow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74614 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lto/lto.cpp')
-rw-r--r--tools/lto/lto.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp
index a0f67b44f5..c25f87c340 100644
--- a/tools/lto/lto.cpp
+++ b/tools/lto/lto.cpp
@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "llvm-c/lto.h"
+#include "llvm-c/Core.h"
#include "LTOModule.h"
#include "LTOCodeGenerator.h"
@@ -85,9 +86,10 @@ bool lto_module_is_object_file_in_memory_for_target(const void* mem,
// loads an object file from disk
// returns NULL on error (check lto_get_error_message() for details)
//
-lto_module_t lto_module_create(const char* path)
+lto_module_t lto_module_create(const char* path, LLVMContextRef Ctxt)
{
- return LTOModule::makeLTOModule(path, sLastErrorString);
+ return LTOModule::makeLTOModule(path, llvm::unwrap(Ctxt),
+ sLastErrorString);
}
@@ -95,9 +97,11 @@ lto_module_t lto_module_create(const char* path)
// loads an object file from memory
// returns NULL on error (check lto_get_error_message() for details)
//
-lto_module_t lto_module_create_from_memory(const void* mem, size_t length)
+lto_module_t lto_module_create_from_memory(const void* mem, size_t length,
+ LLVMContextRef Ctxt)
{
- return LTOModule::makeLTOModule(mem, length, sLastErrorString);
+ return LTOModule::makeLTOModule(mem, length, llvm::unwrap(Ctxt),
+ sLastErrorString);
}