Turn assertion into bitcode reading error

I don't think we test invalid bitcode records in any detail, so no test
here - just a change for consistency with existing error checks in
surrounding code.

llvm-svn: 232215
This commit is contained in:
David Blaikie
2015-03-13 21:03:34 +00:00
parent 84a2fe141a
commit 4a5c8c602c

View File

@@ -3126,8 +3126,8 @@ std::error_code BitcodeReader::ParseFunctionBody(Function *F) {
}
I = GetElementPtrInst::Create(BasePtr, GEPIdx);
(void)Ty;
assert(!Ty || Ty == cast<GetElementPtrInst>(I)->getSourceElementType());
if (Ty && Ty != cast<GetElementPtrInst>(I)->getSourceElementType())
return Error("Invalid record");
InstructionList.push_back(I);
if (InBounds)
cast<GetElementPtrInst>(I)->setIsInBounds(true);