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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@232215 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Blaikie 2015-03-13 21:03:34 +00:00
parent 3b43b23304
commit 75cc2505da

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);