mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-05 13:26:55 +00:00
LLParser: gep: Simplify parsing error handling
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231722 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -5465,21 +5465,15 @@ int LLParser::ParseGetElementPtr(Instruction *&Inst, PerFunctionState &PFS) {
|
||||
ParseTypeAndValue(Ptr, Loc, PFS))
|
||||
return true;
|
||||
|
||||
Type *PtrTy = Ptr->getType();
|
||||
if (VectorType *VT = dyn_cast<VectorType>(PtrTy))
|
||||
PtrTy = VT->getElementType();
|
||||
SequentialType *SeqPtrTy = dyn_cast<SequentialType>(PtrTy);
|
||||
if (!SeqPtrTy)
|
||||
return Error(Loc, "pointer type is not valid");
|
||||
if (Ty != SeqPtrTy->getElementType())
|
||||
return Error(ExplicitTypeLoc,
|
||||
"explicit pointee type doesn't match operand's pointee type");
|
||||
|
||||
Type *BaseType = Ptr->getType();
|
||||
PointerType *BasePointerType = dyn_cast<PointerType>(BaseType->getScalarType());
|
||||
if (!BasePointerType)
|
||||
return Error(Loc, "base of getelementptr must be a pointer");
|
||||
|
||||
if (Ty != BasePointerType->getElementType())
|
||||
return Error(ExplicitTypeLoc,
|
||||
"explicit pointee type doesn't match operand's pointee type");
|
||||
|
||||
SmallVector<Value*, 16> Indices;
|
||||
bool AteExtraComma = false;
|
||||
while (EatIfPresent(lltok::comma)) {
|
||||
|
Reference in New Issue
Block a user