Revert a C API difference that I incorrectly introduced.
LLVMGetBitcodeModuleInContext should not take ownership on error. I will try to localize this odd api requirement, but this should get the bots green. llvm-svn: 211213
This commit is contained in:
parent
9e42e92e43
commit
8fb3111248
|
@ -3380,6 +3380,7 @@ ErrorOr<Module *> llvm::getLazyBitcodeModule(MemoryBuffer *Buffer,
|
|||
BitcodeReader *R = new BitcodeReader(Buffer, Context, BufferOwned);
|
||||
M->setMaterializer(R);
|
||||
if (std::error_code EC = R->ParseBitcodeInto(M)) {
|
||||
R->releaseBuffer(); // Never take ownership on error.
|
||||
delete M; // Also deletes R.
|
||||
return EC;
|
||||
}
|
||||
|
|
|
@ -239,6 +239,10 @@ public:
|
|||
|
||||
void FreeState();
|
||||
|
||||
void releaseBuffer() {
|
||||
Buffer = nullptr;
|
||||
}
|
||||
|
||||
bool isMaterializable(const GlobalValue *GV) const override;
|
||||
bool isDematerializable(const GlobalValue *GV) const override;
|
||||
std::error_code Materialize(GlobalValue *GV) override;
|
||||
|
|
Loading…
Reference in New Issue