summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.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
commit6773d388aadf0c8588e3cda343ab621397fde38c (patch)
tree3fb6f8744c4739dd948237725a958d247f3073ea /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent1f50b61329f84977a95708f4aad76b5391768f30 (diff)
downloadbcm5719-llvm-6773d388aadf0c8588e3cda343ab621397fde38c.tar.gz
bcm5719-llvm-6773d388aadf0c8588e3cda343ab621397fde38c.zip
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/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 6b9606c5d14..7cf03242990 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -1087,7 +1087,7 @@ bool BitcodeReader::ParseModule(const std::string &ModuleID) {
return Error("Malformed block record");
// Otherwise, create the module.
- TheModule = new Module(ModuleID);
+ TheModule = new Module(ModuleID, Context);
SmallVector<uint64_t, 64> Record;
std::vector<std::string> SectionTable;
@@ -2090,8 +2090,9 @@ Module *BitcodeReader::releaseModule(std::string *ErrInfo) {
/// getBitcodeModuleProvider - lazy function-at-a-time loading from a file.
///
ModuleProvider *llvm::getBitcodeModuleProvider(MemoryBuffer *Buffer,
+ LLVMContext* Context,
std::string *ErrMsg) {
- BitcodeReader *R = new BitcodeReader(Buffer);
+ BitcodeReader *R = new BitcodeReader(Buffer, Context);
if (R->ParseBitcode()) {
if (ErrMsg)
*ErrMsg = R->getErrorString();
@@ -2106,9 +2107,11 @@ ModuleProvider *llvm::getBitcodeModuleProvider(MemoryBuffer *Buffer,
/// ParseBitcodeFile - Read the specified bitcode file, returning the module.
/// If an error occurs, return null and fill in *ErrMsg if non-null.
-Module *llvm::ParseBitcodeFile(MemoryBuffer *Buffer, std::string *ErrMsg){
+Module *llvm::ParseBitcodeFile(MemoryBuffer *Buffer, LLVMContext* Context,
+ std::string *ErrMsg){
BitcodeReader *R;
- R = static_cast<BitcodeReader*>(getBitcodeModuleProvider(Buffer, ErrMsg));
+ R = static_cast<BitcodeReader*>(getBitcodeModuleProvider(Buffer, Context,
+ ErrMsg));
if (!R) return 0;
// Read in the entire module.
OpenPOWER on IntegriCloud