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 | 6773d388aadf0c8588e3cda343ab621397fde38c (patch) | |
tree | 3fb6f8744c4739dd948237725a958d247f3073ea /llvm/lib/Archive/Archive.cpp | |
parent | 1f50b61329f84977a95708f4aad76b5391768f30 (diff) | |
download | llvm-6773d388aadf0c8588e3cda343ab621397fde38c.zip llvm-6773d388aadf0c8588e3cda343ab621397fde38c.tar.gz llvm-6773d388aadf0c8588e3cda343ab621397fde38c.tar.bz2 |
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.
llvm-svn: 74614
Diffstat (limited to 'llvm/lib/Archive/Archive.cpp')
-rw-r--r-- | llvm/lib/Archive/Archive.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Archive/Archive.cpp b/llvm/lib/Archive/Archive.cpp index c6c89d2..e6903b6 100644 --- a/llvm/lib/Archive/Archive.cpp +++ b/llvm/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<std::string>& symbols) { // Get just the externally visible defined symbols from the bitcode bool llvm::GetBitcodeSymbols(const sys::Path& fName, + LLVMContext* Context, std::vector<std::string>& symbols, std::string* ErrMsg) { std::auto_ptr<MemoryBuffer> 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<std::string>& 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; |