From 8b477ed579794ba6d76915d56b3f448a7dd20120 Mon Sep 17 00:00:00 2001 From: Owen Anderson Date: Wed, 1 Jul 2009 16:58:40 +0000 Subject: 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 --- lib/Archive/Archive.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'lib/Archive/Archive.cpp') diff --git a/lib/Archive/Archive.cpp b/lib/Archive/Archive.cpp index c6c89d27db..e6903b607f 100644 --- a/lib/Archive/Archive.cpp +++ b/lib/Archive/Archive.cpp @@ -138,9 +138,9 @@ bool ArchiveMember::replaceWith(const sys::Path& newFile, std::string* ErrMsg) { // Archive constructor - this is the only constructor that gets used for the // Archive class. Everything else (default,copy) is deprecated. This just // initializes and maps the file into memory, if requested. -Archive::Archive(const sys::Path& filename) +Archive::Archive(const sys::Path& filename, LLVMContext* C) : archPath(filename), members(), mapfile(0), base(0), symTab(), strtab(), - symTabSize(0), firstFileOffset(0), modules(), foreignST(0) { + symTabSize(0), firstFileOffset(0), modules(), foreignST(0), Context(C) { } bool @@ -208,6 +208,7 @@ static void getSymbols(Module*M, std::vector& symbols) { // Get just the externally visible defined symbols from the bitcode bool llvm::GetBitcodeSymbols(const sys::Path& fName, + LLVMContext* Context, std::vector& symbols, std::string* ErrMsg) { std::auto_ptr Buffer( @@ -217,7 +218,7 @@ bool llvm::GetBitcodeSymbols(const sys::Path& fName, return true; } - ModuleProvider *MP = getBitcodeModuleProvider(Buffer.get(), ErrMsg); + ModuleProvider *MP = getBitcodeModuleProvider(Buffer.get(), Context, ErrMsg); if (!MP) return true; @@ -239,13 +240,14 @@ bool llvm::GetBitcodeSymbols(const sys::Path& fName, ModuleProvider* llvm::GetBitcodeSymbols(const unsigned char *BufPtr, unsigned Length, const std::string& ModuleID, + LLVMContext* Context, std::vector& symbols, std::string* ErrMsg) { // Get the module provider MemoryBuffer *Buffer =MemoryBuffer::getNewMemBuffer(Length, ModuleID.c_str()); memcpy((char*)Buffer->getBufferStart(), BufPtr, Length); - ModuleProvider *MP = getBitcodeModuleProvider(Buffer, ErrMsg); + ModuleProvider *MP = getBitcodeModuleProvider(Buffer, Context, ErrMsg); if (!MP) return 0; -- cgit v1.2.3