mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-15 21:24:00 +00:00
[opaque pointer type] API migration for GEP constant factories
Require the pointee type to be passed explicitly and assert that it is correct. For now it's possible to pass nullptr here (and I've done so in a few places in this patch) but eventually that will be disallowed once all clients have been updated or removed. It'll be a long road to get all the way there... but if you have the cahnce to update your callers to pass the type explicitly without depending on a pointer's element type, that would be a good thing to do soon and a necessary thing to do eventually. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@233938 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -2313,14 +2313,17 @@ std::error_code BitcodeReader::ParseConstants() {
|
||||
Elts.push_back(ValueList.getConstantFwdRef(Record[OpNum++], ElTy));
|
||||
}
|
||||
|
||||
ArrayRef<Constant *> Indices(Elts.begin() + 1, Elts.end());
|
||||
V = ConstantExpr::getGetElementPtr(Elts[0], Indices,
|
||||
BitCode ==
|
||||
bitc::CST_CODE_CE_INBOUNDS_GEP);
|
||||
if (PointeeType &&
|
||||
PointeeType != cast<GEPOperator>(V)->getSourceElementType())
|
||||
PointeeType !=
|
||||
cast<SequentialType>(Elts[0]->getType()->getScalarType())
|
||||
->getElementType())
|
||||
return Error("Explicit gep operator type does not match pointee type "
|
||||
"of pointer operand");
|
||||
|
||||
ArrayRef<Constant *> Indices(Elts.begin() + 1, Elts.end());
|
||||
V = ConstantExpr::getGetElementPtr(PointeeType, Elts[0], Indices,
|
||||
BitCode ==
|
||||
bitc::CST_CODE_CE_INBOUNDS_GEP);
|
||||
break;
|
||||
}
|
||||
case bitc::CST_CODE_CE_SELECT: { // CE_SELECT: [opval#, opval#, opval#]
|
||||
|
Reference in New Issue
Block a user