diff options
author | Owen Anderson <resistor@mac.com> | 2009-07-01 16:58:40 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2009-07-01 16:58:40 +0000 |
commit | 8b477ed579794ba6d76915d56b3f448a7dd20120 (patch) | |
tree | 70d3be97f6ecf1ab7962e6cfafd113f2f7ce2579 /lib/AsmParser/Parser.cpp | |
parent | 4fb75e542539153acaf31d9221845a7d0feccbf6 (diff) |
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 'lib/AsmParser/Parser.cpp')
-rw-r--r-- | lib/AsmParser/Parser.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/AsmParser/Parser.cpp b/lib/AsmParser/Parser.cpp index 759e00e321..7759c70d73 100644 --- a/lib/AsmParser/Parser.cpp +++ b/lib/AsmParser/Parser.cpp @@ -20,7 +20,8 @@ #include <cstring> using namespace llvm; -Module *llvm::ParseAssemblyFile(const std::string &Filename, ParseError &Err) { +Module *llvm::ParseAssemblyFile(const std::string &Filename, ParseError &Err, + LLVMContext* Context) { Err.setFilename(Filename); std::string ErrorStr; @@ -31,14 +32,14 @@ Module *llvm::ParseAssemblyFile(const std::string &Filename, ParseError &Err) { return 0; } - OwningPtr<Module> M(new Module(Filename)); + OwningPtr<Module> M(new Module(Filename, Context)); if (LLParser(F.get(), Err, M.get()).Run()) return 0; return M.take(); } Module *llvm::ParseAssemblyString(const char *AsmString, Module *M, - ParseError &Err) { + ParseError &Err, LLVMContext* Context) { Err.setFilename("<string>"); OwningPtr<MemoryBuffer> @@ -50,7 +51,7 @@ Module *llvm::ParseAssemblyString(const char *AsmString, Module *M, return LLParser(F.get(), Err, M).Run() ? 0 : M; // Otherwise create a new module. - OwningPtr<Module> M2(new Module("<string>")); + OwningPtr<Module> M2(new Module("<string>", Context)); if (LLParser(F.get(), Err, M2.get()).Run()) return 0; return M2.take(); |