1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 19:52:54 +01:00

No really, you _cannot use_ getelementptr on an unsized type: that makes

no sense.

llvm-svn: 6595
This commit is contained in:
Chris Lattner 2003-06-04 02:35:35 +00:00
parent ee88ddfc38
commit 7190c04fc5

View File

@ -193,12 +193,8 @@ uint64_t TargetData::getIndexedOffset(const Type *ptrTy,
Ty = cast<SequentialType>(Ty)->getElementType();
// Get the array index and the size of each array element.
// The size must be a known value, except if arrayIdx is 0.
// In particular, don't try to get the type size if the arrayIdx is 0:
// 0 index into an unsized type is legal and should be allowed.
int64_t arrayIdx = cast<ConstantSInt>(Idx[CurIDX])->getValue();
Result += arrayIdx == 0? 0
: arrayIdx * (int64_t)getTypeSize(Ty);
Result += arrayIdx * (int64_t)getTypeSize(Ty);
} else {
const StructType *STy = cast<StructType>(Ty);
assert(Idx[CurIDX]->getType() == Type::UByteTy && "Illegal struct idx");