[llvm] r211213 - Revert a C API difference that I incorrectly introduced.
Rafael Espindola
rafael.espindola at gmail.com
Wed Jun 18 13:07:35 PDT 2014
Author: rafael
Date: Wed Jun 18 15:07:35 2014
New Revision: 211213
URL: http://llvm.org/viewvc/llvm-project?rev=211213&view=rev
Log:
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.
Modified:
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp?rev=211213&r1=211212&r2=211213&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp Wed Jun 18 15:07:35 2014
@@ -3380,6 +3380,7 @@ ErrorOr<Module *> llvm::getLazyBitcodeMo
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;
}
Modified: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h?rev=211213&r1=211212&r2=211213&view=diff
==============================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h (original)
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.h Wed Jun 18 15:07:35 2014
@@ -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;
More information about the llvm-commits
mailing list